nrf52840::i2c

Struct TWI

Source
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<'_>

Source

pub const fn new_twi0() -> TWI<'_>

Source

pub const fn new_twi1() -> TWI<'_>

Source

pub fn configure(&self, scl: Pinmux, sda: Pinmux)

Configures an already constructed TWI.

Source

pub fn set_speed(&self, speed: Speed)

Sets the I2C bus speed to one of three possible values enumerated in Speed.

Source

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.

Source

pub fn disable_interrupts(&self)

Source

pub fn handle_interrupt(&self)

Source

pub fn is_enabled(&self) -> bool

Trait Implementations§

Source§

impl<'a> I2CMaster<'a> for TWI<'a>

Source§

fn set_master_client(&self, client: &'a dyn I2CHwMasterClient)

Source§

fn enable(&self)

Source§

fn disable(&self)

Source§

fn write_read( &self, addr: u8, data: &'static mut [u8], write_len: usize, read_len: usize, ) -> Result<(), (Error, &'static mut [u8])>

Source§

fn write( &self, addr: u8, data: &'static mut [u8], len: usize, ) -> Result<(), (Error, &'static mut [u8])>

Source§

fn read( &self, addr: u8, buffer: &'static mut [u8], len: usize, ) -> Result<(), (Error, &'static mut [u8])>

Source§

impl<'a> I2CSlave<'a> for TWI<'a>

Source§

fn set_slave_client(&self, client: &'a dyn I2CHwSlaveClient)

Source§

fn enable(&self)

Source§

fn disable(&self)

Source§

fn set_address(&self, addr: u8) -> Result<(), Error>

Source§

fn write_receive( &self, data: &'static mut [u8], max_len: usize, ) -> Result<(), (Error, &'static mut [u8])>

Source§

fn read_send( &self, data: &'static mut [u8], max_len: usize, ) -> Result<(), (Error, &'static mut [u8])>

Source§

fn listen(&self)

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.