Wirepas SDK
hw_delay.h File Reference

Go to the source code of this file.

Typedefs

typedef uint32_t(* hw_delay_callback_f) (void)
 Callback to be registered, and called after timer expire. More...
 

Functions

hw_delay_res_e hw_delay_init (void)
 Initialize Hardware Delay Module. More...
 
hw_delay_res_e hw_delay_trigger_us (hw_delay_callback_f callback, uint32_t time_us)
 Setup timer trigger. More...
 
hw_delay_res_e hw_delay_cancel (void)
 Cancel Hardware delay. More...
 

Enumerations

enum  hw_delay_res_e {
  HW_DELAY_OK, HW_DELAY_PARAM_ERR, HW_DELAY_NOT_STARTED, HW_DELAY_NOT_TRIGGERED,
  HW_DELAY_ERR
}
 

Typedef Documentation

◆ hw_delay_callback_f

typedef uint32_t(* hw_delay_callback_f) (void)

Callback to be registered, and called after timer expire.

Returns
Delay before being executed again in us
Note
If it returns 0 or a value greater than 511s, it will not be executed again. Granularity is ~30us, and it cannot be called again before 90us Any value less than 90us will be round-up to 90us

Definition at line 33 of file hw_delay.h.

Function Documentation

◆ hw_delay_cancel()

hw_delay_res_e hw_delay_cancel ( void  )

Cancel Hardware delay.

Returns
HW_DELAY_OK if stopped HW_DELAY_NOT_TRIGGERED if no trigger configured HW_DELAY_ERR if not initialized

◆ hw_delay_init()

hw_delay_res_e hw_delay_init ( void  )

Initialize Hardware Delay Module.

Returns
HW_DELAY_OK if successfully initialized HW_DELAY_ERR if already initialized

◆ hw_delay_trigger_us()

hw_delay_res_e hw_delay_trigger_us ( hw_delay_callback_f  callback,
uint32_t  time_us 
)

Setup timer trigger.

Parameters
callbackCallback to be called when delay will expire
time_usCallback set by hw_delay_register will be called in time_us us Granularity is ~30us, and it cannot be called again before 90us Any value less than 90us will be round-up to 90us
Returns
HW_DELAY_OK is timer is set HW_DELAY_ERR is module is not initialized HW_DELAY_PARAM_ERR is delay is more than 511s, or callback is NULL

Enumeration Type Documentation

◆ hw_delay_res_e

Return codes of hardware delay functions

Enumerator
HW_DELAY_OK 
HW_DELAY_PARAM_ERR 
HW_DELAY_NOT_STARTED 
HW_DELAY_NOT_TRIGGERED 
HW_DELAY_ERR 

Definition at line 16 of file hw_delay.h.

HW_DELAY_NOT_STARTED
@ HW_DELAY_NOT_STARTED
Definition: hw_delay.h:19
HW_DELAY_NOT_TRIGGERED
@ HW_DELAY_NOT_TRIGGERED
Definition: hw_delay.h:20
hw_delay_res_e
hw_delay_res_e
Definition: hw_delay.h:16
HW_DELAY_ERR
@ HW_DELAY_ERR
Definition: hw_delay.h:21
HW_DELAY_OK
@ HW_DELAY_OK
Definition: hw_delay.h:17
HW_DELAY_PARAM_ERR
@ HW_DELAY_PARAM_ERR
Definition: hw_delay.h:18