Ken Van Hoeylandt 9f721e6655
Refactor LVGL code into kernel module (#472)
* **New Features**
  * Added a standalone LVGL module and enabled LVGL support in the simulator for richer local UI testing.

* **Refactor**
  * HAL and LVGL split into distinct modules; startup and device attach/detach flows reorganized for clearer lifecycle management.
  * Public APIs tightened with clearer nullability/documentation.

* **Bug Fixes**
  * More consistent LVGL start/stop and device attach/detach behavior for improved stability.
2026-02-01 22:57:45 +01:00

47 lines
1.2 KiB
C++

#pragma once
#include <Tactility/hal/keyboard/KeyboardDevice.h>
#include <Tca8418.h>
#include <Tactility/Timer.h>
#include <freertos/queue.h>
class CardputerKeyboard final : public tt::hal::keyboard::KeyboardDevice {
lv_indev_t* kbHandle = nullptr;
QueueHandle_t queue = nullptr;
std::shared_ptr<Tca8418> keypad;
std::unique_ptr<tt::Timer> inputTimer;
void processKeyboard();
static void readCallback(lv_indev_t* indev, lv_indev_data_t* data);
/**
* Remaps wiring coordinates to keyboard mapping coordinates.
* Wiring is 7x8 (rows & colums), but our keyboard definition is 4x14)
*/
static void remap(uint8_t& row, uint8_t& column);
public:
explicit CardputerKeyboard(const std::shared_ptr<Tca8418>& tca) : keypad(tca) {
queue = xQueueCreate(20, sizeof(char));
}
~CardputerKeyboard() override {
vQueueDelete(queue);
}
std::string getName() const override { return "TCA8418"; }
std::string getDescription() const override { return "TCA8418 I2C keyboard"; }
bool startLvgl(lv_display_t* display) override;
bool stopLvgl() override;
bool isAttached() const override;
lv_indev_t* getLvglIndev() override { return kbHandle; }
};