Timer Class

class TimerClass : public Acroname::BrainStem::EntityClass

TimerClass. The Timer Class provides access to a simple scheduler. Reflex routines can be written which will be executed upon expiration of the timer entity. The timer can be set to fire only once, or to repeat at a certain interval.

Public Functions

TimerClass(void)

Constructor.

~TimerClass(void)

Destructor.

void init(Module *pModule, const uint8_t index)

Initialize the class.

Parameters
  • pModule: The module to which this entity belongs.
  • index: The index of the timer entity.

aErr getExpiration(uint32_t *usecDuration)

Get the currently set expiration time in microseconds. This is not a “live” timer. That is, it shows the expiration time originally set with setExpiration; it does not “tick down” to show the time remaining before expiration.

Return
Returns common entity return values
Parameters
  • usecDuration: The timer expiration duration in microseconds.

aErr setExpiration(const uint32_t usecDuration)

Set the expiration time for the timer entity. When the timer expires, it will fire the associated timer[index]() reflex.

Return
Returns common entity return values
Parameters
  • usecDuration: The duration before timer expiration in microseconds.

aErr getMode(uint8_t *mode)

Get the mode of the timer which is either single or repeat mode.

Return
Returns common entity return values
Parameters
  • mode: The mode of the time. aTIMER_MODE_REPEAT or aTIMER_MODE_SINGLE.

aErr setMode(const uint8_t mode)

Set the mode of the timer which is either single or repeat mode.

Return
Returns common entity return values
Return
aErrNone - Action completed successfully.
Parameters
  • mode: The mode of the timer. aTIMER_MODE_REPEAT or aTIMER_MODE_SINGLE.