Skip to main content

ErasedPin

Struct ErasedPin 

Source
pub struct ErasedPin<MODE> { /* private fields */ }
Expand description

A pin whose identity has moved into runtime values, keeping its mode.

Port and number become fields, so pins of different ports share a type and fit in one array. MODE stays a type parameter — an ErasedPin<Input> still has no set_high. One-way: the checks that need the exact pin have already run by the time it is erased.

Implementations§

Source§

impl<MODE> ErasedPin<MODE>

Source

pub fn port(&self) -> Port

Returns which port the pin came from.

Source

pub fn number(&self) -> u8

Returns the pin’s number within its port.

Source§

impl<OTYPE> ErasedPin<Output<OTYPE>>

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 toggle(&mut self)

Inverts the driven level.

Source

pub fn is_set_high(&self) -> bool

Returns whether the pin is being driven high.

Reads back OCTL, i.e. what was last written, not what the wire is at — for the latter on an open-drain pin see is_high.

Source

pub fn is_set_low(&self) -> bool

Returns whether the pin is being driven low.

Source§

impl ErasedPin<Input>

Source

pub fn is_high(&self) -> bool

Returns whether the input reads high.

Source

pub fn is_low(&self) -> bool

Returns whether the input reads low.

Source§

impl ErasedPin<Output<OpenDrain>>

Source

pub fn is_high(&self) -> bool

Returns whether the wire reads high.

Open-drain can only pull low, so this is the actual line level, which another device on a shared bus may be holding down.

Source

pub fn is_low(&self) -> bool

Returns whether the wire reads low.

Trait Implementations§

Source§

impl<OTYPE> ErrorType for ErasedPin<Output<OTYPE>>

Source§

type Error = !

Error type
Source§

impl ErrorType for ErasedPin<Input>

Source§

type Error = !

Error type
Source§

impl InputPin for ErasedPin<Input>

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 InputPin for ErasedPin<Output<OpenDrain>>

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<OTYPE> OutputPin for ErasedPin<Output<OTYPE>>

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<OTYPE> StatefulOutputPin for ErasedPin<Output<OTYPE>>

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.

Auto Trait Implementations§

§

impl<MODE> Freeze for ErasedPin<MODE>
where PhantomData<MODE>: Freeze,

§

impl<MODE> RefUnwindSafe for ErasedPin<MODE>

§

impl<MODE> Send for ErasedPin<MODE>
where PhantomData<MODE>: Send,

§

impl<MODE> Sync for ErasedPin<MODE>
where PhantomData<MODE>: Sync,

§

impl<MODE> Unpin for ErasedPin<MODE>
where PhantomData<MODE>: Unpin,

§

impl<MODE> UnsafeUnpin for ErasedPin<MODE>
where PhantomData<MODE>: UnsafeUnpin,

§

impl<MODE> UnwindSafe for ErasedPin<MODE>
where PhantomData<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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.