#embedded-hal-driver #embedded-hal #port #expander #io #tested #tca9555-tca9535

tca9555

Embedded-HAL driver crate for the TCA9555/TCA9535 16 port I/O expander

1 unstable release

0.1.0 Jul 17, 2022

#1670 in Hardware support

MPL-2.0 license

9KB
120 lines

tca9555

Embedded-HAL driver crate for the TCA9555/TCA9535 16 port I/O expander.

This crate currently only implements byte-oriented operations - pin operations will be part of a future update.

Read operations have been tested. Write operations have been implemented but not tested.

Examples

There is an example application provided for the Raspberry Pi Pico, developed for the Pimoroni "PIM551" keypad module.

let mut tca = Tca9555::new(i2c, tca9555::DeviceAddr::default());
let inputs: u16 = tca.read_all().unwrap();

License

This crate is distributed under the terms of the Mozilla Public License Version 2.0.


lib.rs:

Driver for the TCA9555/TCA9535 16-port I/O expander.

This crate currently only has byte-oriented operation implemented. Individual control of pins will be the subject of a future release.

Example

use embedded_hal::blocking::i2c::WriteRead;
use tca9555::{Tca9555, DeviceAddr};
fn read_ports<E>(i2c: impl WriteRead<Error = E>) -> Result<(), E> {
    let mut tca = Tca9555::new(i2c, DeviceAddr::default());
    let port0: u8 = tca.read_port_0()?;
    let port1: u8 = tca.read_port_1()?;
    let all_inputs: u16 = tca.read_all()?;
    Ok(())
}

Dependencies

~235KB