Shared

Struct Shared 

Source
pub struct Shared<'a, P> {
    pub value: &'a RefCell<P>,
}

Fields§

§value: &'a RefCell<P>

Implementations§

Source§

impl<'a, P> Shared<'a, P>

Source

pub fn new(value: &'a RefCell<P>) -> Self

Trait Implementations§

Source§

impl<'a, P> BusOperation for Shared<'a, P>
where P: BusOperation,

Source§

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

Reads bytes from the SPI bus.

§Arguments
  • rbuf: Buffer to store the read bytes.
§Returns
  • Result
    • ()
    • Err: Returns an error if the read operation fails.
Source§

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

Writes bytes to the SPI bus.

§Arguments
  • wbuf: Buffer containing the bytes to write.
§Returns
  • Result
    • ()
    • Err: Returns an error if the write operation fails.
Source§

fn write_byte_read_bytes( &mut self, wbuf: &[u8; 1], rbuf: &mut [u8], ) -> Result<(), Self::Error>

Writes a byte and then reads bytes from the SPI bus.

§Arguments
  • wbuf: Buffer containing the byte to write.
  • rbuf: Buffer to store the read bytes.
§Returns
  • Result
    • ()
    • Err: Returns an error if the write-read operation fails.
Source§

type Error = <P as BusOperation>::Error

Source§

fn read_from_register( &mut self, reg: u8, buf: &mut [u8], ) -> Result<(), Self::Error>

Source§

fn write_to_register(&mut self, reg: u8, buf: &[u8]) -> Result<(), Self::Error>

Source§

impl<'a, P> DelayNs for Shared<'a, P>
where P: DelayNs,

Source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for at minimum ms milliseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

fn delay_ns(&mut self, ns: u32)

Pauses execution for at minimum ns nanoseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

fn delay_us(&mut self, us: u32)

Pauses execution for at minimum us microseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
Source§

impl<'a, P> ErrorType for Shared<'a, P>
where P: I2c,

Source§

type Error = <P as ErrorType>::Error

Error type
Source§

impl<'a, P> I2c for Shared<'a, P>
where P: I2c,

Source§

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

Reads enough bytes from slave with address to fill read. Read more
Source§

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

Writes bytes to slave with address address. Read more
Source§

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

Writes bytes to slave with address address and then reads enough bytes to fill read in a single transaction. Read more
Source§

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

Execute the provided operations on the I2C bus. Read more

Auto Trait Implementations§

§

impl<'a, P> Freeze for Shared<'a, P>

§

impl<'a, P> !RefUnwindSafe for Shared<'a, P>

§

impl<'a, P> !Send for Shared<'a, P>

§

impl<'a, P> !Sync for Shared<'a, P>

§

impl<'a, P> Unpin for Shared<'a, P>

§

impl<'a, P> !UnwindSafe for Shared<'a, P>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.