AP_PeriodicProcess: added running() method which tells the caller whether the timer is suspended or not

This commit is contained in:
rmackay9 2012-09-29 13:47:55 +09:00
parent 00e79e7915
commit c007a19200
5 changed files with 10 additions and 0 deletions

View File

@ -15,5 +15,8 @@ void AP_PeriodicProcessStub::suspend_timer(void) {
}
void AP_PeriodicProcessStub::resume_timer(void) {
}
bool AP_PeriodicProcessStub::running(void) {
return !_suspended;
}
void AP_PeriodicProcessStub::run(void) {
}

View File

@ -16,6 +16,7 @@ public:
bool queue_process(ap_procedure proc); // queue process to run as soon as possible after any currently running ap_processes complete. returns true if it ran immediately
void suspend_timer(void);
void resume_timer(void);
bool running();
static void run(void);
protected:
static uint8_t _period;

View File

@ -96,6 +96,10 @@ void AP_TimerProcess::resume_timer(void)
_suspended = false;
}
bool AP_TimerProcess::running(void) {
return !_suspended;
}
void AP_TimerProcess::run(void)
{
// we enable the interrupt again immediately and also enable

View File

@ -20,6 +20,7 @@ public:
void set_failsafe(ap_procedure proc);
void suspend_timer(void);
void resume_timer(void);
bool running();
static void run(void);
protected:
static uint8_t _period;

View File

@ -17,6 +17,7 @@ public:
virtual bool queue_process(ap_procedure proc) = 0; // queue process to run as soon as possible after any currently running ap_processes complete. returns true if it ran immediately
virtual void suspend_timer(void) = 0;
virtual void resume_timer(void) = 0;
virtual bool running() = 0;
};
#endif // __PERIODICPROCESS_H__