Merge develop into main (#303)
- `DisplayDevice` improvements related `DisplayDriver` - Replaced incorrect usage of `spiBusHandle` with `spiHostDevice` in all SPI display devices - Disabled `DisplayDriver` support for RGB displays for now - Updated `GraphicsDemo` project for the above changes - TactilityC improvements: - created `tt_hal_device_find()` - created `tt_hal_display_*` - created `tt_hal_touch_*` - created `tt_lvgl_*` - export `tt_app_*` calls
This commit is contained in:
committed by
GitHub
parent
d875ade8cb
commit
fbaff8cbac
@@ -1,44 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/Mutex.h>
|
||||
#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 {
|
||||
class EspLcdDisplayDriver : public tt::hal::display::DisplayDriver {
|
||||
|
||||
esp_lcd_panel_handle_t panelHandle;
|
||||
const lvgl_port_display_cfg_t& lvglPortDisplayConfig;
|
||||
std::shared_ptr<tt::Lock> lock;
|
||||
uint16_t hRes;
|
||||
uint16_t vRes;
|
||||
tt::hal::display::ColorFormat colorFormat;
|
||||
|
||||
public:
|
||||
|
||||
EspLcdDisplayDriver(
|
||||
esp_lcd_panel_handle_t panelHandle,
|
||||
const lvgl_port_display_cfg_t& lvglPortDisplayConfig
|
||||
) : panelHandle(panelHandle), lvglPortDisplayConfig(lvglPortDisplayConfig) {}
|
||||
std::shared_ptr<tt::Lock> lock,
|
||||
uint16_t hRes,
|
||||
uint16_t vRes,
|
||||
tt::hal::display::ColorFormat colorFormat
|
||||
) : panelHandle(panelHandle), lock(lock), hRes(hRes), vRes(vRes), colorFormat(colorFormat) {}
|
||||
|
||||
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;
|
||||
}
|
||||
tt::hal::display::ColorFormat getColorFormat() const override {
|
||||
return colorFormat;
|
||||
}
|
||||
|
||||
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;
|
||||
bool result = esp_lcd_panel_draw_bitmap(panelHandle, xStart, yStart, xEnd, yEnd, pixelData) == ESP_OK;
|
||||
return result;
|
||||
}
|
||||
|
||||
uint16_t getPixelWidth() const override { return lvglPortDisplayConfig.hres; }
|
||||
uint16_t getPixelWidth() const override { return hRes; }
|
||||
|
||||
uint16_t getPixelHeight() const override { return lvglPortDisplayConfig.vres; }
|
||||
uint16_t getPixelHeight() const override { return vRes; }
|
||||
|
||||
std::shared_ptr<tt::Lock> getLock() const override { return lock; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user