Argon RTOS  1.3.0
Tiny embedded real-time kernel
Ar::Timer Class Reference

#include <ar_classes.h>

+ Inheritance diagram for Ar::Timer:

Description

Timer object.

+ Collaboration diagram for Ar::Timer:

Public Types

typedef void(* callback_t) (Timer *timer, void *param)
 Timer callback function that takes an instance of this class.
 

Public Member Functions

 Timer ()
 Default constructor.
 
 Timer (const char *name, callback_t callback, void *param, ar_timer_mode_t timerMode, uint32_t delay)
 Constructor.
 
 ~Timer ()
 Destructor.
 
uint32_t getDelay () const
 Get the current delay for the timer.
 
const char * getName () const
 Get the timer's name.
 
ar_status_t init (const char *name, callback_t callback, void *param, ar_timer_mode_t timerMode, uint32_t delay)
 Initialize the timer.
 
bool isActive () const
 Returns whether the timer is currently running.
 
void setDelay (uint32_t delay)
 Adjust the timer's delay.
 
void start ()
 Start the timer running.
 
void stop ()
 Stop the timer.
 

Static Protected Member Functions

static void timer_wrapper (ar_timer_t *timer, void *arg)
 Converts the timer struct to an instance of this class.
 

Protected Attributes

callback_t m_userCallback
 The user timer callback.
 

Additional Inherited Members

- Public Attributes inherited from ar_timer_t
ar_list_node_t m_activeNode
 Node for the list of active timers.
 
ar_timer_entry_t m_callback
 Timer expiration callback.
 
uint32_t m_delay
 Delay in ticks.
 
bool m_isActive
 Whether the timer is running and on the active timers list.
 
bool m_isRunning
 Whether the timer callback is executing.
 
ar_timer_mode_t m_mode
 One-shot or periodic mode.
 
const char * m_name
 Name of the timer.
 
void * m_param
 Arbitrary parameter for the callback.
 
ar_runloop_t * m_runLoop
 Runloop to which the timer is bound.
 
uint32_t m_wakeupTime
 Expiration time in ticks.