pub struct Adc<'d, M: Mode> { /* private fields */ }
Expand description
ADC driver.
Implementations§
Source§impl<'d> Adc<'d, Async>
impl<'d> Adc<'d, Async>
Sourcepub fn new(
_inner: impl Peripheral<P = ADC> + 'd,
_irq: impl Binding<ADC_IRQ_FIFO, InterruptHandler>,
_config: Config,
) -> Self
pub fn new( _inner: impl Peripheral<P = ADC> + 'd, _irq: impl Binding<ADC_IRQ_FIFO, InterruptHandler>, _config: Config, ) -> Self
Create ADC driver in async mode.
Sourcepub async fn read(&mut self, ch: &mut Channel<'_>) -> Result<u16, Error>
pub async fn read(&mut self, ch: &mut Channel<'_>) -> Result<u16, Error>
Sample a value from a channel until completed.
Sourcepub async fn read_many_multichannel<S: AdcSample>(
&mut self,
ch: &mut [Channel<'_>],
buf: &mut [S],
div: u16,
dma: impl Peripheral<P = impl Channel>,
) -> Result<(), Error>
pub async fn read_many_multichannel<S: AdcSample>( &mut self, ch: &mut [Channel<'_>], buf: &mut [S], div: u16, dma: impl Peripheral<P = impl Channel>, ) -> Result<(), Error>
Sample multiple values from multiple channels using DMA.
Samples are stored in an interleaved fashion inside the buffer.
div
is the integer part of the clock divider and can be calculated with floor(48MHz / sample_rate * num_channels - 1)
Any div
value of less than 96 will have the same effect as setting it to 0
Sourcepub async fn read_many_multichannel_raw(
&mut self,
ch: &mut [Channel<'_>],
buf: &mut [Sample],
div: u16,
dma: impl Peripheral<P = impl Channel>,
)
pub async fn read_many_multichannel_raw( &mut self, ch: &mut [Channel<'_>], buf: &mut [Sample], div: u16, dma: impl Peripheral<P = impl Channel>, )
Sample multiple values from multiple channels using DMA, with errors inlined in samples.
Samples are stored in an interleaved fashion inside the buffer.
div
is the integer part of the clock divider and can be calculated with floor(48MHz / sample_rate * num_channels - 1)
Any div
value of less than 96 will have the same effect as setting it to 0
Sourcepub async fn read_many<S: AdcSample>(
&mut self,
ch: &mut Channel<'_>,
buf: &mut [S],
div: u16,
dma: impl Peripheral<P = impl Channel>,
) -> Result<(), Error>
pub async fn read_many<S: AdcSample>( &mut self, ch: &mut Channel<'_>, buf: &mut [S], div: u16, dma: impl Peripheral<P = impl Channel>, ) -> Result<(), Error>
Sample multiple values from a channel using DMA.
div
is the integer part of the clock divider and can be calculated with floor(48MHz / sample_rate - 1)
Any div
value of less than 96 will have the same effect as setting it to 0
Sourcepub async fn read_many_raw(
&mut self,
ch: &mut Channel<'_>,
buf: &mut [Sample],
div: u16,
dma: impl Peripheral<P = impl Channel>,
)
pub async fn read_many_raw( &mut self, ch: &mut Channel<'_>, buf: &mut [Sample], div: u16, dma: impl Peripheral<P = impl Channel>, )
Sample multiple values from a channel using DMA, with errors inlined in samples.
div
is the integer part of the clock divider and can be calculated with floor(48MHz / sample_rate - 1)
Any div
value of less than 96 will have the same effect as setting it to 0
Source§impl<'d> Adc<'d, Blocking>
impl<'d> Adc<'d, Blocking>
Sourcepub fn new_blocking(
_inner: impl Peripheral<P = ADC> + 'd,
_config: Config,
) -> Self
pub fn new_blocking( _inner: impl Peripheral<P = ADC> + 'd, _config: Config, ) -> Self
Create ADC driver in blocking mode.