Struct max7301::expander::transactional::TransactionalIO[][src]

pub struct TransactionalIO<M, EI> where
    M: IOMutex<Expander<EI>>,
    EI: ExpanderInterface + Send
{ /* fields omitted */ }

This I/O adapter captures the Expander and provides a factory for generating GPIO pins that implement InputPin and OutputPin traits backed by a transactional write-back cache.

Each such pin will read its input state from a cached batch read at the beginning of a transaction, and will write its input state into a write-back buffer that is committed with a batch write at the end of the transaction. This reduces bus traffic due to the MAX7301’s support for reading or writing 8 consecutive ports in a single operation.

Implementations

impl<M, EI> TransactionalIO<M, EI> where
    M: IOMutex<Expander<EI>>,
    EI: ExpanderInterface + Send
[src]

pub fn port_pin<'io>(&'io self, port: u8) -> PortPin<'io, Self>[src]

Create a PortPin corresponding to one of the ports on the MAX7301.

The returned PortPin implements InputPin and OutputPin, and using any of the methods from these traits on the returned PortPin will read or write the value of the I/O port from a local write-back cache. Refreshing or writing back the cache is controlled by refresh and write_back.

pub fn refresh(&self) -> Result<(), ()>[src]

Refresh the local cache by reading the port values from any outstanding PortPins issued from this adapter, updating the values read through their InputPin impls.

This is done using batch registers of MAX7301 to reduce bus traffic. All pending OutputPin operations are discarded.

pub fn write_back(&self, strategy: Strategy) -> Result<(), ()>[src]

Write back any pending OutputPin operations to the MAX7301.

The strategy used to do this is controlled by strategy (see Strategy docs for a description of the available strategies).

Trait Implementations

impl<M, EI> ExpanderIO for TransactionalIO<M, EI> where
    M: IOMutex<Expander<EI>>,
    EI: ExpanderInterface + Send
[src]

Auto Trait Implementations

impl<M, EI> RefUnwindSafe for TransactionalIO<M, EI> where
    EI: RefUnwindSafe,
    M: RefUnwindSafe

impl<M, EI> Send for TransactionalIO<M, EI> where
    M: Send

impl<M, EI> Sync for TransactionalIO<M, EI> where
    EI: Sync,
    M: Sync

impl<M, EI> Unpin for TransactionalIO<M, EI> where
    EI: Unpin,
    M: Unpin

impl<M, EI> UnwindSafe for TransactionalIO<M, EI> where
    EI: UnwindSafe,
    M: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.