Skip to content

Commit d927e83

Browse files
committed
Implement TCA8418 keyboard driver for T-Deck Pro E-Paper
Add complete keyboard support for the LilyGo T-Deck Pro E-Paper board using the Adafruit TCA8418 library. Features implemented: - Full QWERTY keyboard layout (4 rows × 10 columns, 40 keys) - Three keyboard layers: Normal, Shift, and Fn - Modifier key support: Fn, Shift, Caps Lock - Special key combinations (Fn + Shift = Caps Lock toggle) - Key event handling with proper press/release detection - Keyboard LED feedback on key presses - Debouncing for stable input - Integration with Bruce's KeyStroke API Keyboard layout: - Normal: Standard QWERTY letters and basic punctuation - Shift: Uppercase letters and symbols (!, @, #, etc.) - Fn: Numbers (0-9) and extended symbols ([], (), etc.) Technical changes: - Added Adafruit_TCA8418 library dependency - Implemented getKeyChar() for multi-layer key mapping - Implemented handleSpecialKeys() for modifier key logic - Updated InputHandler() to prioritize keyboard over touch - Added keyboard initialization in _setup_gpio() - Documented complete keyboard layout in README The keyboard is now fully functional and ready for use.
1 parent a5ae0a4 commit d927e83

File tree

3 files changed

+249
-95
lines changed

3 files changed

+249
-95
lines changed

boards/lilygo-t-deck-pro-epaper/README.md

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,39 @@ This board configuration is experimental and has significant limitations due to
6262
- **Power Control**: GPIO 10
6363
- **Battery ADC**: GPIO 4
6464

65+
## Keyboard Layout
66+
67+
The T-Deck Pro features a 40-key QWERTY keyboard (4 rows × 10 columns) with three layers:
68+
69+
### Normal Layer (Default)
70+
```
71+
Row 0: q w e r t y u i o p
72+
Row 1: a s d f g h j k l ↵
73+
Row 2: Fn z x c v b n m ⇧ ⌫
74+
Row 3: [ Space Bar ] , . /
75+
```
76+
77+
### Shift Layer (Hold Shift)
78+
```
79+
Row 0: Q W E R T Y U I O P
80+
Row 1: A S D F G H J K L ↵
81+
Row 2: Fn Z X C V B N M ⇧ ⌫
82+
Row 3: [ Space Bar ] < > ?
83+
```
84+
85+
### Fn Layer (Hold Fn)
86+
```
87+
Row 0: 1 2 3 4 5 6 7 8 9 0
88+
Row 1: ! @ # $ % ^ & * ( )
89+
Row 2: Fn - _ = + [ ] ; ⇪ ⌫
90+
Row 3: [ Space Bar ] , . /
91+
```
92+
93+
**Special Key Combinations:**
94+
- **Fn + Shift** = Toggle Caps Lock (⇪)
95+
- **Caps Lock** affects letter keys only (numbers/symbols unaffected)
96+
- **Keyboard LED** provides visual feedback on key presses
97+
6598
## Known Limitations
6699

67100
### E-Paper Display Limitations
@@ -86,23 +119,28 @@ This board configuration is experimental and has significant limitations due to
86119
### Current Implementation Status
87120

88121
**Working:**
89-
- Touch input (CST328)
122+
- Touch input (CST328 capacitive touchscreen)
123+
- **Keyboard input (TCA8418 QWERTY keyboard) - NEW!**
124+
- Full QWERTY layout with 40 keys
125+
- Fn, Shift, and Caps Lock support
126+
- Key event handling with LED feedback
127+
- Debouncing and proper key press/release detection
90128
- Basic GPIO setup
91129
- Power management
92130
- SD Card support
93-
- LoRa module support
131+
- LoRa module support (SX1262)
94132

95133
⚠️ **Partially Working:**
96134
- Display output (using TFT_eSPI with ST7789 driver as placeholder)
97135
- **CRITICAL**: E-Paper requires GxEPD2 library, not TFT_eSPI
98136
- Current config will NOT work correctly with E-Paper
99137
- This is a temporary workaround for compilation
138+
- Battery monitoring (basic ADC reading, needs BQ27220 integration)
100139

101140
**Not Implemented:**
102-
- Keyboard input (TCA8418 needs proper driver library)
103141
- 4G Modem (A7682E not supported in Bruce)
104142
- Gyroscope (BHI260AP not used in Bruce)
105-
- Battery fuel gauge (BQ27220 reading)
143+
- Battery fuel gauge (BQ27220 precise reading)
106144
- Charger status (BQ25896 reading)
107145

108146
## Required Changes for Full E-Paper Support
@@ -120,12 +158,7 @@ To properly support the E-Paper display, the following major changes are needed:
120158
- Use partial refreshes where possible
121159
- Convert color schemes to high-contrast B&W
122160

123-
3. **Add TCA8418 Keyboard Driver**
124-
- Implement full TCA8418 driver or add library dependency
125-
- Map keyboard matrix to ASCII codes
126-
- Handle function keys and modifiers
127-
128-
4. **Add Battery Management**
161+
3. **Add Battery Management****Keyboard Driver Complete!**
129162
- Implement BQ27220 fuel gauge reading
130163
- Implement BQ25896 charger status
131164
- Proper battery percentage calculation

0 commit comments

Comments
 (0)