pub struct I2CMasterDma<I2C, PINS, TX_STREAM, const TX_CH: u8, RX_STREAM, const RX_CH: u8>where
    I2C: Instance,
    TX_STREAM: Stream,
    RX_STREAM: Stream,
{ /* private fields */ }
Expand description

I2c abstraction that can work in non-blocking mode by using DMA

The struct should be used for sending/receiving bytes to/from slave device in non-blocking mode. A client must follow these requirements to use that feature:

  • Enable interrupts DMAx_STREAMy used for transmit and another DMAq_STREAMp used for receive.
  • In these interrupts call handle_dma_interrupt
  • Enable interrupts I2Cx_ER for handling errors and call handle_error_interrupt in corresponding handler

The struct can be also used to send/receive bytes in blocking mode with methods: write, read, write_read.

Implementations

Checks if there is communication in progress

Handles DMA interrupt. This method a client must call in DMAx_STREAMy interrupt

Handles errors generated by I2C This method a client must call in I2Cx_ER interrupt

Reads in blocking mode but if i2c is busy returns WouldBlock and do nothing

Write and then read in blocking mode but if i2c is busy returns WouldBlock and do nothing

Write in blocking mode but if i2c is busy returns WouldBlock and do nothing

Trait Implementations

Reads bytes from slave device with address addr in non-blocking mode and writes these bytes in buf Read more
Writes bytes to slave with address addr in non-blocking mode Read more
Writes bytes to slave with address addr in non-blocking mode and then generate ReStart and receive a bytes from a same device Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.