gt9x/
lib.rs

1//! # GT9x Touch Screen Controller Driver
2//!
3//! This crate provides a `no_std` driver for the GT9x series of capacitive touch screen controllers.
4//! It supports both asynchronous and blocking I2C communication.
5//!
6//! ## Supported Chips
7//!
8//! - GT911 (5 points)
9//! - GT928 (10 points)
10//! - GT9147 (5 points)
11//!
12//! ## Features
13//!
14//! - `async`: Enables the asynchronous driver based on `embedded-hal-async`. This is a default feature.
15//! - `blocking`: Enables the blocking driver based on `embedded-hal`.
16//! - `defmt`: Enables logging with `defmt`.
17//!
18//! ## Usage
19//!
20//! ### Asynchronous Driver
21//!
22//! ```no_run
23//! use gt9x::{Gt911, Gt9x};
24//! # use embedded_hal_async::i2c::I2c;
25//! # use embedded_hal_async::digital::Wait;
26//!
27//! // let i2c: I2c = ...;
28//! // let mut int_pin: Wait = ...;
29//! // let mut buf = [0u8; 64];
30//!
31//! // Without interrupt pin
32//! // let mut gt9x = Gt9x::<Gt911, _, _, _>::new(i2c, &mut buf);
33//!
34//! // With interrupt pin
35//! // let mut gt9x_int = Gt9x::<Gt911, _, _, _>::new_int(i2c, &mut buf, int_pin);
36//! ```
37//!
38//! ### Blocking Driver
39//!
40//! ```no_run
41//! use gt9x::{Gt911, Gt9xBlocking};
42//! # use embedded_hal::i2c::I2c;
43//!
44//! // let i2c: I2c = ...;
45//! // let mut buf = [0u8; 64];
46//!
47//! // let mut gt9x = Gt9xBlocking::<Gt911, _>::new(i2c, &mut buf);
48//! ```
49#![no_std]
50#![allow(incomplete_features)]
51#![feature(generic_const_exprs)]
52
53/// Asynchronous driver implementation
54#[cfg(feature = "async")]
55pub mod asynchronous;
56/// Blocking driver implementation
57#[cfg(feature = "blocking")]
58pub mod blocking;
59mod chip;
60mod reg;
61
62pub use chip::*;
63
64#[cfg(feature = "async")]
65pub use asynchronous::{CacheMaintenance, Gt9x, IntPin, NoIntPin};
66
67#[cfg(feature = "blocking")]
68pub use blocking::Gt9x as Gt9xBlocking;