[][src]Function esp_idf_bindgen::adc2_config_channel_atten

pub unsafe extern "C" fn adc2_config_channel_atten(
    channel: adc2_channel_t,
    atten: adc_atten_t
) -> esp_err_t

@brief Configure the ADC2 channel, including setting attenuation.

   The default ADC full-scale voltage is 1.1 V. To read higher voltages (up to the pin maximum voltage,
   usually 3.3 V) requires setting >0 dB signal attenuation for that ADC channel.

   When VDD_A is 3.3 V:

   - 0 dB attenuation (ADC_ATTEN_0db) gives full-scale voltage 1.1 V
   - 2.5 dB attenuation (ADC_ATTEN_2_5db) gives full-scale voltage 1.5 V
   - 6 dB attenuation (ADC_ATTEN_6db) gives full-scale voltage 2.2 V
   - 11 dB attenuation (ADC_ATTEN_11db) gives full-scale voltage 3.9 V (see note below)

@note This function also configures the input GPIO pin mux to connect it to the ADC2 channel. It must be called before calling adc2_get_raw() for this channel.

@note The full-scale voltage is the voltage corresponding to a maximum reading (depending on ADC2 configured bit width, this value of ESP32 is: 4095 for 12-bits, 2047 for 11-bits, 1023 for 10-bits, 511 for 9 bits. this value of ESP32S2 is: 8191 for 13-bits.)

@note At 11 dB attenuation the maximum voltage is limited by VDD_A, not the full scale voltage.

@param channel ADC2 channel to configure @param atten Attenuation level

@return - ESP_OK success - ESP_ERR_INVALID_ARG Parameter error