mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-19 03:13:14 +00:00
- Refactored `TouchDevice`: it can now start/stop LVGL separately, and it has an optional `TouchDriver` interface - Refactored `DisplayDevice`: it can now start/stop LVGL separately, and it has an optional `DisplayDriver` interface - Updated all boards and drivers for above changes - LVGL can now be stopped and (re)started on the fly - Fixed issues with restarting Gui and Statusbar services - Refactored `Gui` service to be class and renamed `Gui` to `GuiService` - Fixed `Statusbar` service: forgot to deregister one of the icons - Updated `esp_lcd_st7701` to v1.1.3 - `lv_textarea_create()` now automatically registers the hardware keyboard hooks (by wrapping the function) - Fixed and updated `tactility.py` - Cleanup of a lot of code - `BootInitLvglBegin` and `BootInitLvglEnd` are replaced by `LvglStarted` and `LvglStopped`. - Introduced `tt::service::State` which is accessible via `tt::service::getState()` (and internally via `ServiceInstance`) - Started replacing `#define TAG` with `constexpr auto TAG = "..";`
45 lines
1.6 KiB
C++
45 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <Tactility/hal/display/DisplayDriver.h>
|
|
#include <esp_lcd_panel_ops.h>
|
|
#include <esp_lvgl_port_disp.h>
|
|
|
|
using namespace tt::hal;
|
|
|
|
class EspLcdDisplayDriver : public display::DisplayDriver {
|
|
|
|
esp_lcd_panel_handle_t panelHandle;
|
|
const lvgl_port_display_cfg_t& lvglPortDisplayConfig;
|
|
|
|
public:
|
|
|
|
EspLcdDisplayDriver(
|
|
esp_lcd_panel_handle_t panelHandle,
|
|
const lvgl_port_display_cfg_t& lvglPortDisplayConfig
|
|
) : panelHandle(panelHandle), lvglPortDisplayConfig(lvglPortDisplayConfig) {}
|
|
|
|
display::ColorFormat getColorFormat() const override {
|
|
using display::ColorFormat;
|
|
switch (lvglPortDisplayConfig.color_format) {
|
|
case LV_COLOR_FORMAT_I1:
|
|
return ColorFormat::Monochrome;
|
|
case LV_COLOR_FORMAT_RGB565:
|
|
// swap_bytes is only used for the 565 color format
|
|
// see lvgl_port_flush_callback() in esp_lvgl_port_disp.c
|
|
return lvglPortDisplayConfig.flags.swap_bytes ? ColorFormat::BGR565 : ColorFormat::RGB565;
|
|
case LV_COLOR_FORMAT_RGB888:
|
|
return ColorFormat::RGB888;
|
|
default:
|
|
return ColorFormat::RGB565;
|
|
}
|
|
}
|
|
|
|
bool drawBitmap(int xStart, int yStart, int xEnd, int yEnd, const void* pixelData) override {
|
|
return esp_lcd_panel_draw_bitmap(panelHandle, xStart, yStart, xEnd, yEnd, pixelData) == ESP_OK;
|
|
}
|
|
|
|
uint16_t getPixelWidth() const override { return lvglPortDisplayConfig.hres; }
|
|
|
|
uint16_t getPixelHeight() const override { return lvglPortDisplayConfig.vres; }
|
|
};
|