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§
Source§impl<'a, MODE, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver,
MUTEX: PortMutex<Port = PD>,
impl<'a, MODE, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver,
MUTEX: PortMutex<Port = PD>,
Source§impl<'a, MODE, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver + PortDriverTotemPole,
MUTEX: PortMutex<Port = PD>,
impl<'a, MODE, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver + PortDriverTotemPole,
MUTEX: PortMutex<Port = PD>,
Sourcepub fn into_input(self) -> Result<Pin<'a, Input, MUTEX>, PinError<PD::Error>>
pub fn into_input(self) -> Result<Pin<'a, Input, MUTEX>, PinError<PD::Error>>
Configure this pin as an input.
The exact electrical details depend on the port-expander device which is used.
Source§impl<'a, MODE, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver + PortDriverPolarity,
MUTEX: PortMutex<Port = PD>,
impl<'a, MODE, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver + PortDriverPolarity,
MUTEX: PortMutex<Port = PD>,
Sourcepub fn into_inverted(self) -> Result<Self, PinError<PD::Error>>
pub fn into_inverted(self) -> Result<Self, PinError<PD::Error>>
Turn on hardware polarity inversion for this pin.
Source§impl<'a, MODE: HasInput, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver,
MUTEX: PortMutex<Port = PD>,
impl<'a, MODE: HasInput, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver,
MUTEX: PortMutex<Port = PD>,
Source§impl<'a, MODE: HasInput, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver + PortDriverPullUp,
MUTEX: PortMutex<Port = PD>,
impl<'a, MODE: HasInput, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver + PortDriverPullUp,
MUTEX: PortMutex<Port = PD>,
Source§impl<'a, MODE: HasInput, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver + PortDriverPullDown,
MUTEX: PortMutex<Port = PD>,
impl<'a, MODE: HasInput, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver + PortDriverPullDown,
MUTEX: PortMutex<Port = PD>,
Source§impl<'a, MODE: HasOutput, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver,
MUTEX: PortMutex<Port = PD>,
impl<'a, MODE: HasOutput, MUTEX, PD> Pin<'a, MODE, MUTEX>where
PD: PortDriver,
MUTEX: PortMutex<Port = PD>,
Sourcepub fn set_high(&mut self) -> Result<(), PinError<PD::Error>>
pub fn set_high(&mut self) -> Result<(), PinError<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<(), PinError<PD::Error>>
pub fn set_low(&mut self) -> Result<(), PinError<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, PinError<PD::Error>>
pub fn is_set_high(&self) -> Result<bool, PinError<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, PinError<PD::Error>>
pub fn is_set_low(&self) -> Result<bool, PinError<PD::Error>>
Return true
if the pin’s output state is LOW.
This method does not read the pin’s electrical state.