Skip to content

DS_CAP_TIMERS

Denis Stepanov edited this page Apr 25, 2021 · 15 revisions

DS_CAP_TIMERS — Timer Support

Description

This capability add support for timers, used to execute certain actions in future. The way to define future event is determined by timer type. Grossly, there are two ways of designating future time: absolute (when system has notion of system time and can be programmed for a future timestamp) and relative (when system does not have notion of time but can be programmed for some time in future using some time counting technique relative to the original time point). The library supports several timer types:

  • Absolute timer — fires at a given time in future
  • Solar timer — fires at sun-related event (sunrise or sunset)
  • Countdown timer — fires after some time period from now

For the countdown timer, two implementations are offered — one relying on absolute time, and another relying on relative time.

Timer actions are specified using a string called "action". When timer event fires, the library calls a user-defined callback function, which can check the timer "action" property in order to decide which code to execute.

This capability defines an abstract timer interface (ds::Timer class); in order to actually use a timer, user has to select one of the four timer implementations listed above.

Requires

None.

Cooperates With

None.

Conflicts With

None.

Usage

None. See the corresponding timer implementations.

Mandatory Calls

System::begin() Not required
System::update() Not required

Note that while this capability per se does not require System::begin() call, the underlying implementations, like absolute timer, would most likely need it to work correctly. Check their respective pages for details.

Examples

Bugs

None.

See Also