2012-04-30 03:11:05 -03:00
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
2011-11-12 23:02:24 -04:00
# ifndef __PERIODICPROCESS_H__
# define __PERIODICPROCESS_H__
2011-12-21 08:21:39 -04:00
# include <stdint.h>
// the callback type for periodic processes. They are passed the time
2012-08-17 03:20:55 -03:00
// in microseconds since boot
2011-12-21 08:21:39 -04:00
typedef void ( * ap_procedure ) ( uint32_t ) ;
2011-12-09 01:27:50 -04:00
2011-11-12 23:02:24 -04:00
class AP_PeriodicProcess
{
2012-04-30 03:11:05 -03:00
public :
2012-08-17 03:20:55 -03:00
virtual void register_process ( ap_procedure proc ) = 0 ;
virtual void set_failsafe ( ap_procedure proc ) = 0 ;
2012-09-06 02:07:29 -03:00
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
2012-08-17 03:20:55 -03:00
virtual void suspend_timer ( void ) = 0 ;
virtual void resume_timer ( void ) = 0 ;
2012-09-29 01:47:55 -03:00
virtual bool running ( ) = 0 ;
2011-11-12 23:02:24 -04:00
} ;
# endif // __PERIODICPROCESS_H__