Skip to main content

Module adc

Module adc 

Source
Expand description

12-bit analog-to-digital converter.

Single-channel conversions, software triggered: blocking through Adc::read, or started with Adc::start and collected with Adc::result on Event::Eoc. The ADC needs its own clock, which is not started by default — call ClockConfig::adc_sel before constructing an Adc.

ⓘ
let config = ClockConfig::default().adc_sel(AdcSel::Prescaled(AdcPsc::Apb2Div8));
let mut rcu = dp.rcu.constrain().freeze(&mut fmc, config);
let mut adc = dp.adc.constrain(&mut rcu);
let pin = parts.pa0.into_analog();
let raw = adc.read(&pin, SampTime::Cycles55_5);

Structs§

Adc
A calibrated ADC, ready to convert.

Enums§

Event
An ADC event that can raise an interrupt.
SampTime
How long the input is sampled before conversion, in CK_ADC cycles.

Traits§

AdcExt
Entry point on the raw peripheral.
Channel
Binds a pin to the ADC input number it is wired to.