pub struct TWI<'a> { /* private fields */ }
Expand description
An I2C master device.
A TWI
instance wraps a registers::TWI
together with
additional data necessary to implement an asynchronous interface.
Implementations§
Source§impl TWI<'_>
impl TWI<'_>
pub const fn new_twi0() -> TWI<'_>
pub const fn new_twi1() -> TWI<'_>
Sourcepub fn set_speed(&self, speed: Speed)
pub fn set_speed(&self, speed: Speed)
Sets the I2C bus speed to one of three possible values
enumerated in Speed
.
Sourcepub fn clear_events(&self)
pub fn clear_events(&self)
Clear all pending events This is useful when switching between a master and slave mode to ensure we start from a clean state.
pub fn disable_interrupts(&self)
pub fn handle_interrupt(&self)
pub fn is_enabled(&self) -> bool
Trait Implementations§
Source§impl<'a> I2CMaster<'a> for TWI<'a>
impl<'a> I2CMaster<'a> for TWI<'a>
fn set_master_client(&self, client: &'a dyn I2CHwMasterClient)
fn enable(&self)
fn disable(&self)
fn write_read( &self, addr: u8, data: &'static mut [u8], write_len: usize, read_len: usize, ) -> Result<(), (Error, &'static mut [u8])>
fn write( &self, addr: u8, data: &'static mut [u8], len: usize, ) -> Result<(), (Error, &'static mut [u8])>
fn read( &self, addr: u8, buffer: &'static mut [u8], len: usize, ) -> Result<(), (Error, &'static mut [u8])>
Source§impl<'a> I2CSlave<'a> for TWI<'a>
impl<'a> I2CSlave<'a> for TWI<'a>
fn set_slave_client(&self, client: &'a dyn I2CHwSlaveClient)
fn enable(&self)
fn disable(&self)
fn set_address(&self, addr: u8) -> Result<(), Error>
fn write_receive( &self, data: &'static mut [u8], max_len: usize, ) -> Result<(), (Error, &'static mut [u8])>
fn read_send( &self, data: &'static mut [u8], max_len: usize, ) -> Result<(), (Error, &'static mut [u8])>
fn listen(&self)
impl<'a> I2CMasterSlave<'a> for TWI<'a>
Auto Trait Implementations§
impl<'a> !Freeze for TWI<'a>
impl<'a> !RefUnwindSafe for TWI<'a>
impl<'a> !Send for TWI<'a>
impl<'a> !Sync for TWI<'a>
impl<'a> Unpin for TWI<'a>
impl<'a> !UnwindSafe for TWI<'a>
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