Expand description
Analog-to-Digital Converter
This module provides an interface to the Analog-to-Digital Converter (ADC)
peripheral(s). Support is provided for single-ended, software triggered
conversions. Async functionality can be enabled via the async
feature.
let apb_adc0 = buses.apb.enable(tokens.apbs.adc0);
let (pclk_adc0, _gclk0) = Pclk::enable(tokens.pclks.adc0, clocks.gclk0);
let mut adc = AdcBuilder::new(Accumulation::single(AdcResolution::_12))
.with_clock_cycles_per_sample(5)
.with_clock_divider(Prescaler::Div32)
.with_vref(Reference::Arefa)
.enable(peripherals.adc0, apb_adc0, &pclk_adc0)
.unwrap();
let mut adc_pin = pins.a0.into_alternate();
let mut _buffer = [0; 16];
adc.read_buffer(&mut adc_pin, &mut _buffer).unwrap();
Modules§
Structs§
- Adc
- ADC Instance
- Adc0
- Wrapper around the ADC instance
- AdcBuilder
- ADC Configuration Builder
- Flags
- ADC interrupt flags
- Future
Adc - Interrupt
Handler - Interrupt handler for the ADC peripheral.
Enums§
- Accumulation
- Result accumulation strategy for the ADC
- AdcResolution
- Builder
Error - CpuVoltage
Source - Voltage source to use when using the ADC to measure the CPU voltage
- Error
- Errors that may occur when operating the ADC
- Prescaler
- Prescaler Configuration
- Reference
- Reference Selection
- Resolution
- Conversion Result Resolution
- Sample
Count - Number of Samples to be Collected
Statics§
Traits§
- AdcInstance
- Trait representing an ADC instance
- AdcPin
- Trait representing a GPIO pin which can be used as an input for an ADC
- Primary
Adc - Marker for which ADC has access to the CPUs internal sensors