ft6336u
FocalTech FT6336U — self-capacitive touch-panel controller.
The touch panel on the M5Stack Core2, at I2C [ADDR]. Layer 3: it knows the
part, not the chip or board driving it, and talks through a [BusHandle] —
the same shape as the IMU and PMIC drivers, and on the Core2 it shares the
internal I2C0 bus with both.
What it reports
Section titled “What it reports”Up to two simultaneous touch points. Each point is an (x, y) coordinate, a
touch id, and an [Event] (down, contact, up). This driver reads the first
point, which is what a single-touch UI needs; the register layout for the
second is identical eight bytes further on if that is ever wanted.
Coordinates are the panel’s raw counts. On the Core2 the panel is 320×240 with a taller touch area (the three capacitive buttons below the screen), so y runs past 240; the mapping to screen pixels is a board/app concern, not this driver’s — it reports what the controller measured.
Register facts
Section titled “Register facts”From FocalTech’s register map (the FT6x36 family): the touch count is the
low nibble of TD_STATUS, and each point packs its high coordinate bits and
flags into the same bytes as the coordinate — x’s event flag in the top two
bits of P1_XH, the touch id in the top nibble of P1_YH. Presence is
checked against the vendor id register (0x11, FocalTech), which is stable
across the family, rather than the chip-id, which is not.
Structs
Section titled “Structs”Ft6336u
Section titled “Ft6336u”struct Ft6336u<'a> { /* private fields */ }An FT6336U on a bus already addressed to [ADDR].
struct Touch { pub x: u16, pub y: u16, pub id: u8, pub event: Event,}One touch point.
Implements: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq
References: Event
enum Event { Down, Up, Contact, None,}What a touch point is doing.
Implements: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq
Constants
Section titled “Constants”const ADDR: u8;I2C address of the FT6336U. Fixed in the part.
FOCALTECH_ID
Section titled “FOCALTECH_ID”const FOCALTECH_ID: u8;The FocalTech vendor id FOCALTECH_ID reads back.