mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-24 19:42:27 +03:00
Interrupt cleanup
Fixes issue of reentrant calls to nointerrupts() exposed functional replacements to cli sei and SREG when dealing with interrupts InterruptLock class to auto stop and restore interrupt level Fix user ISR calls to be like Arduino with interrupts disabled fully.
This commit is contained in:
@ -32,7 +32,13 @@ static volatile timercallback timer1_user_cb = NULL;
|
||||
void timer1_isr_handler(void *para){
|
||||
if ((T1C & ((1 << TCAR) | (1 << TCIT))) == 0) TEIE &= ~TEIE1;//edge int disable
|
||||
T1I = 0;
|
||||
if (timer1_user_cb) timer1_user_cb();
|
||||
if (timer1_user_cb) {
|
||||
// to make ISR compatible to Arduino AVR model where interrupts are disabled
|
||||
// we disable them before we call the client ISR
|
||||
uint32_t savedPS = xt_rsil(15); // stop other interrupts
|
||||
timer1_user_cb();
|
||||
xt_wsr_ps(savedPS);
|
||||
}
|
||||
}
|
||||
|
||||
void timer1_isr_init(){
|
||||
@ -72,7 +78,11 @@ static volatile timercallback timer0_user_cb = NULL;
|
||||
|
||||
void timer0_isr_handler(void* para){
|
||||
if (timer0_user_cb) {
|
||||
// to make ISR compatible to Arduino AVR model where interrupts are disabled
|
||||
// we disable them before we call the client ISR
|
||||
uint32_t savedPS = xt_rsil(15); // stop other interrupts
|
||||
timer0_user_cb();
|
||||
xt_wsr_ps(savedPS);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user