Bring the ST7789 driver inline with the ILI934x driver (#228)
more configuration options as not every display / board is the same.
This commit is contained in:
parent
d29e47f0eb
commit
09cdf07b7c
@ -67,17 +67,17 @@ bool St7789Display::start() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (esp_lcd_panel_invert_color(panelHandle, true) != ESP_OK) {
|
if (esp_lcd_panel_invert_color(panelHandle, configuration->invertColor) != ESP_OK) {
|
||||||
TT_LOG_E(TAG, "Failed to set panel to invert");
|
TT_LOG_E(TAG, "Failed to set panel to invert");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (esp_lcd_panel_swap_xy(panelHandle, true) != ESP_OK) {
|
if (esp_lcd_panel_swap_xy(panelHandle, configuration->swapXY) != ESP_OK) {
|
||||||
TT_LOG_E(TAG, "Failed to swap XY ");
|
TT_LOG_E(TAG, "Failed to swap XY ");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (esp_lcd_panel_mirror(panelHandle, true, false) != ESP_OK) {
|
if (esp_lcd_panel_mirror(panelHandle, configuration->mirrorX, configuration->mirrorY) != ESP_OK) {
|
||||||
TT_LOG_E(TAG, "Failed to set panel to mirror");
|
TT_LOG_E(TAG, "Failed to set panel to mirror");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -104,9 +104,9 @@ bool St7789Display::start() {
|
|||||||
.vres = configuration->verticalResolution,
|
.vres = configuration->verticalResolution,
|
||||||
.monochrome = false,
|
.monochrome = false,
|
||||||
.rotation = {
|
.rotation = {
|
||||||
.swap_xy = true,
|
.swap_xy = configuration->swapXY,
|
||||||
.mirror_x = true,
|
.mirror_x = configuration->mirrorX,
|
||||||
.mirror_y = false,
|
.mirror_y = configuration->mirrorY,
|
||||||
},
|
},
|
||||||
.color_format = LV_COLOR_FORMAT_RGB565,
|
.color_format = LV_COLOR_FORMAT_RGB565,
|
||||||
.flags = {
|
.flags = {
|
||||||
|
|||||||
@ -23,12 +23,22 @@ public:
|
|||||||
gpio_num_t dcPin,
|
gpio_num_t dcPin,
|
||||||
unsigned int horizontalResolution,
|
unsigned int horizontalResolution,
|
||||||
unsigned int verticalResolution,
|
unsigned int verticalResolution,
|
||||||
std::shared_ptr<tt::hal::touch::TouchDevice> touch
|
std::shared_ptr<tt::hal::touch::TouchDevice> touch,
|
||||||
|
bool swapXY = false,
|
||||||
|
bool mirrorX = false,
|
||||||
|
bool mirrorY = false,
|
||||||
|
bool invertColor = false,
|
||||||
|
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),
|
||||||
dcPin(dcPin),
|
dcPin(dcPin),
|
||||||
horizontalResolution(horizontalResolution),
|
horizontalResolution(horizontalResolution),
|
||||||
verticalResolution(verticalResolution),
|
verticalResolution(verticalResolution),
|
||||||
|
swapXY(swapXY),
|
||||||
|
mirrorX(mirrorX),
|
||||||
|
mirrorY(mirrorY),
|
||||||
|
invertColor(invertColor),
|
||||||
|
bufferSize(bufferSize),
|
||||||
touch(std::move(touch))
|
touch(std::move(touch))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -40,6 +50,10 @@ public:
|
|||||||
size_t transactionQueueDepth = 10;
|
size_t transactionQueueDepth = 10;
|
||||||
unsigned int horizontalResolution;
|
unsigned int horizontalResolution;
|
||||||
unsigned int verticalResolution;
|
unsigned int verticalResolution;
|
||||||
|
bool swapXY = false;
|
||||||
|
bool mirrorX = false;
|
||||||
|
bool mirrorY = false;
|
||||||
|
bool invertColor = false;
|
||||||
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;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user