Firmware SDK
|
Driver for ADC (analog to digital converter) More...
Enumerations | |
enum | twr_adc_channel_t { TWR_ADC_CHANNEL_A0 = 0 , TWR_ADC_CHANNEL_A1 = 1 , TWR_ADC_CHANNEL_A2 = 2 , TWR_ADC_CHANNEL_A3 = 3 , TWR_ADC_CHANNEL_A4 = 4 , TWR_ADC_CHANNEL_A5 = 5 , TWR_ADC_CHANNEL_A6 = 6 } |
ADC channel. More... | |
enum | twr_adc_oversampling_t { TWR_ADC_OVERSAMPLING_NONE = 0 , TWR_ADC_OVERSAMPLING_2 = 1 , TWR_ADC_OVERSAMPLING_4 = 2 , TWR_ADC_OVERSAMPLING_8 = 3 , TWR_ADC_OVERSAMPLING_16 = 4 , TWR_ADC_OVERSAMPLING_32 = 5 , TWR_ADC_OVERSAMPLING_64 = 6 , TWR_ADC_OVERSAMPLING_128 = 7 , TWR_ADC_OVERSAMPLING_256 = 8 } |
ADC oversampling. More... | |
enum | twr_adc_resolution_t { TWR_ADC_RESOLUTION_12_BIT = 0 , TWR_ADC_RESOLUTION_10_BIT = ADC_CFGR1_RES_0 , TWR_ADC_RESOLUTION_8_BIT = ADC_CFGR1_RES_1 , TWR_ADC_RESOLUTION_6_BIT = ADC_CFGR1_RES_1 | ADC_CFGR1_RES_0 } |
ADC resolution. More... | |
enum | twr_adc_event_t { TWR_ADC_EVENT_DONE } |
ADC event. More... | |
Functions | |
void | twr_adc_init () |
Initialize ADC converter. | |
bool | twr_adc_is_ready () |
Check if ADC is ready for reading. More... | |
bool | twr_adc_get_value (twr_adc_channel_t channel, uint16_t *result) |
Reads the ADC channel value. More... | |
bool | twr_adc_set_event_handler (twr_adc_channel_t channel, void(*event_handler)(twr_adc_channel_t, twr_adc_event_t, void *), void *event_param) |
Set callback function. More... | |
bool | twr_adc_async_measure (twr_adc_channel_t channel) |
Begins reading the ADC channel voltage in asynchronous mode. More... | |
bool | twr_adc_async_get_value (twr_adc_channel_t channel, uint16_t *result) |
Get asynchronous measurement result. More... | |
bool | twr_adc_async_get_voltage (twr_adc_channel_t channel, float *result) |
Get asynchronous measurement result in volts. More... | |
bool | twr_adc_get_vdda_voltage (float *vdda_voltage) |
Get voltage on VDDA pin. More... | |
bool | twr_adc_calibration (void) |
Calibration. More... | |
void | twr_adc_resolution_set (twr_adc_channel_t channel, twr_adc_resolution_t resolution) |
Set ADC resolution for specific channel. More... | |
void | twr_adc_oversampling_set (twr_adc_channel_t channel, twr_adc_oversampling_t oversampling) |
Set ADC oversampling for specific channel. More... | |
Driver for ADC (analog to digital converter)
enum twr_adc_channel_t |
enum twr_adc_event_t |
ADC oversampling.
enum twr_adc_resolution_t |
bool twr_adc_async_get_value | ( | twr_adc_channel_t | channel, |
uint16_t * | result | ||
) |
bool twr_adc_async_get_voltage | ( | twr_adc_channel_t | channel, |
float * | result | ||
) |
bool twr_adc_async_measure | ( | twr_adc_channel_t | channel | ) |
bool twr_adc_calibration | ( | void | ) |
Calibration.
Definition at line 343 of file twr_adc.c.
Referenced by twr_adc_init().
bool twr_adc_get_value | ( | twr_adc_channel_t | channel, |
uint16_t * | result | ||
) |
bool twr_adc_get_vdda_voltage | ( | float * | vdda_voltage | ) |
bool twr_adc_is_ready | ( | ) |
void twr_adc_oversampling_set | ( | twr_adc_channel_t | channel, |
twr_adc_oversampling_t | oversampling | ||
) |
void twr_adc_resolution_set | ( | twr_adc_channel_t | channel, |
twr_adc_resolution_t | resolution | ||
) |
bool twr_adc_set_event_handler | ( | twr_adc_channel_t | channel, |
void(*)(twr_adc_channel_t, twr_adc_event_t, void *) | event_handler, | ||
void * | event_param | ||
) |
Set callback function.
[in] | channel | ADC channel |
[in] | event_handler | Function address |
[in] | event_param | Optional event parameter (can be NULL) |
Definition at line 218 of file twr_adc.c.
Referenced by twr_analog_sensor_init().