Struct stm32l0xx_hal::adc::Adc
source · [−]pub struct Adc<State> { /* private fields */ }
Expand description
Analog to Digital converter interface
Implementations
sourceimpl Adc<Ready>
impl Adc<Ready>
pub fn new(adc: ADC, rcc: &mut Rcc) -> Self
sourcepub fn set_sample_time(&mut self, t_samp: SampleTime)
pub fn set_sample_time(&mut self, t_samp: SampleTime)
Set the Adc sampling time
sourcepub fn set_precision(&mut self, precision: Precision)
pub fn set_precision(&mut self, precision: Precision)
Set the Adc precision
sourcepub fn start<DmaChan, Buf>(
self,
channels: impl Into<Channels>,
trigger: Option<Trigger>,
dma: &mut Handle,
dma_chan: DmaChan,
buffer: Pin<Buf>
) -> Adc<Active<DmaChan, Buf>> where
DmaToken: Target<DmaChan>,
Buf: DerefMut + 'static,
Buf::Target: AsMutSlice<Element = u16>,
DmaChan: Channel,
pub fn start<DmaChan, Buf>(
self,
channels: impl Into<Channels>,
trigger: Option<Trigger>,
dma: &mut Handle,
dma_chan: DmaChan,
buffer: Pin<Buf>
) -> Adc<Active<DmaChan, Buf>> where
DmaToken: Target<DmaChan>,
Buf: DerefMut + 'static,
Buf::Target: AsMutSlice<Element = u16>,
DmaChan: Channel,
Starts a continuous conversion process
The channel
argument specifies which channel should be converted.
The trigger
argument specifies the trigger that will start each
conversion sequence. This only configures the ADC peripheral to accept
this trigger. The trigger itself must also be configured using its own
peripheral API.
In addition to the preceeding arguments that configure the ADC, additional arguments are required to configure the DMA transfer that is used to read the results from the ADC:
dma
is a handle to the DMA peripheral.dma_chan
is the DMA channel used for the transfer. It needs to be one of the channels that supports the ADC peripheral.buffer
is the buffer used to buffer the conversion results.
Panics
Panics, if buffer
is larger than 65535.
Trait Implementations
Auto Trait Implementations
impl<State> RefUnwindSafe for Adc<State> where
State: RefUnwindSafe,
impl<State> Send for Adc<State> where
State: Send,
impl<State> !Sync for Adc<State>
impl<State> Unpin for Adc<State> where
State: Unpin,
impl<State> UnwindSafe for Adc<State> where
State: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more