2011-11-13 02:42:20 -04:00
# ifndef __AP_PERIODIC_PROCESS_STUB_H__
# define __AP_PERIODIC_PROCESS_STUB_H__
# include "PeriodicProcess.h"
# include "../Arduino_Mega_ISR_Registry/Arduino_Mega_ISR_Registry.h"
class AP_PeriodicProcessStub : public AP_PeriodicProcess
{
2012-08-17 03:20:55 -03:00
public :
AP_PeriodicProcessStub ( uint8_t period = 0 ) ;
void init ( Arduino_Mega_ISR_Registry * isr_reg ) ;
void register_process ( ap_procedure proc ) ;
void set_failsafe ( ap_procedure proc ) ;
2012-09-06 02:07:29 -03:00
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
2012-08-17 03:20:55 -03:00
void suspend_timer ( void ) ;
void resume_timer ( void ) ;
2012-09-29 01:47:55 -03:00
bool running ( ) ;
2012-08-17 03:20:55 -03:00
static void run ( void ) ;
protected :
static uint8_t _period ;
static void ( * _proc ) ( void ) ;
static void ( * _failsafe ) ( void ) ;
2012-09-06 02:07:29 -03:00
static void ( * _queued_proc ) ( void ) ;
2012-08-17 03:20:55 -03:00
static bool _suspended ;
2011-11-13 02:42:20 -04:00
} ;
# endif