Module imxrt_hal::adc [−][src]
ADC
This ADC driver supports embedded_hal
’s ADC traits
Example
use imxrt_hal::{self, adc}; use embedded_hal::adc::OneShot; let mut peripherals = imxrt_hal::Peripherals::take().unwrap(); let (adc1_builder, _) = peripherals.adc.clock(&mut peripherals.ccm.handle); let mut adc1 = adc1_builder.build(adc::ClockSelect::default(), adc::ClockDivision::default()); let mut a1 = adc::AnalogInput::new(peripherals.iomuxc.ad_b1.p02); let reading: u16 = adc1.read(&mut a1).unwrap();
The ADC starts out with a default configuration of 4 hardware samples, a conversion speed of medium, a resolution of 10 bits, and low power mode disabled. It’s also pre-calibrated using 32 averages and a slow conversion speed.
Structs
ADC | |
AdcSource | Streaming DMA source for ADCs |
AnalogInput | A pin representing an analog input for a particular ADC |
Builder | An ADC builder than can build an ADC1 or ADC2 module |
Unclocked | Unclocked ADC modules |
Enums
AveragingCount | Denotes how much hardware averaging to do |
ClockDivision | How much to divide the clock input |
ClockSelect | The clock input for an ADC |
ConversionSpeed | Conversion speeds done by clock cycles |
ResolutionBits |