Timer¶
- class brainstem.entity.Timer(module, index)[source]¶
TimerClass: The Timer Class provides access to a simple scheduler. The timer can set to fire only once, or to repeat at a certain interval. Additionally, a timer entity can execute custom Reflex routines upon firing.
- getExpiration()[source]¶
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. The timer expiration duration in microseconds.
- Returns:
Result object containing the requested value when the results error is set to NO_ERROR(0)
- Return type:
- getMode()[source]¶
Get the mode of the timer which is either single or repeat mode. The mode of the time. aTIMER_MODE_REPEAT or aTIMER_MODE_SINGLE.
- Returns:
Result object containing the requested value when the results error is set to NO_ERROR(0)
- Return type:
- setExpiration(usecDuration)[source]¶
Set the expiration time for the timer entity. When the timer expires, it will fire the associated timer[index]() reflex.
- Parameters:
usecDuration (const unsigned int) – The duration before timer expiration in microseconds.
- Returns:
An error result from the list of defined error codes in brainstem.result
- Return type:
unsigned byte
- setMode(mode)[source]¶
Set the mode of the timer which is either single or repeat mode. aErrNone Action completed successfully.
- Parameters:
mode (const unsigned char) – The mode of the timer. aTIMER_MODE_REPEAT or aTIMER_MODE_SINGLE.
- Returns:
An error result from the list of defined error codes in brainstem.result
- Return type:
unsigned byte