AP_PeriodicProcess: added running() method which tells the caller whether the timer is suspended or not
This commit is contained in:
parent
2c29fd8ba4
commit
56320d282f
@ -15,5 +15,8 @@ void AP_PeriodicProcessStub::suspend_timer(void) {
|
|||||||
}
|
}
|
||||||
void AP_PeriodicProcessStub::resume_timer(void) {
|
void AP_PeriodicProcessStub::resume_timer(void) {
|
||||||
}
|
}
|
||||||
|
bool AP_PeriodicProcessStub::running(void) {
|
||||||
|
return !_suspended;
|
||||||
|
}
|
||||||
void AP_PeriodicProcessStub::run(void) {
|
void AP_PeriodicProcessStub::run(void) {
|
||||||
}
|
}
|
||||||
|
@ -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
|
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 suspend_timer(void);
|
||||||
void resume_timer(void);
|
void resume_timer(void);
|
||||||
|
bool running();
|
||||||
static void run(void);
|
static void run(void);
|
||||||
protected:
|
protected:
|
||||||
static uint8_t _period;
|
static uint8_t _period;
|
||||||
|
@ -96,6 +96,10 @@ void AP_TimerProcess::resume_timer(void)
|
|||||||
_suspended = false;
|
_suspended = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AP_TimerProcess::running(void) {
|
||||||
|
return !_suspended;
|
||||||
|
}
|
||||||
|
|
||||||
void AP_TimerProcess::run(void)
|
void AP_TimerProcess::run(void)
|
||||||
{
|
{
|
||||||
// we enable the interrupt again immediately and also enable
|
// we enable the interrupt again immediately and also enable
|
||||||
|
@ -20,6 +20,7 @@ public:
|
|||||||
void set_failsafe(ap_procedure proc);
|
void set_failsafe(ap_procedure proc);
|
||||||
void suspend_timer(void);
|
void suspend_timer(void);
|
||||||
void resume_timer(void);
|
void resume_timer(void);
|
||||||
|
bool running();
|
||||||
static void run(void);
|
static void run(void);
|
||||||
protected:
|
protected:
|
||||||
static uint8_t _period;
|
static uint8_t _period;
|
||||||
|
@ -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 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 suspend_timer(void) = 0;
|
||||||
virtual void resume_timer(void) = 0;
|
virtual void resume_timer(void) = 0;
|
||||||
|
virtual bool running() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __PERIODICPROCESS_H__
|
#endif // __PERIODICPROCESS_H__
|
||||||
|
Loading…
Reference in New Issue
Block a user