Struct port_expander::Pin
source · [−]pub struct Pin<'a, MODE, MUTEX> { /* private fields */ }
Expand description
Representation of a port-expander pin.
Pin
is not constructed directly, this type is created by instanciating a port-expander and
then getting access to all its pins using the .split()
method.
Implementations
sourceimpl<'a, MODE, MUTEX, PD> Pin<'a, MODE, MUTEX> where
PD: PortDriver + PortDriverTotemPole,
MUTEX: BusMutex<Bus = PD>,
impl<'a, MODE, MUTEX, PD> Pin<'a, MODE, MUTEX> where
PD: PortDriver + PortDriverTotemPole,
MUTEX: BusMutex<Bus = PD>,
sourcepub fn into_input(self) -> Result<Pin<'a, Input, MUTEX>, PD::Error>
pub fn into_input(self) -> Result<Pin<'a, Input, MUTEX>, PD::Error>
Configure this pin as an input.
The exact electrical details depend on the port-expander device which is used.
sourcepub fn into_output(self) -> Result<Pin<'a, Output, MUTEX>, PD::Error>
pub fn into_output(self) -> Result<Pin<'a, Output, MUTEX>, PD::Error>
Configure this pin as an output with an initial LOW state.
The LOW state is, as long as he port-expander chip allows this, entered without any electrical glitch.
sourcepub fn into_output_high(self) -> Result<Pin<'a, Output, MUTEX>, PD::Error>
pub fn into_output_high(self) -> Result<Pin<'a, Output, MUTEX>, PD::Error>
Configure this pin as an output with an initial HIGH state.
The HIGH state is, as long as he port-expander chip allows this, entered without any electrical glitch.
sourceimpl<'a, MODE, MUTEX, PD> Pin<'a, MODE, MUTEX> where
PD: PortDriver + PortDriverPolarity,
MUTEX: BusMutex<Bus = PD>,
impl<'a, MODE, MUTEX, PD> Pin<'a, MODE, MUTEX> where
PD: PortDriver + PortDriverPolarity,
MUTEX: BusMutex<Bus = PD>,
sourcepub fn into_inverted(self) -> Result<Self, PD::Error>
pub fn into_inverted(self) -> Result<Self, PD::Error>
Turn on hardware polarity inversion for this pin.
sourcepub fn set_inverted(&mut self, inverted: bool) -> Result<(), PD::Error>
pub fn set_inverted(&mut self, inverted: bool) -> Result<(), PD::Error>
Set hardware polarity inversion for this pin.
sourceimpl<'a, MODE: HasInput, MUTEX, PD> Pin<'a, MODE, MUTEX> where
PD: PortDriver,
MUTEX: BusMutex<Bus = PD>,
impl<'a, MODE: HasInput, MUTEX, PD> Pin<'a, MODE, MUTEX> where
PD: PortDriver,
MUTEX: BusMutex<Bus = PD>,
sourceimpl<'a, MODE: HasOutput, MUTEX, PD> Pin<'a, MODE, MUTEX> where
PD: PortDriver,
MUTEX: BusMutex<Bus = PD>,
impl<'a, MODE: HasOutput, MUTEX, PD> Pin<'a, MODE, MUTEX> where
PD: PortDriver,
MUTEX: BusMutex<Bus = PD>,
sourcepub fn set_high(&mut self) -> Result<(), PD::Error>
pub fn set_high(&mut self) -> Result<(), PD::Error>
Set the pin’s output state to HIGH.
Note that this can have different electrical meanings depending on the port-expander chip.
sourcepub fn set_low(&mut self) -> Result<(), PD::Error>
pub fn set_low(&mut self) -> Result<(), PD::Error>
Set the pin’s output state to LOW.
Note that this can have different electrical meanings depending on the port-expander chip.
sourcepub fn is_set_high(&self) -> Result<bool, PD::Error>
pub fn is_set_high(&self) -> Result<bool, PD::Error>
Return true
if the pin’s output state is HIGH.
This method does not read the pin’s electrical state.
sourcepub fn is_set_low(&self) -> Result<bool, PD::Error>
pub fn is_set_low(&self) -> Result<bool, PD::Error>
Return true
if the pin’s output state is LOW.
This method does not read the pin’s electrical state.
Trait Implementations
sourceimpl<'a, MODE: HasInput, MUTEX, PD> InputPin for Pin<'a, MODE, MUTEX> where
PD: PortDriver,
MUTEX: BusMutex<Bus = PD>,
impl<'a, MODE: HasInput, MUTEX, PD> InputPin for Pin<'a, MODE, MUTEX> where
PD: PortDriver,
MUTEX: BusMutex<Bus = PD>,
sourceimpl<'a, MODE: HasOutput, MUTEX, PD> OutputPin for Pin<'a, MODE, MUTEX> where
PD: PortDriver,
MUTEX: BusMutex<Bus = PD>,
impl<'a, MODE: HasOutput, MUTEX, PD> OutputPin for Pin<'a, MODE, MUTEX> where
PD: PortDriver,
MUTEX: BusMutex<Bus = PD>,
type Error = <PD as PortDriver>::Error
type Error = <PD as PortDriver>::Error
Error type
sourceimpl<'a, MODE: HasOutput, MUTEX, PD> StatefulOutputPin for Pin<'a, MODE, MUTEX> where
PD: PortDriver,
MUTEX: BusMutex<Bus = PD>,
impl<'a, MODE: HasOutput, MUTEX, PD> StatefulOutputPin for Pin<'a, MODE, MUTEX> where
PD: PortDriver,
MUTEX: BusMutex<Bus = PD>,
Auto Trait Implementations
impl<'a, MODE, MUTEX> RefUnwindSafe for Pin<'a, MODE, MUTEX> where
MODE: RefUnwindSafe,
MUTEX: RefUnwindSafe,
impl<'a, MODE, MUTEX> Send for Pin<'a, MODE, MUTEX> where
MODE: Send,
MUTEX: Sync,
impl<'a, MODE, MUTEX> Sync for Pin<'a, MODE, MUTEX> where
MODE: Sync,
MUTEX: Sync,
impl<'a, MODE, MUTEX> Unpin for Pin<'a, MODE, MUTEX> where
MODE: Unpin,
impl<'a, MODE, MUTEX> UnwindSafe for Pin<'a, MODE, MUTEX> where
MODE: UnwindSafe,
MUTEX: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more