mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 10:53:17 +00:00
33 lines
1.1 KiB
C++
33 lines
1.1 KiB
C++
#include "Display.h"
|
|
|
|
#include <PwmBacklight.h>
|
|
#include <St7789Display.h>
|
|
|
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
|
St7789Display::Configuration panel_configuration = {
|
|
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
|
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
|
.gapX = 52,
|
|
.gapY = 40,
|
|
.swapXY = false,
|
|
.mirrorX = true,
|
|
.mirrorY = true,
|
|
.invertColor = true,
|
|
.bufferSize = LCD_BUFFER_SIZE,
|
|
.touch = nullptr,
|
|
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
|
.resetPin = LCD_PIN_RESET,
|
|
.lvglSwapBytes = false
|
|
};
|
|
|
|
auto spi_configuration = std::make_shared<St7789Display::SpiConfiguration>(St7789Display::SpiConfiguration {
|
|
.spiHostDevice = LCD_SPI_HOST,
|
|
.csPin = LCD_PIN_CS,
|
|
.dcPin = LCD_PIN_DC,
|
|
.pixelClockFrequency = 62'500'000,
|
|
.transactionQueueDepth = 10
|
|
});
|
|
|
|
return std::make_shared<St7789Display>(panel_configuration, spi_configuration);
|
|
}
|