Struct avr_hal_generic::adc::Channel
source · pub struct Channel<H, ADC: AdcOps<H>> { /* private fields */ }
Expand description
Representation of any ADC Channel.
Typically, distinct types are used per channel, like for example Pin<mode::Analog, PC0>
. In
some situations, however, a type is needed which can represent any channel. This is required
to, for example, store multiple channels in an array.
Channel
is such a type. It can be created by calling the into_channel()
method of a distinct type:
let a0 = pins.a0.into_analog_input(&mut adc);
let a1 = pins.a1.into_analog_input(&mut adc);
let channels: [atmega_hal::adc::Channel; 2] = [
a0.into_channel(),
a1.into_channel(),
];
for ch in channels.iter() {
adc.read_blocking(ch);
}
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<H, ADC> Freeze for Channel<H, ADC>
impl<H, ADC> RefUnwindSafe for Channel<H, ADC>
impl<H, ADC> Send for Channel<H, ADC>
impl<H, ADC> Sync for Channel<H, ADC>
impl<H, ADC> Unpin for Channel<H, ADC>
impl<H, ADC> UnwindSafe for Channel<H, ADC>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more