AP_HAL: added begin_atomic and end_atomic to scheduler

This commit is contained in:
Pat Hickey 2012-11-19 16:57:30 -08:00 committed by Andrew Tridgell
parent 197a685923
commit c9541d3b00
3 changed files with 13 additions and 0 deletions

View File

@ -22,6 +22,9 @@ public:
uint32_t period_us) = 0;
virtual void suspend_timer_procs() = 0;
virtual void resume_timer_procs() = 0;
virtual void begin_atomic() = 0;
virtual void end_atomic() = 0;
};
#endif // __AP_HAL_SCHEDULER_H__

View File

@ -321,3 +321,11 @@ void ArduinoScheduler::_timer_event() {
_in_timer_proc = false;
}
void ArduinoScheduler::begin_atomic() {
cli();
}
void ArduinoScheduler::end_atomic() {
sei();
}

View File

@ -25,6 +25,8 @@ public:
void register_timer_failsafe(AP_HAL::TimedProc, uint32_t period_us);
void suspend_timer_procs();
void resume_timer_procs();
void begin_atomic();
void end_atomic();
private:
/* Implementation specific methods: */