firmware/src/input/TCA8418Keyboard.h
WillyJL 4816f45552
TCA8418: N-key rollover, simplify code greatly
- Pass key parameter to release(), allows tracking multiple held keys
- Move KeyState enum and member out of TCA8418KeyboardBase class
- Process all FIFO events in trigger(), remove overrides of trigger()
- Remove all unused/unrelated code from TDeckPro/TLoraPager Keyboard
- TDeckPro/TLoraPager Keyboard track held keys individually, can press
  multiple keys together and they are registered in order of release,
  helps greatly with typing fast registering inputs correctly
- TDeckPro/TLoraPager Keyboard modifiers persist while held, even if a
  non-modifier key is pressed, like you would expect from a keyboard
- Keep TCA8418Keyboard (multitap) handling one key at a time, wouldn't
  make much sense to handle multiple held keys on a multitap keyboard
- Make event maps const so they do not take up RAM
2025-09-15 02:30:22 +02:00

26 lines
532 B
C++

#include "TCA8418KeyboardBase.h"
/**
* @brief 3x4 keypad with 3 columns and 4 rows
*/
class TCA8418Keyboard : public TCA8418KeyboardBase
{
public:
TCA8418Keyboard();
void reset(void) override;
void setBacklight(bool on) override;
protected:
enum KeyState { Init, Idle, Held, Busy };
void pressed(uint8_t key) override;
void released(uint8_t key) override;
KeyState state;
int8_t last_key;
uint32_t last_tap;
uint8_t char_idx;
int32_t tap_interval;
bool should_backspace;
};