Tactility/Drivers/ST7789/Source/St7789Display.h
Ken Van Hoeylandt d27404964a
SPI device migration (#490)
- Implement SPI devices in dts files for all devices
- Removed `tt::hal::spi` HAL and its configurations
- Fix for devicetree generator "boolean" support
- Remove unused custom locks in all `DisplayDevice` implementations
- Fixed some bugs with devices
- Updated XPT2046 driver
- Fix for `WifiEsp` deadlock
- Export a lot of new `math.h` symbols with `tt_init.cpp`
- Created `SpiDeviceLock` in `TactilityCore` as a wrapper for kernel SPI locking
- Improved `TactilityKernel` SPI driver.
2026-02-08 22:14:18 +01:00

56 lines
1.7 KiB
C++

#pragma once
#include <EspLcdSpiDisplay.h>
#include <driver/gpio.h>
#include <functional>
#include <lvgl.h>
class St7789Display final : public EspLcdSpiDisplay {
public:
/** Minimal set of overrides for EspLcdConfiguration */
struct Configuration {
unsigned int horizontalResolution;
unsigned int verticalResolution;
int gapX;
int gapY;
bool swapXY;
bool mirrorX;
bool mirrorY;
bool invertColor;
uint32_t bufferSize; // Pixel count, not byte count. Set to 0 for default (1/10th of display size)
std::shared_ptr<tt::hal::touch::TouchDevice> touch;
std::function<void(uint8_t)> _Nullable backlightDutyFunction;
gpio_num_t resetPin;
bool lvglSwapBytes;
lcd_rgb_element_order_t rgbElementOrder = LCD_RGB_ELEMENT_ORDER_RGB;
};
private:
static std::shared_ptr<EspLcdConfiguration> createEspLcdConfiguration(const Configuration& configuration);
esp_lcd_panel_dev_config_t createPanelConfig(std::shared_ptr<EspLcdConfiguration> espLcdConfiguration, gpio_num_t resetPin) override;
bool createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, const esp_lcd_panel_dev_config_t& panelConfig, esp_lcd_panel_handle_t& panelHandle) override;
public:
explicit St7789Display(const Configuration& configuration, const std::shared_ptr<SpiConfiguration>& spiConfiguration) :
EspLcdSpiDisplay(
createEspLcdConfiguration(configuration),
spiConfiguration,
4
)
{
}
std::string getName() const override { return "ST7789"; }
std::string getDescription() const override { return "ST7789 display"; }
};
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();