Struct embedded_hal_compat::Reverse

source ·
pub struct Reverse<T> { /* private fields */ }
Expand description

Reverse compatibility container object. This is generic over different E-H types and will provide adaption depending on the bound type.

Implementations§

source§

impl<T> Reverse<T>

source

pub fn new(inner: T) -> Reverse<T>

Create a new compatibility wrapper object

source

pub fn inner(&self) -> &T

Fetch a reference to the wrapped object

source

pub fn inner_mut(&mut self) -> &mut T

Fetch a mutable reference to the wrapped object

source

pub fn unwrap(self) -> T

Destroy the compatibility wrapper, returning the wrapped object

Trait Implementations§

source§

impl<T, E> InputPin for Reverse<RefCell<T>>
where T: InputPin<Error = E>, E: Debug,

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?

§

type Error = E

Error type
source§

impl<T, E> OutputPin for Reverse<RefCell<T>>
where T: OutputPin<Error = E>, E: Debug,

source§

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

Set the output as high

source§

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

Set the output as low

§

type Error = E

Error type
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<T, E> Transactional<u8> for Reverse<T>
where T: SpiBus<Error = E>, E: Debug,

Available on crate feature alloc only.
§

type Error = E

Associated error type
source§

fn exec( &mut self, operations: &mut [Operation<'_, u8>] ) -> Result<(), Self::Error>

Execute the provided transactions
source§

impl<T, E> Transactional for Reverse<T>
where T: I2c<SevenBitAddress, Error = E>, E: Debug,

Available on crate feature alloc only.
§

type Error = E

Error type
source§

fn exec( &mut self, address: u8, operations: &mut [Operation<'_>] ) -> Result<(), Self::Error>

Execute the provided operations on the I2C bus. Read more
source§

impl<T, E> WriteIter<u8> for Reverse<T>
where T: SpiBus<u8, Error = E>, E: Debug,

§

type Error = E

Error type
source§

fn write_iter<WI>(&mut self, words: WI) -> Result<(), Self::Error>
where WI: IntoIterator<Item = u8>,

Sends words to the slave, ignoring all the incoming words
source§

impl<T> DelayMs<u16> for Reverse<T>
where T: DelayNs,

source§

fn delay_ms(&mut self, ms: u16)

Pauses execution for ms milliseconds
source§

impl<T> DelayMs<u32> for Reverse<T>
where T: DelayNs,

source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for ms milliseconds
source§

impl<T> DelayUs<u16> for Reverse<T>
where T: DelayNs,

source§

fn delay_us(&mut self, us: u16)

Pauses execution for us microseconds
source§

impl<T> DelayUs<u32> for Reverse<T>
where T: DelayNs,

source§

fn delay_us(&mut self, us: u32)

Pauses execution for us microseconds
source§

impl<T, E> Read for Reverse<T>
where T: I2c<SevenBitAddress, Error = E>, E: Debug,

§

type Error = E

Error type
source§

fn read( &mut self, address: SevenBitAddress, words: &mut [u8] ) -> Result<(), Self::Error>

Reads enough bytes from slave with address to fill buffer Read more
source§

impl<T, E> Write for Reverse<T>
where T: I2c<SevenBitAddress, Error = E>, E: Debug,

§

type Error = E

Error type
source§

fn write( &mut self, address: SevenBitAddress, words: &[u8] ) -> Result<(), Self::Error>

Writes bytes to slave with address address Read more
source§

impl<T, E> WriteRead for Reverse<T>
where T: I2c<SevenBitAddress, Error = E>, E: Debug,

§

type Error = E

Error type
source§

fn write_read( &mut self, address: SevenBitAddress, bytes: &[u8], buffer: &mut [u8] ) -> Result<(), Self::Error>

Writes bytes to slave with address address and then reads enough bytes to fill buffer in a single transaction Read more
source§

impl<T, E> Write<u8> for Reverse<T>
where T: Write<Error = E>, E: Debug,

Available on crate feature embedded-io only.
§

type Error = E

The type of error that can occur when writing
source§

fn bwrite_all(&mut self, words: &[u8]) -> Result<(), Self::Error>

Writes a slice, blocking until everything has been written Read more
source§

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

Block until the serial interface has sent all buffered words
source§

impl<T, E> Transfer<u8> for Reverse<T>
where T: SpiBus<u8, Error = E>, E: Debug,

§

type Error = E

Error type
source§

fn transfer<'a>(&mut self, words: &'a mut [u8]) -> Result<&'a [u8], Self::Error>

Sends words to the slave. Returns the words received from the slave
source§

impl<T, E> Write<u8> for Reverse<T>
where T: SpiBus<u8, Error = E>, E: Debug,

§

type Error = E

Error type
source§

fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>

Sends words to the slave, ignoring all the incoming words
source§

impl<T, E> Write<u8> for Reverse<T>
where T: Write<Error = E>, E: Debug,

Available on crate feature embedded-io only.
§

type Error = E

Write error
source§

fn write(&mut self, word: u8) -> Result<(), Self::Error>

Writes a single word to the serial interface
source§

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

Ensures that none of the previously written words are still buffered
source§

impl<T, E> FullDuplex<u8> for Reverse<T>
where T: SpiBus<u8, Error = E>, E: Debug,

§

type Error = E

An enumeration of SPI errors
source§

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

Reads the word stored in the shift register Read more
source§

fn send(&mut self, word: u8) -> Result<(), Self::Error>

Sends a word to the slave

Auto Trait Implementations§

§

impl<T> Freeze for Reverse<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Reverse<T>
where T: RefUnwindSafe,

§

impl<T> Send for Reverse<T>
where T: Send,

§

impl<T> Sync for Reverse<T>
where T: Sync,

§

impl<T> Unpin for Reverse<T>
where T: Unpin,

§

impl<T> UnwindSafe for Reverse<T>
where T: UnwindSafe,

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, M> ForwardCompat<T, M> for T

source§

fn forward(self) -> Forward<T, M>

Create an e-h-c forward compatibility wrapper around and e-h object Available methods depend on the wrapped type
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<T> ReverseCompat<T> for T

source§

fn reverse(self) -> Reverse<T>

Create an e-h-c wrapper around and e-h object Available methods depend on the wrapped type

source§

fn reverse_cell(self) -> Reverse<RefCell<T>>

Create an e-h-c reverse compatibility wrapper using a ref-cell for interior mutability (required for InputPin types)

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.