# FT3267 Touch screen driver

This crate is a `no_std` driver the the FT3267 touch screen driver, communicating over I2C. It is base on the [embedded-hal](https://crates.io/crates/embedded-hal) crate.

Ported from https://github.com/mmMicky/TouchLib/blob/main/src/ModulesFT3267.tpp

### [ -> API Documentation](https://antoinezen.codeberg.page/m5dial-bsp/ft3267)

## Quick example

```

let i2c = I2C::new(...);

// Initialize driver
let touch = Ft3267::new(0);
touch.init(&mut $i2c).unwrap();

// Check if screen is touched.
if let Ok(x) = touch.count(&mut i2c) {
    if let Some(_) = x {
        info!("Touch: {}", touch_count);

        // Get the coordinate of the first touch point (not multi-touch)
        if let Ok(p) = touch.get_point(&mut i2c, 0) {
            info!("Pos: x={} y={}", p.x, p.y);
        } else {
            error!("I2C error");
        }
    }
} else {
    error!("I2C error");
}

```
