pub struct I2c<'d, M: Mode> { /* private fields */ }Expand description
I2C Target Driver.
Implementations§
Source§impl<'d, M: Mode> I2c<'d, M>
impl<'d, M: Mode> I2c<'d, M>
Sourcepub fn blocking_listen(&mut self) -> Result<Request, IOError>
pub fn blocking_listen(&mut self) -> Result<Request, IOError>
Block waiting for new events
Source§impl<'d> I2c<'d, Async>
impl<'d> I2c<'d, Async>
Sourcepub fn new_async<T: Instance>(
peri: Peri<'d, T>,
scl: Peri<'d, impl SclPin<T>>,
sda: Peri<'d, impl SdaPin<T>>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
config: Config,
) -> Result<Self, SetupError>
pub fn new_async<T: Instance>( peri: Peri<'d, T>, scl: Peri<'d, impl SclPin<T>>, sda: Peri<'d, impl SdaPin<T>>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, config: Config, ) -> Result<Self, SetupError>
Create a new blocking instance of the I2C Target bus driver.
Any external pin will be placed into Disabled state upon Drop.
Source§impl<'d> I2c<'d, Dma<'d>>
impl<'d> I2c<'d, Dma<'d>>
Sourcepub fn new_async_with_dma<T: Instance>(
peri: Peri<'d, T>,
scl: Peri<'d, impl SclPin<T>>,
sda: Peri<'d, impl SdaPin<T>>,
tx_dma: Peri<'d, impl TxDma<T>>,
rx_dma: Peri<'d, impl RxDma<T>>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
config: Config,
) -> Result<Self, SetupError>
pub fn new_async_with_dma<T: Instance>( peri: Peri<'d, T>, scl: Peri<'d, impl SclPin<T>>, sda: Peri<'d, impl SdaPin<T>>, tx_dma: Peri<'d, impl TxDma<T>>, rx_dma: Peri<'d, impl RxDma<T>>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, config: Config, ) -> Result<Self, SetupError>
Create a new async instance of the I2C Controller bus driver with DMA support.
Any external pin will be placed into Disabled state upon Drop, additionally, the DMA channel is disabled.
Source§impl<'d, M: AsyncMode> I2c<'d, M>where
Self: AsyncEngine,
impl<'d, M: AsyncMode> I2c<'d, M>where
Self: AsyncEngine,
Sourcepub async fn async_listen(&mut self) -> Result<Request, IOError>
pub async fn async_listen(&mut self) -> Result<Request, IOError>
Asynchronously wait for new events
Sourcepub fn async_respond_to_read<'a>(
&'a mut self,
buf: &'a [u8],
) -> impl Future<Output = Result<usize, IOError>> + 'a
pub fn async_respond_to_read<'a>( &'a mut self, buf: &'a [u8], ) -> impl Future<Output = Result<usize, IOError>> + 'a
Asynchronously transmit the contents of buf to the I2C
controller.
Returns either an Ok(usize) containing the number of bytes
transmitted, or an Error.
Sourcepub fn async_respond_to_write<'a>(
&'a mut self,
buf: &'a mut [u8],
) -> impl Future<Output = Result<usize, IOError>> + 'a
pub fn async_respond_to_write<'a>( &'a mut self, buf: &'a mut [u8], ) -> impl Future<Output = Result<usize, IOError>> + 'a
Asynchronously receive data from the I2C controller into
buf.
Care is taken to guarantee that we receive at most buf.len()
bytes. On success returns Ok(usize) containing the number of
bytes received or an Error.
Trait Implementations§
Auto Trait Implementations§
impl<'d, M> Freeze for I2c<'d, M>where
M: Freeze,
impl<'d, M> !RefUnwindSafe for I2c<'d, M>
impl<'d, M> Send for I2c<'d, M>where
M: Send,
impl<'d, M> Sync for I2c<'d, M>where
M: Sync,
impl<'d, M> Unpin for I2c<'d, M>where
M: Unpin,
impl<'d, M> !UnwindSafe for I2c<'d, M>
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