mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
New board: Waveshare ESP32 S3 Touch LCD 4.3" (#248)
This commit is contained in:
parent
f85d0239ff
commit
0ebc022946
9
.github/workflows/build-firmware.yml
vendored
9
.github/workflows/build-firmware.yml
vendored
@ -153,3 +153,12 @@ jobs:
|
||||
with:
|
||||
board_id: unphone
|
||||
arch: esp32s3
|
||||
waveshare-s3-touch-43:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Build"
|
||||
uses: ./.github/actions/build-firmware
|
||||
with:
|
||||
board_id: waveshare-s3-touch-43
|
||||
arch: esp32s3
|
||||
@ -26,6 +26,7 @@ if (DEFINED ENV{ESP_IDF_VERSION})
|
||||
LilygoTdeck
|
||||
M5stackCoreS3
|
||||
UnPhone
|
||||
WaveshareS3Touch43
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@ -43,6 +43,8 @@ menu "Tactility App"
|
||||
bool "M5Stack CoreS3"
|
||||
config TT_BOARD_UNPHONE
|
||||
bool "unPhone"
|
||||
config TT_BOARD_WAVESHARE_S3_TOUCH_43
|
||||
bool "Waveshare ESP32 S3 Touch LCD 4.3"
|
||||
help
|
||||
Select a board/hardware configuration.
|
||||
Use TT_BOARD_CUSTOM if you will manually configure the board in your project.
|
||||
|
||||
@ -52,6 +52,9 @@
|
||||
#elif defined(CONFIG_TT_BOARD_CYD_4848S040C)
|
||||
#include "CYD4848S040C.h"
|
||||
#define TT_BOARD_HARDWARE &cyd_4848s040c_config
|
||||
#elif defined(CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH_43)
|
||||
#include "WaveshareS3Touch43.h"
|
||||
#define TT_BOARD_HARDWARE &waveshare_s3_touch_43
|
||||
#else
|
||||
#define TT_BOARD_HARDWARE NULL
|
||||
#error Replace TT_BOARD_HARDWARE in main.c with your own. Or copy one of the ./sdkconfig.board.* files into ./sdkconfig.
|
||||
|
||||
7
Boards/WaveshareS3Touch43/CMakeLists.txt
Normal file
7
Boards/WaveshareS3Touch43/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility esp_lvgl_port RgbDisplay GT911 driver
|
||||
)
|
||||
85
Boards/WaveshareS3Touch43/Source/WaveshareS3Touch43.cpp
Normal file
85
Boards/WaveshareS3Touch43/Source/WaveshareS3Touch43.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
#include "hal/WaveshareDisplay.h"
|
||||
#include "hal/WaveshareSdCard.h"
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
extern const Configuration waveshare_s3_touch_43 = {
|
||||
.createDisplay = createDisplay,
|
||||
.sdcard = createSdCard(),
|
||||
.i2c = {
|
||||
// There is only 1 (internal for touch, and also serves as "I2C-OUT" port)
|
||||
// Note: You could repurpose 1 or more UART interfaces as I2C interfaces
|
||||
i2c::Configuration {
|
||||
.name = "Main",
|
||||
.port = I2C_NUM_0,
|
||||
.initMode = i2c::InitMode::ByTactility,
|
||||
.isMutable = false,
|
||||
.config = (i2c_config_t) {
|
||||
.mode = I2C_MODE_MASTER,
|
||||
.sda_io_num = GPIO_NUM_8,
|
||||
.scl_io_num = GPIO_NUM_9,
|
||||
.sda_pullup_en = true,
|
||||
.scl_pullup_en = true,
|
||||
.master = {
|
||||
.clk_speed = 400000
|
||||
},
|
||||
.clk_flags = 0
|
||||
}
|
||||
}
|
||||
},
|
||||
.spi {
|
||||
// SD card
|
||||
spi::Configuration {
|
||||
.device = SPI2_HOST,
|
||||
.dma = SPI_DMA_CH_AUTO,
|
||||
.config = {
|
||||
.mosi_io_num = GPIO_NUM_11,
|
||||
.miso_io_num = GPIO_NUM_13,
|
||||
.sclk_io_num = GPIO_NUM_12,
|
||||
.quadwp_io_num = GPIO_NUM_NC,
|
||||
.quadhd_io_num = GPIO_NUM_NC,
|
||||
.data4_io_num = GPIO_NUM_NC,
|
||||
.data5_io_num = GPIO_NUM_NC,
|
||||
.data6_io_num = GPIO_NUM_NC,
|
||||
.data7_io_num = GPIO_NUM_NC,
|
||||
.data_io_default_level = false,
|
||||
.max_transfer_sz = 8192,
|
||||
.flags = 0,
|
||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||
.intr_flags = 0
|
||||
},
|
||||
.initMode = spi::InitMode::ByTactility,
|
||||
.isMutable = false,
|
||||
.lock = nullptr
|
||||
}
|
||||
},
|
||||
.uart {
|
||||
// "UART1"
|
||||
uart::Configuration {
|
||||
.name = "UART1",
|
||||
.port = UART_NUM_1,
|
||||
.rxPin = GPIO_NUM_44,
|
||||
.txPin = GPIO_NUM_43,
|
||||
.rtsPin = GPIO_NUM_NC,
|
||||
.ctsPin = GPIO_NUM_NC,
|
||||
.rxBufferSize = 1024,
|
||||
.txBufferSize = 1024,
|
||||
.config = {
|
||||
.baud_rate = 115200,
|
||||
.data_bits = UART_DATA_8_BITS,
|
||||
.parity = UART_PARITY_DISABLE,
|
||||
.stop_bits = UART_STOP_BITS_1,
|
||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
||||
.rx_flow_ctrl_thresh = 0,
|
||||
.source_clk = UART_SCLK_DEFAULT,
|
||||
.flags = {
|
||||
.allow_pd = 0,
|
||||
.backup_before_sleep = 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
.gps = {}
|
||||
};
|
||||
5
Boards/WaveshareS3Touch43/Source/WaveshareS3Touch43.h
Normal file
5
Boards/WaveshareS3Touch43/Source/WaveshareS3Touch43.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
extern const tt::hal::Configuration waveshare_s3_touch_43;
|
||||
102
Boards/WaveshareS3Touch43/Source/hal/WaveshareDisplay.cpp
Normal file
102
Boards/WaveshareS3Touch43/Source/hal/WaveshareDisplay.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
#include "WaveshareDisplay.h"
|
||||
|
||||
#include <Gt911Touch.h>
|
||||
#include <RgbDisplay.h>
|
||||
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
|
||||
// Note for future changes: Reset pin is 38 and interrupt pin is 18
|
||||
// or INT = NC, schematic and other info floating around is kinda conflicting...
|
||||
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
||||
I2C_NUM_0,
|
||||
800,
|
||||
480
|
||||
);
|
||||
|
||||
return std::make_shared<Gt911Touch>(std::move(configuration));
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
auto touch = createTouch();
|
||||
|
||||
constexpr uint32_t bufferPixels = 800 * 10;
|
||||
|
||||
esp_lcd_rgb_panel_config_t rgb_panel_config = {
|
||||
.clk_src = LCD_CLK_SRC_DEFAULT,
|
||||
.timings = {
|
||||
.pclk_hz = 12'000'000, // NOTE: original was 14MHz, but we had to slow it down with PSRAM frame buffer,
|
||||
.h_res = 800,
|
||||
.v_res = 480,
|
||||
.hsync_pulse_width = 10,
|
||||
.hsync_back_porch = 10,
|
||||
.hsync_front_porch = 20,
|
||||
.vsync_pulse_width = 10,
|
||||
.vsync_back_porch = 10,
|
||||
.vsync_front_porch = 10,
|
||||
.flags = {
|
||||
.hsync_idle_low = false,
|
||||
.vsync_idle_low = false,
|
||||
.de_idle_high = false,
|
||||
.pclk_active_neg = true,
|
||||
.pclk_idle_high = false
|
||||
}
|
||||
},
|
||||
.data_width = 16,
|
||||
.bits_per_pixel = 0,
|
||||
.num_fbs = 2,
|
||||
.bounce_buffer_size_px = bufferPixels,
|
||||
.sram_trans_align = 8,
|
||||
.psram_trans_align = 64,
|
||||
.hsync_gpio_num = GPIO_NUM_46,
|
||||
.vsync_gpio_num = GPIO_NUM_3,
|
||||
.de_gpio_num = GPIO_NUM_5,
|
||||
.pclk_gpio_num = GPIO_NUM_7,
|
||||
.disp_gpio_num = GPIO_NUM_NC,
|
||||
.data_gpio_nums = {
|
||||
GPIO_NUM_14, // B3
|
||||
GPIO_NUM_38, // B4
|
||||
GPIO_NUM_18, // B5
|
||||
GPIO_NUM_17, // B6
|
||||
GPIO_NUM_10, // B7
|
||||
GPIO_NUM_39, // G2
|
||||
GPIO_NUM_0, // G3
|
||||
GPIO_NUM_45, // G4
|
||||
GPIO_NUM_48, // G5
|
||||
GPIO_NUM_47, // G6
|
||||
GPIO_NUM_21, // G7
|
||||
GPIO_NUM_1, // R3
|
||||
GPIO_NUM_2, // R4
|
||||
GPIO_NUM_42, // R5
|
||||
GPIO_NUM_41, // R6
|
||||
GPIO_NUM_40, // R7
|
||||
},
|
||||
.flags = {
|
||||
.disp_active_low = false,
|
||||
.refresh_on_demand = false,
|
||||
.fb_in_psram = true,
|
||||
.double_fb = true,
|
||||
.no_fb = false,
|
||||
.bb_invalidate_cache = false
|
||||
}
|
||||
};
|
||||
|
||||
RgbDisplay::BufferConfiguration buffer_config = {
|
||||
.size = (800 * 480),
|
||||
.useSpi = true,
|
||||
.doubleBuffer = true,
|
||||
.bounceBufferMode = true,
|
||||
.avoidTearing = false
|
||||
};
|
||||
|
||||
auto configuration = std::make_unique<RgbDisplay::Configuration>(
|
||||
rgb_panel_config,
|
||||
buffer_config,
|
||||
touch,
|
||||
LV_COLOR_FORMAT_RGB565,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
return std::make_shared<RgbDisplay>(std::move(configuration));
|
||||
}
|
||||
5
Boards/WaveshareS3Touch43/Source/hal/WaveshareDisplay.h
Normal file
5
Boards/WaveshareS3Touch43/Source/hal/WaveshareDisplay.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/display/DisplayDevice.h"
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||
21
Boards/WaveshareS3Touch43/Source/hal/WaveshareSdCard.cpp
Normal file
21
Boards/WaveshareS3Touch43/Source/hal/WaveshareSdCard.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include "WaveshareSdCard.h"
|
||||
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto* configuration = new SpiSdCardDevice::Config(
|
||||
GPIO_NUM_10,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot
|
||||
);
|
||||
|
||||
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
||||
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
||||
);
|
||||
|
||||
return std::shared_ptr<SdCardDevice>(sdcard);
|
||||
}
|
||||
7
Boards/WaveshareS3Touch43/Source/hal/WaveshareSdCard.h
Normal file
7
Boards/WaveshareS3Touch43/Source/hal/WaveshareSdCard.h
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@ -60,6 +60,9 @@ release m5stack-core2
|
||||
build m5stack-cores3
|
||||
release m5stack-cores3
|
||||
|
||||
build waveshare-s3-touch-43
|
||||
release waveshare-s3-touch-43
|
||||
|
||||
duration=$SECONDS
|
||||
|
||||
echo "Finished in $((duration / 60)) minutes and $((duration % 60)) seconds."
|
||||
@ -45,6 +45,7 @@ if (DEFINED ENV{ESP_IDF_VERSION})
|
||||
set(EXCLUDE_COMPONENTS "ElecrowCrowpanelBasic50")
|
||||
set(EXCLUDE_COMPONENTS "LilygoTdeck")
|
||||
set(EXCLUDE_COMPONENTS "M5stackCoreS3")
|
||||
set(EXCLUDE_COMPONENTS "WaveshareEsp32S3TouchLcd43")
|
||||
set(EXCLUDE_COMPONENTS "UnPhone")
|
||||
endif()
|
||||
|
||||
|
||||
54
sdkconfig.board.waveshare-s3-touch-43
Normal file
54
sdkconfig.board.waveshare-s3-touch-43
Normal file
@ -0,0 +1,54 @@
|
||||
# Software defaults
|
||||
# Increase stack size for WiFi (fixes crash after scan)
|
||||
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072
|
||||
CONFIG_LV_FONT_MONTSERRAT_14=y
|
||||
CONFIG_LV_FONT_MONTSERRAT_18=y
|
||||
CONFIG_LV_USE_USER_DATA=y
|
||||
CONFIG_LV_USE_FS_STDIO=y
|
||||
CONFIG_LV_FS_STDIO_LETTER=65
|
||||
CONFIG_LV_FS_STDIO_PATH=""
|
||||
CONFIG_LV_FS_STDIO_CACHE_SIZE=4096
|
||||
CONFIG_LV_USE_LODEPNG=y
|
||||
CONFIG_LV_USE_BUILTIN_MALLOC=n
|
||||
CONFIG_LV_USE_CLIB_MALLOC=y
|
||||
CONFIG_LV_USE_MSGBOX=n
|
||||
CONFIG_LV_USE_SPINNER=n
|
||||
CONFIG_LV_USE_WIN=n
|
||||
CONFIG_LV_USE_SNAPSHOT=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||
CONFIG_FREERTOS_SMP=n
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=4096
|
||||
CONFIG_FREERTOS_USE_TRACE_FACILITY=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
CONFIG_FATFS_LFN_HEAP=y
|
||||
CONFIG_FATFS_VOLUME_COUNT=3
|
||||
|
||||
# Hardware: Main
|
||||
CONFIG_TT_BOARD_WAVESHARE_S3_TOUCH_43=y
|
||||
CONFIG_TT_BOARD_NAME="Waveshare ESP32 S3 Touch LCD 4.3"
|
||||
CONFIG_TT_BOARD_ID="waveshare-s3-touch-43"
|
||||
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
|
||||
CONFIG_IDF_TARGET="esp32s3"
|
||||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||
CONFIG_FLASHMODE_QIO=y
|
||||
# Hardware: SPI RAM
|
||||
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
|
||||
CONFIG_SPIRAM_MODE_OCT=y
|
||||
CONFIG_SPIRAM_SPEED_120M=y
|
||||
CONFIG_SPIRAM_USE_MALLOC=y
|
||||
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
|
||||
# SPI Flash (can set back to 80MHz after ESP-IDF bug is resolved)
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_120M=y
|
||||
# LVGL
|
||||
# TODO: Update DPI
|
||||
CONFIG_LV_DPI_DEF=143
|
||||
CONFIG_LV_DISP_DEF_REFR_PERIOD=10
|
||||
# USB
|
||||
CONFIG_TINYUSB_MSC_ENABLED=y
|
||||
CONFIG_TINYUSB_MSC_MOUNT_PATH="/sdcard"
|
||||
Loading…
x
Reference in New Issue
Block a user