Module imxrt_hal::adc

source ·
Expand description

Analog to digital converters.

This ADC driver supports the 0.2 embedded_hal’s ADC traits. To enable the traits, activate this package’s `“eh02-unproven” feature.

Example

use imxrt_hal as hal;
use imxrt_ral as ral;
use hal::adc;

let mut pads = // Handle to all processor pads

let adc1 = unsafe { ral::adc::ADC1::instance() };
let mut adc1 = adc::Adc::new(adc1, adc::ClockSelect::ADACK, adc::ClockDivision::Div2);
let mut a1 = adc::AnalogInput::new(pads.gpio_ad_b1.p02);

let reading: u16 = adc1.read_blocking(&mut a1);

// Read without constructing an analog pin:
let adc2 = unsafe { ral::adc::ADC2::instance() };
let mut adc2 = adc::Adc::new(adc2, adc::ClockSelect::ADACK, adc::ClockDivision::Div2);

let reading = adc2.read_blocking_channel(7);

Structs

  • The ADC driver.
  • A pin representing an analog input for a particular ADC
  • Adapter for using an ADC input as a DMA source.

Enums