Module atmega_hal::adc
source · Expand description
Analog-to-Digital Converter
§Example
Complete example source code can be found in the repository:
atmega2560-adc.rs
let dp = atmega_hal::Peripherals::take().unwrap();
let pins = atmega_hal::pins!(dp);
let mut adc = Adc::new(dp.ADC, Default::default());
let channels: [atmega_hal::adc::Channel; 4] = [
pins.pf0.into_analog_input(&mut adc).into_channel(),
pins.pf1.into_analog_input(&mut adc).into_channel(),
pins.pf2.into_analog_input(&mut adc).into_channel(),
pins.pf3.into_analog_input(&mut adc).into_channel(),
];
for (index, channel) in channels.iter().enumerate() {
let value = adc.read_blocking(channel);
ufmt::uwrite!(&mut serial, "CH{}: {} ", index, value).unwrap();
}
Modules§
- Additional channels
Structs§
- Configuration for the ADC peripheral.
Enums§
- The division factor between the system clock frequency and the input clock to the AD converter.
- Select the voltage reference for the ADC peripheral
Traits§
- Trait marking a type as an ADC channel for a certain ADC.
- Internal trait for the low-level ADC peripheral.
Type Aliases§
- Check the
avr_hal_generic::adc::Adc
documentation. - Check the
avr_hal_generic::adc::Channel
documentation.