NimBLE-Arduino 2.1.2
|
Classes | |
struct | hal_timer |
Functions | |
int | hal_timer_init (int timer_num, void *cfg) |
int | hal_timer_deinit (int timer_num) |
int | hal_timer_config (int timer_num, uint32_t freq_hz) |
uint32_t | hal_timer_get_resolution (int timer_num) |
uint32_t | hal_timer_read (int timer_num) |
int | hal_timer_delay (int timer_num, uint32_t ticks) |
int | hal_timer_set_cb (int timer_num, struct hal_timer *tmr, hal_timer_cb cb_func, void *arg) |
int | hal_timer_start (struct hal_timer *tmr, uint32_t ticks) |
int | hal_timer_start_at (struct hal_timer *tmr, uint32_t tick) |
int | hal_timer_stop (struct hal_timer *tmr) |
int hal_timer_config | ( | int | timer_num, |
uint32_t | freq_hz | ||
) |
Config a HW timer at the given frequency and start it. If the exact frequency is not obtainable the closest obtainable frequency is set.
timer_num | The number of the HW timer to configure |
freq_hz | The frequency in Hz to configure the timer at |
hal timer config
Configure a timer to run at the desired frequency. This starts the timer.
timer_num | |
freq_hz |
int hal_timer_deinit | ( | int | timer_num | ) |
Un-initialize a HW timer.
timer_num | The number of the HW timer to un-initialize |
hal timer deinit
De-initialize a HW timer.
timer_num |
int hal_timer_delay | ( | int | timer_num, |
uint32_t | ticks | ||
) |
Perform a blocking delay for a number of ticks.
timer_num | The timer number to use for the blocking delay |
ticks | The number of ticks to delay for |
hal timer delay
Blocking delay for n ticks
timer_num | |
ticks |
uint32_t hal_timer_get_resolution | ( | int | timer_num | ) |
Returns the resolution of the HW timer. NOTE: the frequency may not be obtainable so the caller can use this to determine the resolution. Returns resolution in nanoseconds. A return value of 0 indicates an invalid timer was used.
timer_num | The number of the HW timer to get resolution for |
hal timer get resolution
Get the resolution of the timer. This is the timer period, in nanoseconds
timer_num |
int hal_timer_init | ( | int | timer_num, |
void * | cfg | ||
) |
Initialize a HW timer.
timer_num | The number of the HW timer to initialize |
cfg | Hardware specific timer configuration. This is passed from BSP directly to the MCU specific driver. |
hal timer irq handler
Generic HAL timer irq handler.
tmr | hal timer irq handler |
This is the global timer interrupt routine. hal timer init
Initialize platform specific timer items
timer_num | Timer number to initialize |
cfg | Pointer to platform specific configuration |
uint32_t hal_timer_read | ( | int | timer_num | ) |
Returns the HW timer current tick value
timer_num | The HW timer to read the tick value from |
hal timer read
Returns the timer counter. NOTE: if the timer is a 16-bit timer, only the lower 16 bits are valid. If the timer is a 64-bit timer, only the low 32-bits are returned.
int hal_timer_set_cb | ( | int | timer_num, |
struct hal_timer * | timer, | ||
hal_timer_cb | cb_func, | ||
void * | arg | ||
) |
Set the timer structure prior to use. Should not be called if the timer is running. Must be called at least once prior to using timer.
timer_num | The number of the HW timer to configure the callback on |
tmr | The timer structure to use for this timer |
cb_func | The timer callback to call when the timer fires |
arg | An opaque argument to provide the timer callback |
Initialize the HAL timer structure with the callback and the callback argument. Also initializes the HW specific timer pointer.
cb_func |
int hal_timer_start | ( | struct hal_timer * | tmr, |
uint32_t | ticks | ||
) |
Start a timer that will expire in 'ticks' ticks. Ticks cannot be 0
tmr | The timer to start |
ticks | The number of ticks to expire the timer in |
int hal_timer_start_at | ( | struct hal_timer * | tmr, |
uint32_t | tick | ||
) |
Start a timer that will expire when the timer reaches 'tick'. If tick has already passed the timer callback will be called "immediately" (at interrupt context).
tmr | The timer to start |
tick | The absolute tick value to fire the timer at |
int hal_timer_stop | ( | struct hal_timer * | timer | ) |
Stop a currently running timer; associated callback will NOT be called
tmr | The timer to stop |
hal timer stop
Stop a timer.
timer |