Merge develop into main (#391)
## Improvements - Created new base driver classes: `EspLcdDisplayV2' and `EspLcdSpiDisplay` - Updated `St7789Display` to implement `EspLcdSpiDisplay` - Updated all boards with ST7789 display ## Fixes - Ensure that `tmp/` is created on startup (for all writeable filesystems) - Fix for `lv_list` padding on small screen devices - Fix for `PreferencesEsp` not processing result when writing string to NVS ## Other - Remove unused build scripts
This commit is contained in:
committed by
GitHub
parent
37420db000
commit
db6d3b4acb
@@ -5,25 +5,20 @@
|
||||
#include <PwmBacklight.h>
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
// SPI Transfer
|
||||
#define CYD_SPI_TRANSFER_SIZE_LIMIT (CYD2432S028RV3_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
|
||||
// Display backlight (PWM)
|
||||
#define CYD2432S028RV3_LCD_PIN_BACKLIGHT GPIO_NUM_21
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
static bool initBoot() {
|
||||
//Set the RGB Led Pins to output and turn them off
|
||||
// Set the RGB LED Pins to output and turn them off
|
||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); //Red
|
||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); //Green
|
||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); //Blue
|
||||
|
||||
//0 on, 1 off... yep it's backwards.
|
||||
// 0 on, 1 off... yep it's backwards.
|
||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); //Red
|
||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); //Green
|
||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); //Blue
|
||||
|
||||
return driver::pwmbacklight::init(CYD2432S028RV3_LCD_PIN_BACKLIGHT);
|
||||
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT);
|
||||
}
|
||||
|
||||
static DeviceVector createDevices() {
|
||||
@@ -71,7 +66,7 @@ const Configuration cyd_2432s028rv3_config = {
|
||||
.data6_io_num = GPIO_NUM_NC,
|
||||
.data7_io_num = GPIO_NUM_NC,
|
||||
.data_io_default_level = false,
|
||||
.max_transfer_sz = CYD_SPI_TRANSFER_SIZE_LIMIT,
|
||||
.max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
|
||||
.flags = 0,
|
||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||
.intr_flags = 0
|
||||
|
||||
@@ -7,12 +7,12 @@ constexpr auto* TAG = "CYD";
|
||||
|
||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||
auto configuration = std::make_unique<Xpt2046SoftSpi::Configuration>(
|
||||
CYD_TOUCH_MOSI_PIN,
|
||||
CYD_TOUCH_MISO_PIN,
|
||||
CYD_TOUCH_SCK_PIN,
|
||||
CYD_TOUCH_CS_PIN,
|
||||
CYD2432S028RV3_LCD_HORIZONTAL_RESOLUTION, // 240
|
||||
CYD2432S028RV3_LCD_VERTICAL_RESOLUTION, // 320
|
||||
TOUCH_MOSI_PIN,
|
||||
TOUCH_MISO_PIN,
|
||||
TOUCH_SCK_PIN,
|
||||
TOUCH_CS_PIN,
|
||||
LCD_HORIZONTAL_RESOLUTION, // 240
|
||||
LCD_VERTICAL_RESOLUTION, // 320
|
||||
false, // swapXY
|
||||
true, // mirrorX
|
||||
false // mirrorY
|
||||
@@ -31,24 +31,28 @@ static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
auto touch = createTouch();
|
||||
St7789Display::Configuration panel_configuration = {
|
||||
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
||||
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
||||
.gapX = 0,
|
||||
.gapY = 0,
|
||||
.swapXY = false,
|
||||
.mirrorX = false,
|
||||
.mirrorY = false,
|
||||
.invertColor = false,
|
||||
.bufferSize = LCD_BUFFER_SIZE,
|
||||
.touch = createTouch(),
|
||||
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
||||
.resetPin = GPIO_NUM_NC
|
||||
};
|
||||
|
||||
auto configuration = std::make_unique<St7789Display::Configuration>(
|
||||
CYD2432S028RV3_LCD_SPI_HOST,
|
||||
CYD2432S028RV3_LCD_PIN_CS,
|
||||
CYD2432S028RV3_LCD_PIN_DC,
|
||||
CYD2432S028RV3_LCD_HORIZONTAL_RESOLUTION,
|
||||
CYD2432S028RV3_LCD_VERTICAL_RESOLUTION,
|
||||
touch,
|
||||
false, // swapXY
|
||||
false, // mirrorX
|
||||
false, // mirrorY
|
||||
false, // invertColor
|
||||
CYD2432S028RV3_LCD_DRAW_BUFFER_SIZE
|
||||
);
|
||||
auto spi_configuration = std::make_shared<St7789Display::SpiConfiguration>(St7789Display::SpiConfiguration {
|
||||
.spiHostDevice = LCD_SPI_HOST,
|
||||
.csPin = LCD_PIN_CS,
|
||||
.dcPin = LCD_PIN_DC,
|
||||
.pixelClockFrequency = 80'000'000,
|
||||
.transactionQueueDepth = 10
|
||||
});
|
||||
|
||||
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
||||
|
||||
auto display = std::make_shared<St7789Display>(std::move(configuration));
|
||||
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
||||
return std::make_shared<St7789Display>(panel_configuration, spi_configuration);
|
||||
}
|
||||
|
||||
@@ -1,22 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/display/DisplayDevice.h"
|
||||
#include <Tactility/hal/display/DisplayDevice.h>
|
||||
|
||||
#include <driver/gpio.h>
|
||||
#include <driver/spi_common.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
// Display
|
||||
#define CYD2432S028RV3_LCD_SPI_HOST SPI2_HOST
|
||||
#define CYD2432S028RV3_LCD_HORIZONTAL_RESOLUTION 240
|
||||
#define CYD2432S028RV3_LCD_VERTICAL_RESOLUTION 320
|
||||
#define CYD2432S028RV3_LCD_DRAW_BUFFER_HEIGHT (CYD2432S028RV3_LCD_VERTICAL_RESOLUTION / 10)
|
||||
#define CYD2432S028RV3_LCD_DRAW_BUFFER_SIZE (CYD2432S028RV3_LCD_HORIZONTAL_RESOLUTION * CYD2432S028RV3_LCD_DRAW_BUFFER_HEIGHT)
|
||||
#define CYD2432S028RV3_LCD_PIN_CS GPIO_NUM_15
|
||||
#define CYD2432S028RV3_LCD_PIN_DC GPIO_NUM_2
|
||||
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
||||
constexpr auto LCD_PIN_CS = GPIO_NUM_15;
|
||||
constexpr auto LCD_PIN_DC = GPIO_NUM_2;
|
||||
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_21;
|
||||
constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
||||
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
||||
|
||||
// Touch (Software SPI)
|
||||
#define CYD_TOUCH_MISO_PIN GPIO_NUM_39
|
||||
#define CYD_TOUCH_MOSI_PIN GPIO_NUM_32
|
||||
#define CYD_TOUCH_SCK_PIN GPIO_NUM_25
|
||||
#define CYD_TOUCH_CS_PIN GPIO_NUM_33
|
||||
#define CYD_TOUCH_IRQ_PIN GPIO_NUM_36
|
||||
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
|
||||
constexpr auto TOUCH_MOSI_PIN = GPIO_NUM_32;
|
||||
constexpr auto TOUCH_SCK_PIN = GPIO_NUM_25;
|
||||
constexpr auto TOUCH_CS_PIN = GPIO_NUM_33;
|
||||
constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36;
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||
|
||||
Reference in New Issue
Block a user