ruuvi.drivers.c
${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
|
Go to the source code of this file.
Enumerations | |
enum | rt_adc_mode_t { RATIOMETRIC , ABSOLUTE } |
Functions | |
rd_status_t | rt_adc_init (void) |
Reserve ADC. More... | |
rd_status_t | rt_adc_uninit (void) |
Uninitialize ADC to release it for other users. More... | |
bool | rt_adc_is_init (void) |
Check if ADC is initialized. More... | |
rd_status_t | rt_adc_configure_se (rd_sensor_configuration_t *const config, const uint8_t handle, const rt_adc_mode_t mode) |
Configure ADC before sampling. More... | |
rd_status_t | rt_adc_sample (void) |
Take a new sample on ADC configured in single-shot/sleep mode. More... | |
rd_status_t | rt_adc_voltage_get (rd_sensor_data_t *const data) |
Populate data with latest sample. More... | |
rd_status_t | rt_adc_ratio_get (rd_sensor_data_t *const data) |
Populate data with latest ratiometric value. More... | |
rd_status_t | rt_adc_vdd_prepare (rd_sensor_configuration_t *const vdd_adc_configuration) |
Prepare for sampling VDD. More... | |
rd_status_t | rt_adc_vdd_sample (void) |
Sample VDD. More... | |
rd_status_t | rt_adc_vdd_get (float *const vdd) |
Get VDD. More... | |
rd_status_t | rt_adc_absolute_sample (rd_sensor_configuration_t *const configuration, const uint8_t handle, float *const sample) |
Get absolute Voltage Sample from selected ADC handle. More... | |
rd_status_t | rt_adc_ratiometric_sample (rd_sensor_configuration_t *const configuration, const uint8_t handle, float *const sample) |
Get ratiometric VDD Sample from selected ADC handle. More... | |
Read ADC. Important: The ADC peripheral is shared by many different functions onboard, so always uninitialize the ADC after use to let others use the peripheral. Likewise important: The ADC might be in use while you need it, so always check the return code from init and do no block if you can't get ADC lock.
ADC lock must be atomic, and it requires the ri_atomic implementation.
Typical usage:
Definition in file ruuvi_task_adc.h.