Struct stm32f412g::adc::Adc

source ·
pub struct Adc<'a> { /* private fields */ }

Implementations§

source§

impl<'a> Adc<'a>

source

pub const fn new(clocks: &'a dyn Stm32f4Clocks) -> Adc<'a>

source

pub fn enable(&self)

source

pub fn handle_interrupt(&self)

source

pub fn is_enabled_clock(&self) -> bool

source

pub fn enable_clock(&self)

source

pub fn disable_clock(&self)

source

pub fn enable_temperature(&self)

Trait Implementations§

source§

impl<'a> Adc<'a> for Adc<'a>

§

type Channel = Channel

The chip-dependent type of an ADC channel.
source§

fn sample( &self, channel: &<Adc<'a> as Adc<'a>>::Channel, ) -> Result<(), ErrorCode>

Request a single ADC sample on a particular channel. Used for individual samples that have no timing requirements. All ADC samples will be the raw ADC value left-justified in the u16.
source§

fn sample_continuous( &self, _channel: &<Adc<'a> as Adc<'a>>::Channel, _frequency: u32, ) -> Result<(), ErrorCode>

Request repeated ADC samples on a particular channel. Callbacks will occur at the given frequency with low jitter and can be set to any frequency supported by the chip implementation. However callbacks may be limited based on how quickly the system can service individual samples, leading to missed samples at high frequencies. All ADC samples will be the raw ADC value left-justified in the u16.
source§

fn stop_sampling(&self) -> Result<(), ErrorCode>

Stop a sampling operation. Can be used to stop any simple or high-speed sampling operation. No further callbacks will occur.
source§

fn get_resolution_bits(&self) -> usize

Function to ask the ADC how many bits of resolution are in the samples it is returning.
source§

fn get_voltage_reference_mv(&self) -> Option<usize>

Function to ask the ADC what reference voltage it used when taking the samples. This allows the user of this interface to calculate an actual voltage from the ADC reading. Read more
source§

fn set_client(&self, client: &'a dyn Client)

source§

impl<'a> AdcHighSpeed<'a> for Adc<'a>

Not yet supported

source§

fn sample_highspeed( &self, _channel: &<Adc<'a> as Adc<'a>>::Channel, _frequency: u32, buffer1: &'static mut [u16], _length1: usize, buffer2: &'static mut [u16], _length2: usize, ) -> Result<(), (ErrorCode, &'static mut [u16], &'static mut [u16])>

Capture buffered samples from the ADC continuously at a given frequency, calling the client whenever a buffer fills up. The client is then expected to either stop sampling or provide an additional buffer to sample into. Note that due to hardware constraints the maximum frequency range of the ADC is from 187 kHz to 23 Hz (although its precision is limited at higher frequencies due to aliasing).

  • channel: the ADC channel to sample
  • frequency: frequency to sample at
  • buffer1: first buffer to fill with samples
  • length1: number of samples to collect (up to buffer length)
  • buffer2: second buffer to fill once the first is full
  • length2: number of samples to collect (up to buffer length)
source§

fn provide_buffer( &self, buf: &'static mut [u16], _length: usize, ) -> Result<(), (ErrorCode, &'static mut [u16])>

Provide a new buffer to send on-going buffered continuous samples to. This is expected to be called after the samples_ready callback.

  • buf: buffer to fill with samples
  • length: number of samples to collect (up to buffer length)
source§

fn retrieve_buffers( &self, ) -> Result<(Option<&'static mut [u16]>, Option<&'static mut [u16]>), ErrorCode>

Reclaim buffers after the ADC is stopped. This is expected to be called after stop_sampling.

source§

fn set_highspeed_client(&self, _client: &'a dyn HighSpeedClient)

Auto Trait Implementations§

§

impl<'a> !Freeze for Adc<'a>

§

impl<'a> !RefUnwindSafe for Adc<'a>

§

impl<'a> !Send for Adc<'a>

§

impl<'a> !Sync for Adc<'a>

§

impl<'a> Unpin for Adc<'a>

§

impl<'a> !UnwindSafe for Adc<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.