Struct pca9539::pins::Pin

source ·
pub struct Pin<'a, B, R, M, A>
where B: Write + Read, R: RefGuard<B>, M: PinMode, A: AccessMode,
{ /* private fields */ }
Expand description

Individual GPIO pin

Implementations§

source§

impl<'a, B, R, A> Pin<'a, B, R, Input, A>
where B: Write + Read, R: RefGuard<B>, A: AccessMode,

source

pub fn invert_polarity(&self, invert: bool) -> Result<(), <B as Write>::Error>

Reverses/Resets the input polarity

source§

impl<'a, B, R> Pin<'a, B, R, Input, RefreshMode>
where B: Write + Read, R: RefGuard<B>,

source

pub fn refreshable(expander: &'a R, bank: Bank, id: PinID) -> Self

source§

impl<'a, B, R> Pin<'a, B, R, Input, RegularAccessMode>
where B: Write + Read, R: RefGuard<B>,

source

pub fn regular(expander: &'a R, bank: Bank, id: PinID) -> Self

Trait Implementations§

source§

impl<'a, B, R> InputPin for Pin<'a, B, R, Input, RefreshMode>
where B: Write + Read, R: RefGuard<B>,

§

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<'a, B, R> InputPin for Pin<'a, B, R, Input, RegularAccessMode>
where B: Write + Read, R: RefGuard<B>,

§

type Error = RefreshInputError<B>

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<'a, B, M, R> IoPin<Pin<'a, B, R, Input, RefreshMode>, Pin<'a, B, R, Output, RefreshMode>> for Pin<'a, B, R, M, RefreshMode>
where B: Write + Read, R: RefGuard<B>, M: PinMode,

§

type Error = <B as Write>::Error

Error type.
source§

fn into_input_pin( self ) -> Result<Pin<'a, B, R, Input, RefreshMode>, Self::Error>

Tries to convert this pin to input mode. Read more
source§

fn into_output_pin( self, state: PinState ) -> Result<Pin<'a, B, R, Output, RefreshMode>, Self::Error>

Tries to convert this pin to output mode with the given initial state. Read more
source§

impl<'a, B, M, R> IoPin<Pin<'a, B, R, Input, RegularAccessMode>, Pin<'a, B, R, Output, RegularAccessMode>> for Pin<'a, B, R, M, RegularAccessMode>
where B: Write + Read, R: RefGuard<B>, M: PinMode,

§

type Error = <B as Write>::Error

Error type.
source§

fn into_input_pin( self ) -> Result<Pin<'a, B, R, Input, RegularAccessMode>, Self::Error>

Tries to convert this pin to input mode. Read more
source§

fn into_output_pin( self, state: PinState ) -> Result<Pin<'a, B, R, Output, RegularAccessMode>, Self::Error>

Tries to convert this pin to output mode with the given initial state. Read more
source§

impl<'a, B, R> OutputPin for Pin<'a, B, R, Output, RefreshMode>
where B: Read + Write, R: RefGuard<B>,

§

type Error = Infallible

Error type
source§

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

Drives the pin low Read more
source§

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

Drives the pin high 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<'a, B, R> OutputPin for Pin<'a, B, R, Output, RegularAccessMode>
where B: Read + Write, R: RefGuard<B>,

§

type Error = <B as Write>::Error

Error type
source§

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

Drives the pin low Read more
source§

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

Drives the pin high 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<'a, B, R> RefreshableInputPin for Pin<'a, B, R, Input, RefreshMode>
where B: Write + Read, R: RefGuard<B>,

source§

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

Refreshes the input state of all pins of the same bank

source§

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

Refreshes the input state of all pins (on all banks)

§

type Error = RefreshInputError<B>

source§

impl<'a, B, R> RefreshableOutputPin for Pin<'a, B, R, Output, RefreshMode>
where B: Write + Read, R: RefGuard<B>,

source§

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

Updates the output state of all pins of the same bank

source§

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

Updates the output state of all pins (on all banks)

§

type Error = <B as Write>::Error

source§

impl<'a, B, R> StatefulOutputPin for Pin<'a, B, R, Output, RefreshMode>
where B: Write + Read, R: RefGuard<B>,

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<'a, B, R> StatefulOutputPin for Pin<'a, B, R, Output, RegularAccessMode>
where B: Write + Read, R: RefGuard<B>,

source§

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

As this is just acting on cached register data, its in fact Infallible

source§

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

As this is just acting on cached register data, its in fact Infallible

source§

impl<'a, B, R> Default for Pin<'a, B, R, Output, RefreshMode>
where B: Write + Read, R: RefGuard<B>,

source§

impl<'a, B, R> Default for Pin<'a, B, R, Output, RegularAccessMode>
where B: Write + Read, R: RefGuard<B>,

Auto Trait Implementations§

§

impl<'a, B, R, M, A> RefUnwindSafe for Pin<'a, B, R, M, A>

§

impl<'a, B, R, M, A> Send for Pin<'a, B, R, M, A>
where A: Send, M: Send, R: Sync,

§

impl<'a, B, R, M, A> Sync for Pin<'a, B, R, M, A>
where A: Sync, M: Sync, R: Sync,

§

impl<'a, B, R, M, A> Unpin for Pin<'a, B, R, M, A>
where A: Unpin, M: Unpin,

§

impl<'a, B, R, M, A> UnwindSafe for Pin<'a, B, R, M, 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<P> ToggleableOutputPin for P
where P: Default,

source§

fn toggle(&mut self) -> Result<(), <P as ToggleableOutputPin>::Error>

Toggle pin output

§

type Error = <P as OutputPin>::Error

Error type
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.