Struct nrf52832::adc::Adc

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

Implementations§

source§

impl<'a> Adc<'a>

source

pub const fn new(voltage_reference_in_mv: usize) -> Adc<'a>

source

pub fn calibrate(&self)

source

pub fn handle_interrupt(&self)

Trait Implementations§

source§

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

Implements an ADC capable reading ADC samples on any channel.

§

type Channel = AdcChannelSetup

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>

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])>

Start sampling continuously into buffers. Samples are double-buffered, going first into buffer1 and then into buffer2. A callback is performed to the client whenever either buffer is full, which expects either a second buffer to be sent via the provide_buffer call. Length fields correspond to the number of samples that should be collected in each buffer. If an error occurs, the buffers will be returned. Read more
source§

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

Provide a new buffer to fill with the ongoing sample_continuous configuration. Expected to be called in a buffer_ready callback. Note that if this is not called before the second buffer is filled, samples will be missed. Length field corresponds to the number of samples that should be collected in the buffer. If an error occurs, the buffer will be returned. Read more
source§

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

Reclaim ownership of buffers. Can only be called when the ADC is inactive, which occurs after a successful stop_sampling. Used to reclaim buffers after a sampling operation is complete. Returns Ok() if the ADC was inactive, but there may still be no buffers that are some if the driver had already returned all buffers. Read more
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.