Timer#
Interface for timers for sidewalk SDK.
Modules#
Functions#
Initialize a timer object.
De-initialize a timer object.
Arm a timer object.
Disarm a timer object.
Check a timer object is valid and armed.
Init the timer facility.
HW event callback.
Function Documentation#
sid_pal_timer_init#
sid_error_t sid_pal_timer_init (sid_pal_timer_t * timer, sid_pal_timer_cb_t event_callback, void * event_callback_arg)
Initialize a timer object.
Type | Direction | Argument Name | Description |
---|---|---|---|
sid_pal_timer_t * | [in] | timer | Timer object to initialize |
sid_pal_timer_cb_t | [in] | event_callback | Pointer to the callback function the timer event will be delivered to |
void * | [in] | event_callback_arg | Argument to be provided to the |
sid_pal_timer_deinit#
sid_error_t sid_pal_timer_deinit (sid_pal_timer_t * timer)
De-initialize a timer object.
Type | Direction | Argument Name | Description |
---|---|---|---|
sid_pal_timer_t * | [in] | timer | Timer object to de-initialize |
Function fully de-initializes the timer
object. If it is armed, it will be canceled and then de-initialized.
sid_pal_timer_arm#
sid_error_t sid_pal_timer_arm (sid_pal_timer_t * timer, sid_pal_timer_prio_class_t type, const struct sid_timespec * when, const struct sid_timespec * period)
Arm a timer object.
Type | Direction | Argument Name | Description |
---|---|---|---|
sid_pal_timer_t * | [in] | timer | Timer object to arm |
sid_pal_timer_prio_class_t | [in] | type | Priority class specifier for the timer to be armed |
const struct sid_timespec * | [in] | when | Pointer to struct sid_timespec identifying the time for the first event generation |
const struct sid_timespec * | [in] | period | Pointer to struct sid_timespec identifying the period between event generation |
Function will initialize the timer
object for first shot at time provided in when
(required). If the period
is not NULL and is not TIMESPEC_INFINITY, the timer
object will be armed to repeat events generation periodically with the period according to the time provided in period
.
sid_pal_timer_cancel#
sid_error_t sid_pal_timer_cancel (sid_pal_timer_t * timer)
Disarm a timer object.
Type | Direction | Argument Name | Description |
---|---|---|---|
sid_pal_timer_t * | [in] | timer | Timer object to disarm |
Function will disarm the timer
object. If it is not armed, function does no operation.
sid_pal_timer_is_armed#
bool sid_pal_timer_is_armed (const sid_pal_timer_t * timer)
Check a timer object is valid and armed.
Type | Direction | Argument Name | Description |
---|---|---|---|
const sid_pal_timer_t * | [in] | timer | Timer object to check |
sid_pal_timer_facility_init#
sid_error_t sid_pal_timer_facility_init (void * arg)
Init the timer facility.
Type | Direction | Argument Name | Description |
---|---|---|---|
void * | [in] | arg | Pointer to implementation-specific arguments, can be NULL if not used. |
This function must be called before before sid_pal_timer_init().
OPTIONAL This function is typically used to init HW or SW resources needed for the timer. If none are needed by the timer implementation then this function is unnecessary.
sid_pal_timer_event_callback#
void sid_pal_timer_event_callback (void * arg, const struct sid_timespec * now)
HW event callback.
Type | Direction | Argument Name | Description |
---|---|---|---|
void * | [in] | arg | Pointer to implementation-specific arguments, can be NULL if not used. |
const struct sid_timespec * | [in] | now | Pointer to the current time when the event occurred. |
OPTIONAL If sid_timer is implemented as a SW timer, this is the callback that can be registered with the HW resource to provide noritification of HW timer expiry.