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.
This commit is contained in:
Ken Van Hoeylandt
2026-02-01 22:57:45 +01:00
committed by GitHub
parent 3fe1dc0312
commit 9f721e6655
135 changed files with 1553 additions and 667 deletions
@@ -99,7 +99,7 @@ bool Hx8357Display::stopLvgl() {
return true;
}
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable Hx8357Display::getTouchDevice() {
std::shared_ptr<tt::hal::touch::TouchDevice> Hx8357Display::getTouchDevice() {
if (touchDevice == nullptr) {
touchDevice = std::reinterpret_pointer_cast<tt::hal::touch::TouchDevice>(createTouch());
LOGGER.info("Created touch device");
@@ -21,10 +21,10 @@
class Hx8357Display : public tt::hal::display::DisplayDevice {
uint8_t* _Nullable buffer = nullptr;
lv_display_t* _Nullable lvglDisplay = nullptr;
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable touchDevice;
std::shared_ptr<tt::hal::display::DisplayDriver> _Nullable nativeDisplay;
uint8_t* buffer = nullptr;
lv_display_t* lvglDisplay = nullptr;
std::shared_ptr<tt::hal::touch::TouchDevice> touchDevice;
std::shared_ptr<tt::hal::display::DisplayDriver> nativeDisplay;
class Hx8357Driver : public tt::hal::display::DisplayDriver {
std::shared_ptr<tt::Lock> lock = tt::hal::spi::getLock(SPI2_HOST);
@@ -51,14 +51,14 @@ public:
bool stopLvgl() override;
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable getTouchDevice() override;
std::shared_ptr<tt::hal::touch::TouchDevice> getTouchDevice() override;
lv_display_t* _Nullable getLvglDisplay() const override { return lvglDisplay; }
lv_display_t* getLvglDisplay() const override { return lvglDisplay; }
// TODO: Set to true after fixing UnPhoneDisplayDriver
bool supportsDisplayDriver() const override { return false; }
std::shared_ptr<tt::hal::display::DisplayDriver> _Nullable getDisplayDriver() override {
std::shared_ptr<tt::hal::display::DisplayDriver> getDisplayDriver() override {
if (nativeDisplay == nullptr) {
nativeDisplay = std::make_shared<Hx8357Driver>();
}