1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! # Hynitron CST820 touch controller driver
//!
//! > A platform-agnostic driver to interface with the Hynitron CST820 touch controller.
//!
//! This driver was built using [`embedded-hal`] 1.0 and [`cst820-registers`]. Enable the
//! `async` feature for an equivalent driver on [`embedded-hal-async`] in the `asynch` module.
//!
//! ## Standby
//!
//! The chip enters standby after [`registers::AutoSleepTime`] seconds
//! (default: 2) without touch, and then does not acknowledge on the bus until touched.
//! Read the chip after its interrupt fires, or disable auto-sleep with
//! [`Cst820::set_auto_sleep`] right after reset.
//!
//! ## Limitations
//!
//! The CST820 supports two-point touch, but the register layout of the second point is
//! undocumented. Only the first point is reported.
//!
//! [`embedded-hal`]: https://crates.io/crates/embedded-hal
//! [`embedded-hal-async`]: https://crates.io/crates/embedded-hal-async
//! [`cst820-registers`]: https://crates.io/crates/cst820-registers
// Enables the `doc_cfg` feature when the `docsrs` configuration attribute is defined.
pub use cst820_registers as registers;
pub use ;
pub use Touch;
/// How long `RST` is held low during [`reset`], in microseconds.
///
/// The datasheet requires at least 0.1 ms; 1 ms adds margin.
pub const RESET_PULSE_US: u32 = 1_000;
/// How long to wait after releasing `RST` before talking to the chip, in milliseconds.
///
/// The datasheet requires at least 100 ms (`Tron`).
pub const BOOT_DELAY_MS: u32 = 100;
driver!;