Struct Adc

Source
pub struct Adc<I: AdcInstance> { /* private fields */ }
Expand description

ADC Instance

Implementations§

Source§

impl<I: AdcInstance + PrimaryAdc> Adc<I>

Source

pub fn read_cpu_temperature(&mut self, sysctrl: &mut Sysctrl) -> f32

Returns the CPU temperature in degrees C

NOTE: The temperature sensor is known to be out by up to ±10C, it therefore should not be relied on for critical temperature readings

Source

pub fn read_cpu_voltage(&mut self, src: CpuVoltageSource) -> u16

Source§

impl<I: AdcInstance> Adc<I>

Source

pub fn into_future<F>(self, irqs: F) -> FutureAdc<I, F>

Switch the [‘Adc’] to [‘FutureAdc’], allowing for the use of async reading methods. You are required to provide the struct created by the bind_interrupts macro to prove that the interrupt sources have been correctly configured. This function will automatically enable the relevant NVIC interrupt sources. However, you are required to configure the desired interrupt priorities prior to calling this method. Consult crate::async_hal::interrupts module-level documentation for more information. bind_interrupts.

Source§

impl<I: AdcInstance> Adc<I>

Source

pub fn read<P: AdcPin<I>>(&mut self, _pin: &mut P) -> u16

Read a single value from the provided ADC pin.

Source

pub fn check_read_discard(&mut self)

Source

pub fn read_buffer<P: AdcPin<I>>( &mut self, _pin: &mut P, dst: &mut [u16], ) -> Result<(), Error>

Read into a buffer from the provided ADC pin, in a blocking fashion

Source

pub fn free(self) -> I::Instance

Return the underlying ADC PAC object.

Auto Trait Implementations§

§

impl<I> Freeze for Adc<I>
where <I as AdcInstance>::Instance: Freeze,

§

impl<I> RefUnwindSafe for Adc<I>

§

impl<I> Send for Adc<I>
where <I as AdcInstance>::Instance: Send,

§

impl<I> Sync for Adc<I>
where <I as AdcInstance>::Instance: Sync,

§

impl<I> Unpin for Adc<I>
where <I as AdcInstance>::Instance: Unpin,

§

impl<I> UnwindSafe for Adc<I>

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.