1 #ifndef RUUVI_INTERFACE_ADC_MCU_H
2 #define RUUVI_INTERFACE_ADC_MCU_H
23 # define RUUVI_NRF5_SDK15_ADC_ENABLED RUUVI_NRF5_SDK15_ENABLED
53 #ifdef RI_ADC_ADV_MODE_CONFIG
54 RI_ADC_MODE_DIFFERENTIAL
81 #ifdef RI_ADC_ADV_CONFIG
85 RI_ADC_RESISTOR_DISABLED,
86 RI_ADC_RESISTOR_PULLDOWN,
87 RI_ADC_RESISTOR_PULLUP,
88 RI_ADC_RESISTOR_VDD1_2,
120 #ifdef RI_ADC_ADV_CONFIG
121 nri_adc_resistor_t resistor;
129 #ifdef RI_ADC_ADV_MODE_CONFIG
140 #ifdef RI_ADC_ADV_CONFIG
141 ri_adc_acqtime_t acqtime;
uint32_t rd_status_t
bitfield for representing errors
Ruuvi error codes and error check function.
Ruuvi sensor interface Lifecycle: Beta
rd_status_t ri_adc_uninit(bool config_default)
Uninitialize ADC.
rd_status_t ri_adc_get_raw_data(uint8_t channel_num, int16_t *p_data)
Get raw ADC data.
@ RI_ADC_MODE_SINGLE
Single ended mode.
@ RI_ADC_VREF_EXTERNAL
External voltage reference.
@ RI_ADC_VREF_INTERNAL
Internal voltage reference.
rd_status_t ri_adc_get_data_ratio(uint8_t channel_num, ri_adc_get_data_t *p_config, float *p_data)
Get ADC data in volts.
@ RI_ADC_RESOLUTION_14BIT
@ RI_ADC_RESOLUTION_10BIT
@ RI_ADC_RESOLUTION_12BIT
rd_status_t ri_adc_get_data_absolute(uint8_t channel_num, ri_adc_get_data_t *p_config, float *p_data)
Get ADC data in volts.
ri_adc_channel_t
Enable implementation selected by application.
@ RI_ADC_CH_NUM
Number of ADC inputs.
@ RI_ADC_AIN4
Channel 4 of ADC.
@ RI_ADC_AIN6
Channel 6 of ADC.
@ RI_ADC_AIN0
Channel 0 of ADC.
@ RI_ADC_AIN1
Channel 1 of ADC.
@ RI_ADC_AIN3
Channel 3 of ADC.
@ RI_ADC_AINVDD
Analog supply voltage.
@ RI_ADC_AIN2
Channel 2 of ADC.
@ RI_ADC_AIN5
Channel 5 of ADC.
@ RI_ADC_AIN7
Channel 7 of ADC.
@ RI_ADC_GND
GND of device.
bool ri_adc_mcu_is_valid_ch(const uint8_t ch)
Return true if given channel index can be used by underlying implementation.
@ RI_ADC_OVERSAMPLE_DISABLED
rd_status_t ri_adc_stop(uint8_t channel_num)
Stop use ADC channel.
rd_status_t ri_adc_configure(uint8_t channel_num, ri_adc_pins_config_t *p_pins, ri_adc_channel_config_t *p_config)
Configure ADC channel.
rd_status_t ri_adc_init(ri_adc_config_t *p_config)
Initialization of ADC.
bool ri_adc_is_init(void)
Check if ADC is initialized.
ri_adc_oversample_t oversample
ri_adc_resolution_t resolution
ri_adc_pin_config_t p_pin