+ Fixup: Add gap configuration for ST7796, update its README.md

This commit is contained in:
Dominic Höglinger 2025-07-03 18:50:25 +02:00
parent 2294b45e71
commit b83bb5a3e6
4 changed files with 12 additions and 4 deletions

View File

@ -19,7 +19,9 @@ std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
true, //swapXY true, //swapXY
true, //mirrorX true, //mirrorX
true, //mirrorY true, //mirrorY
true //invertColor true, //invertColor
0, //gapX
49 //gapY
); );
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;

View File

@ -1,3 +1,3 @@
# ST7789 # ST7796
A basic ESP32 LVGL driver for ST7789 displays. A basic ESP32 LVGL driver for ST7796 displays.

View File

@ -123,7 +123,7 @@ bool St7796Display::start() {
return false; return false;
} }
if (esp_lcd_panel_set_gap(panelHandle, 0, 49) != ESP_OK) { if (esp_lcd_panel_set_gap(panelHandle, configuration->gapX, configuration->gapY) != ESP_OK) {
TT_LOG_E(TAG, "Failed to set panel gap"); TT_LOG_E(TAG, "Failed to set panel gap");
return false; return false;
} }

View File

@ -28,6 +28,8 @@ public:
bool mirrorX = false, bool mirrorX = false,
bool mirrorY = false, bool mirrorY = false,
bool invertColor = false, bool invertColor = false,
unsigned int gapX = 0,
unsigned int gapY = 0,
uint32_t bufferSize = 0 // Size in pixel count. 0 means default, which is 1/10 of the screen size uint32_t bufferSize = 0 // Size in pixel count. 0 means default, which is 1/10 of the screen size
) : spiBusHandle(spi_bus_handle), ) : spiBusHandle(spi_bus_handle),
csPin(csPin), csPin(csPin),
@ -38,6 +40,8 @@ public:
mirrorX(mirrorX), mirrorX(mirrorX),
mirrorY(mirrorY), mirrorY(mirrorY),
invertColor(invertColor), invertColor(invertColor),
gapX(gapX),
gapY(gapY),
bufferSize(bufferSize), bufferSize(bufferSize),
touch(std::move(touch)) {} touch(std::move(touch)) {}
@ -53,6 +57,8 @@ public:
bool mirrorX = false; bool mirrorX = false;
bool mirrorY = false; bool mirrorY = false;
bool invertColor = false; bool invertColor = false;
unsigned int gapX = 0;
unsigned int gapY = 0;
uint32_t bufferSize = 0; // Size in pixel count. 0 means default, which is 1/10 of the screen size uint32_t bufferSize = 0; // Size in pixel count. 0 means default, which is 1/10 of the screen size
std::shared_ptr<tt::hal::touch::TouchDevice> touch; std::shared_ptr<tt::hal::touch::TouchDevice> touch;
std::function<void(uint8_t)> _Nullable backlightDutyFunction = nullptr; std::function<void(uint8_t)> _Nullable backlightDutyFunction = nullptr;