Skip to content
Snippets Groups Projects
Commit da6f6f3e authored by Andrew Tridgell's avatar Andrew Tridgell
Browse files

PeriodicProcess: switch to SREG = oldSREG pattern for interrupt mask/restore

parent 3646b4b8
No related branches found
No related tags found
No related merge requests found
......@@ -56,10 +56,11 @@ void AP_TimerProcess::register_process(ap_procedure proc)
for (uint8_t i=0; i<_pidx; i++) {
if (_proc[i] == proc) return;
}
uint8_t oldSREG = SREG;
cli();
if (_pidx < AP_TIMERPROCESS_MAX_PROCS)
_proc[_pidx++] = proc;
sei();
SREG = oldSREG;
}
void AP_TimerProcess::set_failsafe(ap_procedure proc)
......@@ -140,10 +141,11 @@ void AP_TimerProcess::run(void)
}
// run any queued processes
uint8_t oldSREG = SREG;
cli();
ap_procedure qp = _queued_proc;
_queued_proc = NULL;
sei();
SREG = oldSREG;
if( qp != NULL ) {
_suspended = true;
qp(tnow);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment