Skip to main content

Tca8418

Struct Tca8418 

Source
pub struct Tca8418<I2C> { /* private fields */ }
Expand description

TCA8418 driver.

Implementations§

Source§

impl<I2C: I2c> Tca8418<I2C>

Source

pub const fn new(i2c: I2C, addr: u8) -> Self

Wraps a bus handle. No I/O happens until configure.

Source

pub async fn configure(&mut self, matrix: Matrix) -> Result<(), I2C::Error>

Puts matrix into keypad mode, discards stale events, and enables the key-event interrupt.

Source

pub async fn pending(&mut self) -> Result<u8, I2C::Error>

Number of events waiting in the FIFO.

Source

pub async fn drain<'b>( &mut self, buf: &'b mut [u8; 10], ) -> Result<&'b [u8], I2C::Error>

Pops every pending event into buf and returns the filled prefix. Feed each byte to Event::decode.

Source

pub async fn clear_interrupts(&mut self) -> Result<(), I2C::Error>

Acknowledges all interrupt sources, releasing INT if the FIFO is empty.

Source

pub fn release(self) -> I2C

Returns the bus handle.

Auto Trait Implementations§

§

impl<I2C> Freeze for Tca8418<I2C>
where I2C: Freeze,

§

impl<I2C> RefUnwindSafe for Tca8418<I2C>
where I2C: RefUnwindSafe,

§

impl<I2C> Send for Tca8418<I2C>
where I2C: Send,

§

impl<I2C> Sync for Tca8418<I2C>
where I2C: Sync,

§

impl<I2C> Unpin for Tca8418<I2C>
where I2C: Unpin,

§

impl<I2C> UnsafeUnpin for Tca8418<I2C>
where I2C: UnsafeUnpin,

§

impl<I2C> UnwindSafe for Tca8418<I2C>
where I2C: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.