Module imxrt_hal::adc[][src]

Expand description

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

Streaming DMA source for ADCs

A pin representing an analog input for a particular ADC

An ADC builder than can build an ADC1 or ADC2 module

Unclocked ADC modules

Enums

Denotes how much hardware averaging to do

How much to divide the clock input

The clock input for an ADC

Conversion speeds done by clock cycles