pub struct Tca8418<I2C> { /* private fields */ }Expand description
TCA8418 driver.
Implementations§
Source§impl<I2C: I2c> Tca8418<I2C>
impl<I2C: I2c> Tca8418<I2C>
Sourcepub const fn new(i2c: I2C, addr: u8) -> Self
pub const fn new(i2c: I2C, addr: u8) -> Self
Wraps a bus handle. No I/O happens until configure.
Sourcepub async fn configure(&mut self, matrix: Matrix) -> Result<(), I2C::Error>
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.
Sourcepub async fn pending(&mut self) -> Result<u8, I2C::Error>
pub async fn pending(&mut self) -> Result<u8, I2C::Error>
Number of events waiting in the FIFO.
Sourcepub async fn drain<'b>(
&mut self,
buf: &'b mut [u8; 10],
) -> Result<&'b [u8], I2C::Error>
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.
Sourcepub async fn clear_interrupts(&mut self) -> Result<(), I2C::Error>
pub async fn clear_interrupts(&mut self) -> Result<(), I2C::Error>
Acknowledges all interrupt sources, releasing INT if the FIFO is empty.