ADC

Struct ADC 

Source
pub struct ADC<State = Enabled> { /* private fields */ }
Expand description

Interface to the ADC peripheral

Controls the ADC. Use Peripherals to gain access to an instance of this struct.

Please refer to the module documentation for more information.

§embedded-hal traits

Implementations§

Source§

impl ADC<Disabled>

Source

pub fn enable(self, clock: &AdcClock, syscon: &mut Handle) -> ADC

Enable the ADC

This method is only available, if ADC is in the Disabled state. Code that attempts to call this method when the peripheral is already enabled will not compile.

Consumes this instance of ADC and returns another instance that has its State type parameter set to Enabled.

§Examples

Please refer to the module documentation for a full example.

Source§

impl ADC<Enabled>

Source

pub fn disable(self, syscon: &mut Handle) -> ADC<Disabled>

Disable the ADC

This method is only available, if ADC is in the Enabled state. Code that attempts to call this method when the peripheral is already disabled will not compile.

Consumes this instance of ADC and returns another instance that has its State type parameter set to Disabled.

Source§

impl<State> ADC<State>

Source

pub fn free(self) -> ADC0

Return the raw peripheral

This method serves as an escape hatch from the HAL API. It returns the raw peripheral, allowing you to do whatever you want with it, without limitations imposed by the API.

If you are using this method because a feature you need is missing from the HAL API, please open an issue or, if an issue for your feature request already exists, comment on the existing issue, so we can prioritize it accordingly.

Trait Implementations§

Source§

impl<PIN> Channel<ADC> for Function<ADC_0, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> Channel<ADC> for Function<ADC_1, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> Channel<ADC> for Function<ADC_10, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> Channel<ADC> for Function<ADC_11, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> Channel<ADC> for Function<ADC_2, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> Channel<ADC> for Function<ADC_3, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> Channel<ADC> for Function<ADC_4, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> Channel<ADC> for Function<ADC_5, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> Channel<ADC> for Function<ADC_6, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> Channel<ADC> for Function<ADC_7, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> Channel<ADC> for Function<ADC_8, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> Channel<ADC> for Function<ADC_9, Assigned<PIN>>

Source§

type ID = u8

Channel ID type Read more
Source§

fn channel() -> Self::ID

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8.
Source§

impl<PIN> OneShot<ADC, u16, PIN> for ADC
where PIN: Channel<ADC, ID = u8>,

Source§

fn read(&mut self, _: &mut PIN) -> Result<u16, Self::Error>

Request that the ADC begin a conversion on the specified pin

Source§

type Error = ()

Error type returned by ADC methods

Auto Trait Implementations§

§

impl<State> Freeze for ADC<State>
where State: Freeze,

§

impl<State> RefUnwindSafe for ADC<State>
where State: RefUnwindSafe,

§

impl<State> Send for ADC<State>
where State: Send,

§

impl<State = Enabled> !Sync for ADC<State>

§

impl<State> Unpin for ADC<State>
where State: Unpin,

§

impl<State> UnwindSafe for ADC<State>
where State: UnwindSafe,

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

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.