Struct embassy_stm32::i2c::I2c
source · pub struct I2c<'d, T: Instance, TXDMA = NoDma, RXDMA = NoDma> { /* private fields */ }
Expand description
I2C driver.
Implementations§
source§impl<'d, T: Instance, TXDMA, RXDMA> I2c<'d, T, TXDMA, RXDMA>
impl<'d, T: Instance, TXDMA, RXDMA> I2c<'d, T, TXDMA, RXDMA>
sourcepub fn blocking_write_read(
&mut self,
addr: u8,
write: &[u8],
read: &mut [u8]
) -> Result<(), Error>
pub fn blocking_write_read( &mut self, addr: u8, write: &[u8], read: &mut [u8] ) -> Result<(), Error>
Blocking write, restart, read.
sourcepub async fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Error>where
TXDMA: TxDma<T>,
pub async fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Error>where
TXDMA: TxDma<T>,
Write.
source§impl<'d, T: Instance, TXDMA, RXDMA> I2c<'d, T, TXDMA, RXDMA>
impl<'d, T: Instance, TXDMA, RXDMA> I2c<'d, T, TXDMA, RXDMA>
sourcepub fn new(
peri: impl Peripheral<P = T> + 'd,
scl: impl Peripheral<P = impl SclPin<T>> + 'd,
sda: impl Peripheral<P = impl SdaPin<T>> + 'd,
_irq: impl Binding<T::EventInterrupt, EventInterruptHandler<T>> + Binding<T::ErrorInterrupt, ErrorInterruptHandler<T>> + 'd,
tx_dma: impl Peripheral<P = TXDMA> + 'd,
rx_dma: impl Peripheral<P = RXDMA> + 'd,
freq: Hertz,
config: Config
) -> Self
pub fn new( peri: impl Peripheral<P = T> + 'd, scl: impl Peripheral<P = impl SclPin<T>> + 'd, sda: impl Peripheral<P = impl SdaPin<T>> + 'd, _irq: impl Binding<T::EventInterrupt, EventInterruptHandler<T>> + Binding<T::ErrorInterrupt, ErrorInterruptHandler<T>> + 'd, tx_dma: impl Peripheral<P = TXDMA> + 'd, rx_dma: impl Peripheral<P = RXDMA> + 'd, freq: Hertz, config: Config ) -> Self
Create a new I2C driver.
Trait Implementations§
source§impl<'d, T: Instance> I2c for I2c<'d, T, NoDma, NoDma>
impl<'d, T: Instance> I2c for I2c<'d, T, NoDma, NoDma>
source§fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Self::Error>
Writes bytes to slave with address
address
. Read moresource§impl<'d, T: Instance, TXDMA: TxDma<T>, RXDMA: RxDma<T>> I2c for I2c<'d, T, TXDMA, RXDMA>
impl<'d, T: Instance, TXDMA: TxDma<T>, RXDMA: RxDma<T>> I2c for I2c<'d, T, TXDMA, RXDMA>
source§async fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Self::Error>
async fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Self::Error>
Writes bytes to slave with address
address
. Read moreAuto Trait Implementations§
impl<'d, T, TXDMA, RXDMA> Freeze for I2c<'d, T, TXDMA, RXDMA>
impl<'d, T, TXDMA, RXDMA> RefUnwindSafe for I2c<'d, T, TXDMA, RXDMA>
impl<'d, T, TXDMA, RXDMA> Send for I2c<'d, T, TXDMA, RXDMA>
impl<'d, T, TXDMA, RXDMA> Sync for I2c<'d, T, TXDMA, RXDMA>
impl<'d, T, TXDMA, RXDMA> Unpin for I2c<'d, T, TXDMA, RXDMA>
impl<'d, T, TXDMA = NoDma, RXDMA = NoDma> !UnwindSafe for I2c<'d, T, TXDMA, RXDMA>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more