You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
831 B
29 lines
831 B
|
|
#ifndef __AP_TIMERPROCESS_H__ |
|
#define __AP_TIMERPROCESS_H__ |
|
|
|
#include "PeriodicProcess.h" |
|
#include "../Arduino_Mega_ISR_Registry/Arduino_Mega_ISR_Registry.h" |
|
|
|
// default to 1kHz timer interrupt |
|
#define TIMERPROCESS_PER_DEFAULT (256-62) // 1kHz |
|
|
|
#define AP_TIMERPROCESS_MAX_PROCS 3 |
|
|
|
class AP_TimerProcess : public AP_PeriodicProcess |
|
{ |
|
public: |
|
AP_TimerProcess(int period = TIMERPROCESS_PER_DEFAULT); |
|
void init( Arduino_Mega_ISR_Registry * isr_reg ); |
|
void register_process(ap_procedure proc); |
|
void set_failsafe(ap_procedure proc); |
|
static void run(void); |
|
protected: |
|
static int _period; |
|
static ap_procedure _proc[AP_TIMERPROCESS_MAX_PROCS]; |
|
static ap_procedure _failsafe; |
|
static int _pidx; |
|
static bool _in_timer_call; |
|
}; |
|
|
|
#endif // __AP_TIMERPROCESS_H__
|
|
|