Function esp_idf_sys::adc1_get_raw
source · pub unsafe extern "C" fn adc1_get_raw(
channel: adc1_channel_t,
) -> c_int
Expand description
@brief Take an ADC1 reading from a single channel. @note ESP32: When the power switch of SARADC1, SARADC2, HALL sensor and AMP sensor is turned on, the input of GPIO36 and GPIO39 will be pulled down for about 80ns. When enabling power for any of these peripherals, ignore input from GPIO36 and GPIO39. Please refer to section 3.11 of ‘ECO_and_Workarounds_for_Bugs_in_ESP32’ for the description of this issue. As a workaround, call sar_periph_ctrl_adc_oneshot_power_acquire() in the app. This will result in higher power consumption (by ~1mA), but will remove the glitches on GPIO36 and GPIO39.
@note Call adc1_config_width()
before the first time this
function is called.
@note For any given channel, adc1_config_channel_atten(channel) must be called before the first time this function is called. Configuring a new channel does not prevent a previously configured channel from being read.
@param channel ADC1 channel to read
@return - -1: Parameter error - Other: ADC1 channel reading.