pub struct PartiallyErasedPin<const P: char, MODE> { /* private fields */ }
Expand description

Partially erased pin

  • MODE is one of the pin modes (see Modes section).
  • P is port name: A for GPIOA, B for GPIOB, etc.

Implementations§

source§

impl<const P: char, MODE: PinMode> PartiallyErasedPin<P, MODE>

source

pub fn into_mode<M: PinMode>(self) -> PartiallyErasedPin<P, M>

Converts pin into specified mode

source§

impl<const P: char, MODE> PartiallyErasedPin<P, MODE>

source

pub fn restore<const N: u8>(self) -> Pin<P, N, MODE>

Convert partially type erased pin to Pin with fixed type

source§

impl<const P: char, MODE> PartiallyErasedPin<P, Output<MODE>>

source

pub fn set_high(&mut self)

Drives the pin high

source

pub fn set_low(&mut self)

Drives the pin low

source

pub fn get_state(&self) -> PinState

Is the pin in drive high or low mode?

source

pub fn set_state(&mut self, state: PinState)

Drives the pin high or low depending on the provided value

source

pub fn is_set_high(&self) -> bool

Is the pin in drive high mode?

source

pub fn is_set_low(&self) -> bool

Is the pin in drive low mode?

source

pub fn toggle(&mut self)

Toggle pin output

source§

impl<const P: char, MODE> PartiallyErasedPin<P, MODE>
where MODE: Readable,

source

pub fn is_high(&self) -> bool

Is the input pin high?

source

pub fn is_low(&self) -> bool

Is the input pin low?

Trait Implementations§

source§

impl<const P: char, MODE> Debug for PartiallyErasedPin<P, MODE>

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const P: char, MODE> ErrorType for PartiallyErasedPin<P, MODE>

§

type Error = Infallible

Error type
source§

impl<const P: char, MODE> Format for PartiallyErasedPin<P, MODE>

source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
source§

impl<const P: char, MODE> From<PartiallyErasedPin<P, MODE>> for ErasedPin<MODE>

source§

fn from(p: PartiallyErasedPin<P, MODE>) -> Self

Partially erased pin-to-erased pin conversion using the From trait.

Note that From is the reciprocal of Into.

source§

impl<const P: char, const N: u8, MODE> From<Pin<P, N, MODE>> for PartiallyErasedPin<P, MODE>

source§

fn from(p: Pin<P, N, MODE>) -> Self

Pin-to-partially erased pin conversion using the From trait.

Note that From is the reciprocal of Into.

source§

impl<const P: char, MODE> InputPin for PartiallyErasedPin<P, MODE>
where MODE: Readable,

§

type Error = Infallible

Error type
source§

fn is_high(&self) -> Result<bool, Self::Error>

Is the input pin high?
source§

fn is_low(&self) -> Result<bool, Self::Error>

Is the input pin low?
source§

impl<const P: char, MODE> InputPin for PartiallyErasedPin<P, MODE>
where MODE: Readable,

source§

fn is_high(&mut self) -> Result<bool, Self::Error>

Is the input pin high?
source§

fn is_low(&mut self) -> Result<bool, Self::Error>

Is the input pin low?
source§

impl<const P: char, MODE> OutputPin for PartiallyErasedPin<P, Output<MODE>>

§

type Error = Infallible

Error type
source§

fn set_high(&mut self) -> Result<(), Self::Error>

Drives the pin high Read more
source§

fn set_low(&mut self) -> Result<(), Self::Error>

Drives the pin low Read more
source§

fn set_state(&mut self, state: PinState) -> Result<(), Self::Error>

Drives the pin high or low depending on the provided value Read more
source§

impl<const P: char, MODE> OutputPin for PartiallyErasedPin<P, Output<MODE>>

source§

fn set_high(&mut self) -> Result<(), Self::Error>

Drives the pin high. Read more
source§

fn set_low(&mut self) -> Result<(), Self::Error>

Drives the pin low. Read more
source§

fn set_state(&mut self, state: PinState) -> Result<(), Self::Error>

Drives the pin high or low depending on the provided value. Read more
source§

impl<const P: char, MODE> PinExt for PartiallyErasedPin<P, MODE>

§

type Mode = MODE

Current pin mode
source§

fn pin_id(&self) -> u8

Pin number
source§

fn port_id(&self) -> u8

Port number starting from 0
source§

impl<const P: char, MODE> StatefulOutputPin for PartiallyErasedPin<P, Output<MODE>>

source§

fn is_set_high(&mut self) -> Result<bool, Self::Error>

Is the pin in drive high mode? Read more
source§

fn is_set_low(&mut self) -> Result<bool, Self::Error>

Is the pin in drive low mode? Read more
source§

fn toggle(&mut self) -> Result<(), Self::Error>

Toggle pin output.
source§

impl<const P: char, MODE> StatefulOutputPin for PartiallyErasedPin<P, Output<MODE>>

source§

fn is_set_high(&self) -> Result<bool, Self::Error>

Is the pin in drive high mode? Read more
source§

fn is_set_low(&self) -> Result<bool, Self::Error>

Is the pin in drive low mode? Read more
source§

impl<const P: char, MODE> ToggleableOutputPin for PartiallyErasedPin<P, Output<MODE>>

§

type Error = Infallible

Error type
source§

fn toggle(&mut self) -> Result<(), Self::Error>

Toggle pin output.

Auto Trait Implementations§

§

impl<const P: char, MODE> RefUnwindSafe for PartiallyErasedPin<P, MODE>
where MODE: RefUnwindSafe,

§

impl<const P: char, MODE> Send for PartiallyErasedPin<P, MODE>
where MODE: Send,

§

impl<const P: char, MODE> Sync for PartiallyErasedPin<P, MODE>
where MODE: Sync,

§

impl<const P: char, MODE> Unpin for PartiallyErasedPin<P, MODE>
where MODE: Unpin,

§

impl<const P: char, MODE> UnwindSafe for PartiallyErasedPin<P, MODE>
where MODE: 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>,

§

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.