In development. It changes without notice.
Topic
Touch Controller Drivers
The FT6x36 and GT911 touch controllers.
- Ft6x36: Core2 v1.3 and CoreS3 SE.
- Gt911: LILYGO T-Deck. The chip takes one of two addresses when its supply comes up, and the driver looks at both. It also puts the controller to sleep and wakes it.
They return the controller's own coordinates. What a point means is decided in Input Sources & the Wake Rule.
Files | |
| file | src/ |
| FocalTech FT6x36 capacitive touch controller driver. | |
| file | src/ |
| FocalTech FT6x36 touch controller register map (Kleidos subset). | |
| file | src/ |
| Goodix GT911 capacitive touch controller driver. | |
| file | src/ |
| Goodix GT911 touch controller register map, addresses and INT-line timings (Kleidos subset). | |
| file | src/ |
| Chip-level capacitive-touch driver contract. | |
| file | src/ |
| Touch controller factory — probes the bus for a supported controller. | |
Classes | |
| class | kleidos:: |
| FT6206/ | |
| class | kleidos:: |
| GT911 touch driver (LILYGO T-Deck). More about kleidos:: | |
| struct | kleidos:: |
| The primary contact a touch controller reports, in its raw coordinates. More about kleidos:: | |
| class | kleidos:: |
| The contract every capacitive-touch chip driver implements. More about kleidos:: | |
Functions | |
| constexpr std::array< uint8_t, kAddressCount > | kleidos:: |
| The order to probe the two addresses in. | |
| constexpr bool | kleidos:: |
| Whether a product-id block read back is a GT9xx controller's. | |
| constexpr bool | kleidos:: |
| Whether a remembered address is one this controller can answer at. | |
| ITouch * | kleidos:: |
| Probes the touch controller at address, returning a ready singleton driver for the detected chip, or nullptr if absent/ | |
Variables | |
| constexpr uint8_t | kleidos:: |
| Number of touch points (low nibble). | |
| constexpr uint8_t | kleidos:: |
| First contact: Xh, Xl, Yh, Yl. | |
| constexpr uint8_t | kleidos:: |
| Mask for the active-point count (low nibble of 0x02). | |
| constexpr uint8_t | kleidos:: |
| Mask for the high nibble of each Xh/Yh byte. | |
| constexpr uint8_t | kleidos:: |
| Upper bound on points the driver decodes per read. | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| No address has answered yet. | |
| constexpr uint16_t | kleidos:: |
| Real-time command register. | |
| constexpr uint16_t | kleidos:: |
| Buffer status / touch count. | |
| constexpr uint16_t | kleidos:: |
| First contact: Xl, Xh, Yl, Yh, Sl, Sh. | |
| constexpr uint16_t | kleidos:: |
| Product ID ("911\0"). | |
| constexpr uint16_t | kleidos:: |
| X_OUTPUT_MAX (config block, little-endian). | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| Set when a fresh frame is ready. | |
| constexpr uint8_t | kleidos:: |
| Number of active contacts. | |
| constexpr uint8_t | kleidos:: |
| X(2) + Y(2) + Size(2). | |
| constexpr uint8_t | kleidos:: |
| X_MAX(2) + Y_MAX(2). | |
| constexpr uint16_t | kleidos:: |
| Sanity bound for config values. | |
| constexpr uint16_t | kleidos:: |
| Native panel resolution fall-back when the config block cannot be read. | |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| Gap between two probes while a woken controller is awaited. | |
| constexpr size_t | kleidos:: |
| Number of addresses a probe tries. | |
Function Documentation
createTouch() #
Probes the touch controller at address, returning a ready singleton driver for the detected chip, or nullptr if absent/
The one family it knows is the FocalTech FT6x36. begin() is idempotent, so the caller may invoke createTouch() repeatedly to retry a controller that was not ready at boot.
- Parameters
-
Name Direction Meaning address in I2C address of the touch controller.
- Returns
- Pointer to the singleton driver, or nullptr.
isControllerAddress() #
Whether a remembered address is one this controller can answer at.
- Parameters
-
Name Direction Meaning address in A 7-bit address read back from memory that survives a reset, so it may hold anything.
- Return values
-
Value Meaning true 0x5D or 0x14. false Anything else.
isGt9xxProductId() #
Whether a product-id block read back is a GT9xx controller's.
- Parameters
-
Name Direction Meaning id in The block read at kRegProductId.
- Return values
-
Value Meaning true It starts with kProductIdFamily.false It does not (zeros, or another device at the address).
probeOrder() #
The order to probe the two addresses in.
The address that answered last first, so a controller that keeps its address (every boot but a power-up of its supply) costs one transaction; the low address first when none has answered, as the vendor's library does.
- Parameters
-
Name Direction Meaning lastAnswered in The address that answered last, or kNoAddress.
- Returns
- Both addresses, the one to try first at index 0.
Variable Documentation
kCommandScreenOff #
Command value that puts the controller into Sleep ("screen off"); the datasheet requires INT driven low before it is written.
kI2cAddressHigh #
7-bit address 0x14 (0x28/0x29 on the wire): latched when INT is high as the controller leaves reset.
kI2cAddressLow #
7-bit address 0x5D (0xBA/0xBB on the wire): latched when INT is low as the controller leaves reset.
kProductIdFamily #
First character of every product id of the GT9xx family ("911" here). A probe accepts an address only when the id it reads starts with it, so an acknowledge that returns no id is not taken for an awake controller.
kSleepIntLeadMs #
How long INT is held low before the screen-off command is written (the datasheet asks only for INT low first).
kSleepToWakeMinMs #
Shortest gap between the screen-off command and a wake pulse (the datasheet asks for more than 58 ms).
kWakeAnswerBudgetMs #
Longest a woken controller is given to answer its address: twice the datasheet's response time out of Sleep (under 200 ms), so a slow part is not given up on at the edge of its specification.
kWakePulseMs #
How long INT is held high to wake the controller from Sleep: inside the datasheet's 2 to 5 ms window, away from both ends.