pub struct I2cSlave<'d, M: Mode> { /* private fields */ }Expand description
I2CSlave driver.
Implementations§
Source§impl<'d, M: Mode> I2cSlave<'d, M>
impl<'d, M: Mode> I2cSlave<'d, M>
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the i2c peripheral. If you cancel a respond_to_read, you may stall the bus. You can recover the bus by calling this function, but doing so will almost certainly cause an i/o error in the master.
Sourcepub fn blocking_listen(&mut self, buffer: &mut [u8]) -> Result<Command, Error>
pub fn blocking_listen(&mut self, buffer: &mut [u8]) -> Result<Command, Error>
Wait for a command from an I2C master, blocking the caller until one arrives.
buffer is provided in case the controller does a ‘write’, ‘write read’, or ‘general
call’, and is unused for ‘read’.
Sourcepub fn blocking_respond_to_read(
&mut self,
buffer: &[u8],
) -> Result<ReadStatus, Error>
pub fn blocking_respond_to_read( &mut self, buffer: &[u8], ) -> Result<ReadStatus, Error>
Respond to an I2C master READ command, blocking the caller until done.
Sourcepub fn blocking_respond_till_stop(&mut self, fill: u8) -> Result<(), Error>
pub fn blocking_respond_till_stop(&mut self, fill: u8) -> Result<(), Error>
Respond to reads with the fill byte until the controller stops asking, blocking the caller.
Sourcepub fn blocking_respond_and_fill(
&mut self,
buffer: &[u8],
fill: u8,
) -> Result<ReadStatus, Error>
pub fn blocking_respond_and_fill( &mut self, buffer: &[u8], fill: u8, ) -> Result<ReadStatus, Error>
Respond to a master read, then fill any remaining read bytes with fill, blocking the caller.
Source§impl<'d> I2cSlave<'d, Async>
impl<'d> I2cSlave<'d, Async>
Sourcepub async fn listen(&mut self, buffer: &mut [u8]) -> Result<Command, Error>
pub async fn listen(&mut self, buffer: &mut [u8]) -> Result<Command, Error>
Wait for a command from an I2C master.
buffer is provided in case the controller does a ‘write’, ‘write read’, or ‘general
call’, and is unused for ‘read’.
Sourcepub async fn respond_to_read(
&mut self,
buffer: &[u8],
) -> Result<ReadStatus, Error>
pub async fn respond_to_read( &mut self, buffer: &[u8], ) -> Result<ReadStatus, Error>
Respond to an I2C master READ command.
Sourcepub async fn respond_till_stop(&mut self, fill: u8) -> Result<(), Error>
pub async fn respond_till_stop(&mut self, fill: u8) -> Result<(), Error>
Respond to reads with the fill byte until the controller stops asking.
Sourcepub async fn respond_and_fill(
&mut self,
buffer: &[u8],
fill: u8,
) -> Result<ReadStatus, Error>
pub async fn respond_and_fill( &mut self, buffer: &[u8], fill: u8, ) -> Result<ReadStatus, Error>
Respond to a master read, then fill any remaining read bytes with fill.