Creating Timed Events
Currently there are two ways to generate timed events:
- Using the event API (event resolution about 5ms)
- Using the RTOS timer API (event resolution about 1ms)
For long running timers (minutes/hours/days) the Event API should be used.
Using the Event API
The event API timer events have the lowest resolution (~5ms) but are the most extensible.
By default the events execute in the App thread. The event can do a lot of work here as the App has a large stack. The resolution is limited by the number of events queued and time it takes for a given event to execute.
Optionally you can specify that the event execute in the Event thread. This thread has a much smaller stack and the events do much less which gives them a better resolution.
Using the RTOS timer API
RTOS timer API events have about a ~1ms resolution. The timer callbacks execute in the RTOS timer context and thus must be non-blocking.
See:
There is no hard limit to the number RTOS timers or timed/periodic events. The available heap space is the only real limit.
Events with Finer Resolution
For events with a resolution less than 1ms resolution please lodge a support ticket . We can consider implementing a hardware timer API. Note that a Gecko OS app is native C so you have complete access to reading/writing any MCU register.