ruuvi.drivers.c
${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
|
Go to the source code of this file.
Typedefs | |
typedef void(* | ri_yield_state_ind_fp_t) (const bool active) |
Enable implementation selected by application. More... | |
Functions | |
void | ri_yield_indication_set (const ri_yield_state_ind_fp_t indication) |
rd_status_t | ri_yield_init (void) |
Initializes yielding functions. More... | |
rd_status_t | ri_yield_uninit (void) |
Uninitializes yielding functions. More... | |
rd_status_t | ri_yield_low_power_enable (const bool enable) |
Initializes yielding functions. More... | |
rd_status_t | ri_yield (void) |
Function which will release execution. More... | |
rd_status_t | ri_delay_ms (uint32_t time) |
Delay a given number of milliseconds. More... | |
rd_status_t | ri_delay_us (uint32_t time) |
Delay a given number of microseconds. More... | |
bool | ri_yield_is_interrupt_context (void) |
Check if current execution is in interrupt context. More... | |
Interface for yielding execution or delaying for a given time. Underlying implememntation may enter low-power mode or block the execution during delay.
Definition in file ruuvi_interface_yield.h.
typedef void(* ri_yield_state_ind_fp_t) (const bool active) |
Enable implementation selected by application.
Function which gets called when entering / exiting sleep, configured by application.
[in] | active | true if device is going to be active, false otherwise. |
Definition at line 35 of file ruuvi_interface_yield.h.
rd_status_t ri_delay_ms | ( | uint32_t | time | ) |
Delay a given number of milliseconds.
This function is meant for rough timing and is not quaranteed to be exact in any manner If you need exact timing use timers or for example PWM peripheral. This function is affected by low-power delay enable, which uses sleep mode and timer to return out of sleep.
time | number of milliseconds to delay. |
rd_status_t ri_delay_us | ( | uint32_t | time | ) |
Delay a given number of microseconds.
This function is meant for rough timing and is not quaranteed to be exact in any manner If you need exact timing use timers or for example PWM peripheral. This function does not use low-power mode to maintain better precision on timing.
time | number of microseconds to delay. |
rd_status_t ri_yield | ( | void | ) |
Function which will release execution.
The program execution will not continue until some external event continues the program.
void ri_yield_indication_set | ( | const ri_yield_state_ind_fp_t | indication | ) |
Configure sleep indication function.
[in] | indication | function to call when entering/exiting sleep, NULL to disable |
rd_status_t ri_yield_init | ( | void | ) |
Initializes yielding functions.
Initializes necessary data stuctures and peripherals (if any) for yielding. May for example allocate a timer to wake the device up after delay is over.
bool ri_yield_is_interrupt_context | ( | void | ) |
Check if current execution is in interrupt context.
This function reads Interrupt Control and State Register (ICSR) to determine the interrupt status. The register is masked with VECTACTIVE mask.
rd_status_t ri_yield_low_power_enable | ( | const bool | enable | ) |
Initializes yielding functions.
Enables using timer + RTC to shutdown the device for millisecond-sleeps.
[in] | enable | true to enable low-power mode, false to disable. |
rd_status_t ri_yield_uninit | ( | void | ) |
Uninitializes yielding functions.
Clears state from previous initializations. This should be called before uninitializing timers if timer-based low-power delay is in use.