Module esp32s3_hal::adc
source · Expand description
Analog to digital (ADC) conversion support.
Overview
The ADC
module in the analog
driver enables users to perform
analog-to-digital conversions, allowing them to measure real-world
analog signals with high accuracy.
This module provides functions for reading analog values from the
analog to digital converter available on the ESP32-S3: ADC1
and
ADC2
.
Example
ADC on Xtensa architecture
// Create ADC instances
let analog = peripherals.SENS.split();
let mut adc1_config = AdcConfig::new();
let mut pin3 =
adc1_config.enable_pin(io.pins.gpio3.into_analog(), Attenuation::Attenuation11dB);
let mut adc1 = ADC::<ADC1>::adc(analog.adc1, adc1_config).unwrap();
let mut delay = Delay::new(&clocks);
loop {
let pin3_value: u16 = nb::block!(adc1.read(&mut pin3)).unwrap();
println!("PIN3 ADC reading = {}", pin3_value);
delay.delay_ms(1500u32);
}
Structs
- Basic ADC calibration scheme
- Curve fitting ADC calibration scheme
- Line fitting ADC calibration scheme
Enums
- The attenuation of the ADC pin
- The sampling/readout resolution of the ADC
Traits
- A helper trait to get access to ADC calibration efuses
- A helper trait to do calibrated samples fitting
- Marker trait for ADC which support curve fitting
- Marker trait for ADC units which support line fitting