11#pragma once
22
33#include " input/InputDriver.h"
4+ #include < list>
5+ #include < memory>
6+ #include < string>
47
58class I2CKeyboardInputDriver : public InputDriver
69{
710 public:
811 I2CKeyboardInputDriver (void );
912 virtual void init (void ) override ;
10- virtual void task_handler (void ) override ;
11- virtual ~I2CKeyboardInputDriver (void );
13+ virtual void task_handler (void ) override {};
14+ virtual void readKeyboard (uint8_t address, lv_indev_t *indev, lv_indev_data_t *data) = 0;
15+ virtual ~I2CKeyboardInputDriver (void ) {}
16+
17+ struct KeyboardDefinition {
18+ I2CKeyboardInputDriver *driver; // Pointer to the driver instance
19+ std::string name; // Name of the keyboard
20+ uint8_t address; // I2C address of the keyboard
21+ };
22+
23+ using KeyboardList = std::list<std::unique_ptr<KeyboardDefinition>>;
24+ static KeyboardList &getI2CKeyboardList (void ) { return i2cKeyboardList; }
25+
26+ protected:
27+ bool registerI2CKeyboard (I2CKeyboardInputDriver *driver, std::string name, uint8_t address);
1228
1329 private:
1430 static void keyboard_read (lv_indev_t *indev, lv_indev_data_t *data);
15- };
31+
32+ static KeyboardList i2cKeyboardList; // list of registered I2C keyboards
33+ };
34+
35+ class TDeckKeyboardInputDriver : public I2CKeyboardInputDriver
36+ {
37+ public:
38+ TDeckKeyboardInputDriver (uint8_t address);
39+ void readKeyboard (uint8_t address, lv_indev_t *indev, lv_indev_data_t *data) override ;
40+ virtual ~TDeckKeyboardInputDriver (void ) {}
41+ };
42+
43+ class TCA8418KeyboardInputDriver : public I2CKeyboardInputDriver
44+ {
45+ public:
46+ TCA8418KeyboardInputDriver (uint8_t address);
47+ void init (void ) override ;
48+ void readKeyboard (uint8_t address, lv_indev_t *indev, lv_indev_data_t *data) override ;
49+ virtual ~TCA8418KeyboardInputDriver (void ) {}
50+ };
51+
52+ class TLoraPagerKeyboardInputDriver : public TCA8418KeyboardInputDriver
53+ {
54+ public:
55+ TLoraPagerKeyboardInputDriver (uint8_t address);
56+ void init (void ) override ;
57+ void readKeyboard (uint8_t address, lv_indev_t *indev, lv_indev_data_t *data) override ;
58+ virtual ~TLoraPagerKeyboardInputDriver (void ) {}
59+ };
60+
61+ class TDeckProKeyboardInputDriver : public TCA8418KeyboardInputDriver
62+ {
63+ public:
64+ TDeckProKeyboardInputDriver (uint8_t address);
65+ void init (void ) override ;
66+ void readKeyboard (uint8_t address, lv_indev_t *indev, lv_indev_data_t *data) override ;
67+ virtual ~TDeckProKeyboardInputDriver (void ) {}
68+ };
69+
70+ class BBQ10KeyboardInputDriver : public I2CKeyboardInputDriver
71+ {
72+ public:
73+ BBQ10KeyboardInputDriver (uint8_t address);
74+ void init (void ) override ;
75+ void readKeyboard (uint8_t address, lv_indev_t *indev, lv_indev_data_t *data) override ;
76+ virtual ~BBQ10KeyboardInputDriver (void ) {}
77+ };
78+
79+ class CardKBInputDriver : public I2CKeyboardInputDriver
80+ {
81+ public:
82+ CardKBInputDriver (uint8_t address);
83+ void readKeyboard (uint8_t address, lv_indev_t *indev, lv_indev_data_t *data) override ;
84+ virtual ~CardKBInputDriver (void ) {}
85+ };
86+
87+ class MPR121KeyboardInputDriver : public I2CKeyboardInputDriver
88+ {
89+ public:
90+ MPR121KeyboardInputDriver (uint8_t address);
91+ void init (void ) override ;
92+ void readKeyboard (uint8_t address, lv_indev_t *indev, lv_indev_data_t *data) override ;
93+ virtual ~MPR121KeyboardInputDriver (void ) {}
94+ };
0 commit comments