pub struct Adc<'a, M: Mode> { /* private fields */ }Expand description
ADC driver instance.
Implementations§
Source§impl<'a> Adc<'a, Async>
impl<'a> Adc<'a, Async>
Sourcepub fn new_async<T: Instance>(
_inst: Peri<'a, T>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'a,
commands: &'a [Command<'a, T>],
triggers: &[Trigger],
config: Config,
) -> Result<Self, Error>
pub fn new_async<T: Instance>( _inst: Peri<'a, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'a, commands: &'a [Command<'a, T>], triggers: &[Trigger], config: Config, ) -> Result<Self, Error>
Create a new async instance of the ADC
Sourcepub async fn wait_get_conversion(&mut self) -> Option<Conversion>
pub async fn wait_get_conversion(&mut self) -> Option<Conversion>
Reads the current conversion result from the fifo or waits for the next one if it’s pending.
If no conversion is pending, None is returned.
Sourcepub async fn wait_conversion(&mut self) -> Conversion
pub async fn wait_conversion(&mut self) -> Conversion
Reads the current conversion result from the fifo or waits for the next one even if no conversion is currently pending.
If no conversion is pending, None is returned.
Source§impl<'a, M: Mode> Adc<'a, M>
impl<'a, M: Mode> Adc<'a, M>
Sourcepub fn do_software_trigger(&mut self, trigger_id_mask: u8) -> Result<(), Error>
pub fn do_software_trigger(&mut self, trigger_id_mask: u8) -> Result<(), Error>
Trigger ADC conversion(s) via software.
Initiates conversion(s) for the trigger(s) specified in the bitmask. Each bit in the mask corresponds to a trigger ID (bit 0 = trigger 0, etc.).
§Arguments
trigger_id_mask- Bitmask of trigger IDs to activate (bit N = trigger N)
§Returns
Ok(())if the triger mask was valid- Error::NoTrigger if the mask is calling a trigger that’s not configured
Sourcepub fn do_reset_fifo(&mut self)
pub fn do_reset_fifo(&mut self)
Reset the FIFO buffer.
Clears all pending conversion results from the FIFO.
Sourcepub fn try_get_conversion(&mut self) -> Result<Conversion, Error>
pub fn try_get_conversion(&mut self) -> Result<Conversion, Error>
Get conversion result from FIFO.
Returns:
Ok(ConvResult)if a result is available- Error::FifoEmpty if the FIFO is empty
- Error::FifoPending if the FIFO is empty, but the adc is active
Sourcepub fn do_offset_calibration(&mut self)
pub fn do_offset_calibration(&mut self)
Perform offset calibration. Waits for calibration to complete before returning.
Sourcepub fn do_auto_calibration(&mut self)
pub fn do_auto_calibration(&mut self)
Perform automatic gain calibration.