esp_adc_cal_get_voltage() function
Reads an ADC and converts the reading to a voltage in mV This function reads an ADC then converts the raw reading to a voltage in mV based on the characteristics provided. The ADC that is read is also determined by the characteristics.
Arguments
channel
ADC Channel to read
chars
Pointer to initialized ADC characteristics structure
voltage
Pointer to store converted voltage
Return value
- ESP_OK: ADC read and converted to mV - ESP_ERR_INVALID_ARG: Error due to invalid arguments - ESP_ERR_INVALID_STATE: Reading result is invalid. Try to read again.
Notes
The Characteristics structure must be initialized before this function is called (call esp_adc_cal_characterize())
esp_adc_cal_get_voltage() calls 5 functions:
![]()
esp_adc_cal_get_voltage()
esp_adc_cal_get_voltage() reads 9 variables:
![]()
esp_adc_cal_get_voltage()