Struct max7301::expander::Expander [−][src]
The port expander device itself.
Implementations
impl<EI: ExpanderInterface + Send> Expander<EI>
[src]
pub fn new(iface: EI) -> Self
[src]
Create a new Expander
.
Takes ownership of the ExpanderInterface
which it should use to communicate with the
MAX7301.
pub fn configure<'e>(&'e mut self) -> Configurator<'e, EI>
[src]
Begin (re)configuring the port expander hardware by returning a Configurator
.
The Configurator
is a builder-like interface that can be used to alter port modes and
device configuration bits.
pub fn into_immediate<M: IOMutex<Self>>(self) -> ImmediateIO<M, EI>
[src]
Convert this expander into an immediate-mode I/O adapter.
The I/O adapter can be used to generate individual PortPin
s that allow
embedded-hal
-compatible access to the GPIOs on the expander directly, with every
operation immediately triggering a bus operation.
See ImmediateIO
for detail.
pub fn into_transactional<M: IOMutex<Self>>(self) -> TransactionalIO<M, EI>
[src]
Convert this expander into a transactional I/O adapter.
The I/O adapter can be used to generate individual PortPin
s that allow
embedded-hal
-compatible access to the GPIOs on the expander. Unlike immediate mode, the
operations on PortPin
trait methods are buffered in a write-back cache.
See TransactionalIO
for detail.
pub fn read_port(&mut self, port: u8) -> Result<bool, ()>
[src]
Perform a read of the current value of a single I/O port on the expander.
pub fn read_ports(&mut self, start_port: u8) -> Result<u8, ()>
[src]
Perform a read of the current value of 8 consecutive I/O ports on the expander in a single bus transaction.
There is no alignment requirement; the start_port
may be any valid port, and that port
along with up to 7 following ports will be read in one transaction. The return value is a
u8
where the LSB is the value read from start_port
, and each higher bit is the 7 ports
following it in ascending order. If any of the bits would correspond to a port higher than
31, then those bits will be unset.
pub fn write_port(&mut self, port: u8, bit: bool) -> Result<(), ()>
[src]
Write a value to a single I/O port on the expander.
pub fn write_ports(&mut self, start_port: u8, bits: u8) -> Result<(), ()>
[src]
Write a value to 8 consecutive I/O ports on the expander in a single bus transaction.
There is no alignment requirement; the start_port
may be any valid port, and that port
along with up to 7 following ports will be written in one transaction. bits
is a u8
where the LSB is the value to write to start_port
, and each higher bit is the 7 ports
following it in ascending order. If any of the bits would correspond to a port higher than
31, then those bits will be ignored.
Auto Trait Implementations
impl<EI> RefUnwindSafe for Expander<EI> where
EI: RefUnwindSafe,
EI: RefUnwindSafe,
impl<EI> Send for Expander<EI> where
EI: Send,
EI: Send,
impl<EI> Sync for Expander<EI> where
EI: Sync,
EI: Sync,
impl<EI> Unpin for Expander<EI> where
EI: Unpin,
EI: Unpin,
impl<EI> UnwindSafe for Expander<EI> where
EI: UnwindSafe,
EI: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,