Set ISR priorities

This commit is contained in:
Todd Fleming 2017-01-08 20:48:25 -05:00
parent 8a28b4d098
commit 53ebacb6e4
2 changed files with 34 additions and 14 deletions

View File

@ -22,6 +22,8 @@
#include "grbl.h"
#include "current_control.h"
void isr_init();
/*Holding space for dummy registers*/
DummyReg DDRA;
DummyReg DDRB;
@ -43,28 +45,14 @@ DummyReg EECR;
DummyReg EEDR;
DummyReg EEMPE;
DummyReg EEPE;
DummyReg OCIE0A;
DummyReg OCIE0B;
DummyReg OCIE1A;
DummyReg OCR1A;
DummyReg OCR2A;
DummyReg PCICR;
DummyReg PCIE0;
DummyReg PCIE1;
DummyReg PCMSK0;
DummyReg PCMSK1;
DummyReg SREG;
DummyReg TCCR0A;
DummyReg TCCR0B;
DummyReg TCCR1A;
DummyReg TCCR1B;
DummyReg TCCRA;
DummyReg TCCR2A;
DummyReg TCCR2B;
DummyReg TCNT0;
DummyReg TIMSK0;
DummyReg TIMSK1;
DummyReg TOIE0;
DummyReg UCSR0A;
DummyReg UCSR0B;
@ -88,6 +76,7 @@ volatile uint8_t sys_rt_exec_accessory_override; // Global realtime executor bit
int main(void)
{
// Initialize system upon power-up.
isr_init(); // Set ISR priorities
delay_init(); // Setup delay timer
serial_init(); // Setup serial baud rate and interrupts
settings_init(); // Load Grbl settings from EEPROM

31
smoother/isr_init.cpp Normal file
View File

@ -0,0 +1,31 @@
// Copyright 2017 Todd Fleming
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
#include "grbl.h"
void isr_init()
{
// Set all interrupts to lowest priority
for (auto &ip : NVIC->IP)
ip = 31;
// Stepper ISR needs highest priority
NVIC->IP[TIMER1_IRQn] = 0;
}