-
-
Notifications
You must be signed in to change notification settings - Fork 78
Add support for Waveshare ESP32-C6-LCD-1.47 board #394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 ST7789 PwmBacklight driver | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #include "devices/Display.h" | ||
| #include "devices/SdCard.h" | ||
|
|
||
| #include <PwmBacklight.h> | ||
| #include <Tactility/hal/Configuration.h> | ||
| #include <Tactility/hal/uart/Uart.h> | ||
| #include <Tactility/lvgl/LvglSync.h> | ||
|
|
||
| using namespace tt::hal; | ||
|
|
||
| static DeviceVector createDevices() { | ||
| return { | ||
| createDisplay(), | ||
| createSdCard() | ||
| // TODO: Add RGB LED device (GPIO8, RMT-based WS2812) | ||
| }; | ||
| } | ||
|
|
||
| extern bool initBoot(); | ||
|
|
||
| extern const Configuration hardwareConfiguration = { | ||
| .initBoot = initBoot, | ||
| .uiScale = UiScale::Smallest, | ||
| .createDevices = createDevices, | ||
| .i2c = {}, | ||
| .spi { | ||
| // Display and SD card (shared SPI bus) | ||
| spi::Configuration { | ||
| .device = LCD_SPI_HOST, | ||
| .dma = SPI_DMA_CH_AUTO, | ||
| .config = { | ||
| .mosi_io_num = LCD_PIN_MOSI, | ||
| .miso_io_num = LCD_PIN_MISO, | ||
| .sclk_io_num = LCD_PIN_SCLK, | ||
| .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 = LCD_SPI_TRANSFER_SIZE_LIMIT, | ||
| .flags = 0, | ||
| .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO, | ||
| .intr_flags = 0 | ||
| }, | ||
| .initMode = spi::InitMode::ByTactility, | ||
| .isMutable = false, | ||
| .lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display | ||
| } | ||
| }, | ||
| .uart {} | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #include "devices/Display.h" | ||
|
|
||
| #include <PwmBacklight.h> | ||
|
|
||
| bool initBoot() { | ||
| // Initialize backlight with 5 kHz frequency (as per demo code) | ||
| return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT, 5000); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #include "Display.h" | ||
|
|
||
| #include <PwmBacklight.h> | ||
| #include <St7789Display.h> | ||
|
|
||
| std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { | ||
| // Configuration based on demo code: | ||
| // - Resolution: 172x320 | ||
| // - X offset: 34 pixels (gapX parameter) | ||
| // - Y offset: 0 pixels | ||
| // - Mirror X-axis disabled (to fix inverted text) | ||
| // - 12MHz SPI clock | ||
|
|
||
| St7789Display::Configuration panel_configuration = { | ||
| .horizontalResolution = LCD_HORIZONTAL_RESOLUTION, | ||
| .verticalResolution = LCD_VERTICAL_RESOLUTION, | ||
| .gapX = LCD_GAP_X, | ||
| .gapY = LCD_GAP_Y, | ||
| .swapXY = false, | ||
| .mirrorX = false, // disabled to fix inverted text | ||
| .mirrorY = false, | ||
| .invertColor = true, | ||
| .bufferSize = 0, // default = 1/10 of screen | ||
| .touch = nullptr, | ||
| .backlightDutyFunction = driver::pwmbacklight::setBacklightDuty, | ||
| .resetPin = LCD_PIN_RESET | ||
| }; | ||
|
|
||
| auto spi_configuration = std::make_shared<St7789Display::SpiConfiguration>(St7789Display::SpiConfiguration { | ||
| .spiHostDevice = LCD_SPI_HOST, | ||
| .csPin = LCD_PIN_CS, | ||
| .dcPin = LCD_PIN_DC, | ||
| .pixelClockFrequency = LCD_PIXEL_CLOCK_HZ, | ||
| .transactionQueueDepth = 10 | ||
| }); | ||
|
|
||
| return std::make_shared<St7789Display>(panel_configuration, spi_configuration); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #pragma once | ||
|
|
||
| #include "Tactility/hal/display/DisplayDevice.h" | ||
| #include <driver/gpio.h> | ||
| #include <driver/spi_common.h> | ||
| #include <memory> | ||
|
|
||
| // Display SPI configuration | ||
| constexpr auto LCD_SPI_HOST = SPI2_HOST; | ||
| constexpr auto LCD_PIN_CS = GPIO_NUM_14; | ||
| constexpr auto LCD_PIN_DC = GPIO_NUM_15; | ||
| constexpr auto LCD_PIN_RESET = GPIO_NUM_21; | ||
| constexpr auto LCD_PIXEL_CLOCK_HZ = 12'000'000; // 12 MHz as in demo | ||
|
|
||
| // Display panel configuration | ||
| constexpr auto LCD_HORIZONTAL_RESOLUTION = 172; | ||
| constexpr auto LCD_VERTICAL_RESOLUTION = 320; | ||
| constexpr auto LCD_GAP_X = 34; // X offset for 1.47" display | ||
| constexpr auto LCD_GAP_Y = 0; | ||
|
|
||
| // Display backlight | ||
| constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_22; | ||
|
|
||
| // SPI bus configuration (shared with SD card) | ||
| constexpr auto LCD_PIN_MOSI = GPIO_NUM_6; | ||
| constexpr auto LCD_PIN_MISO = GPIO_NUM_5; | ||
| constexpr auto LCD_PIN_SCLK = GPIO_NUM_7; | ||
| 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; | ||
|
|
||
| std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #include "SdCard.h" | ||
| #include "Display.h" | ||
|
|
||
| #include <Tactility/hal/sdcard/SpiSdCardDevice.h> | ||
| #include <Tactility/hal/spi/Spi.h> | ||
|
|
||
| using tt::hal::sdcard::SpiSdCardDevice; | ||
|
|
||
| std::shared_ptr<SdCardDevice> createSdCard() { | ||
| // SD card shares SPI bus with display (SPI2_HOST) | ||
| // CS pin is GPIO4, need to protect display CS during SD operations | ||
| auto configuration = std::make_unique<SpiSdCardDevice::Config>( | ||
| SD_PIN_CS, // CS pin for SD card | ||
| GPIO_NUM_NC, // CD (card detect) pin - not used | ||
| GPIO_NUM_NC, // WP (write protect) pin - not used | ||
| GPIO_NUM_NC, // Power pin - not used | ||
| SdCardDevice::MountBehaviour::AtBoot, | ||
| tt::hal::spi::getLock(LCD_SPI_HOST), // Use same lock as display | ||
| std::vector<gpio_num_t> { LCD_PIN_CS }, // Assert display CS high during SD operations | ||
| LCD_SPI_HOST | ||
| ); | ||
|
|
||
| return std::make_shared<SpiSdCardDevice>( | ||
| std::move(configuration) | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #pragma once | ||
|
|
||
| #include "Tactility/hal/sdcard/SdCardDevice.h" | ||
| #include <driver/gpio.h> | ||
| #include <driver/spi_common.h> | ||
| #include <memory> | ||
|
|
||
| using tt::hal::sdcard::SdCardDevice; | ||
|
|
||
| // SD card configuration (shares SPI bus with display) | ||
| constexpr auto SD_PIN_CS = GPIO_NUM_4; | ||
|
|
||
| std::shared_ptr<SdCardDevice> createSdCard(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,21 @@ | ||
| dependencies: | ||
| espressif/esp_lcd_ili9341: "2.0.1" | ||
| atanisoft/esp_lcd_ili9488: "1.0.10" | ||
| teriyakigod/esp_lcd_st7735: "0.0.1" | ||
| espressif/esp_lcd_ili9341: | ||
| version: "2.0.1" | ||
| rules: | ||
| - if: "target in [esp32, esp32s3]" | ||
| atanisoft/esp_lcd_ili9488: | ||
| version: "1.0.10" | ||
| rules: | ||
| - if: "target in [esp32, esp32s3]" | ||
| teriyakigod/esp_lcd_st7735: | ||
| version: "0.0.1" | ||
| rules: | ||
| - if: "target in [esp32, esp32s3]" | ||
| espressif/esp_lcd_touch: "1.1.2" | ||
| atanisoft/esp_lcd_touch_xpt2046: "1.0.5" | ||
| atanisoft/esp_lcd_touch_xpt2046: | ||
| version: "1.0.5" | ||
| rules: | ||
| - if: "target in [esp32, esp32s3]" | ||
| espressif/esp_lcd_touch_cst816s: "1.0.3" | ||
| espressif/esp_lcd_touch_gt911: "1.1.3" | ||
| espressif/esp_lcd_touch_ft5x06: "1.0.6~1" | ||
|
|
@@ -15,6 +27,8 @@ dependencies: | |
| - if: "target in [esp32s3, esp32p4]" | ||
| espressif/esp_lcd_st7796: | ||
| version: "1.3.4" | ||
| rules: | ||
| - if: "target in [esp32, esp32s3]" | ||
|
Comment on lines
16
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify ST7796 driver compatibility with ESP32-C6. The ST7796 driver is now restricted to 🏁 Script executed: #!/bin/bash
# Check if ST7796 supports ESP32-C6
curl -s "https://components.espressif.com/api/v1/components/espressif/esp_lcd_st7796/versions/1.3.4" | jq -r '.targets[]' 2>/dev/null || echo "Failed to fetch target info"Length of output: 27 I'll search for documentation on the ST7796 driver's ESP32 compatibility to verify ESP32-C6 support. Add ESP32-C6 support is available for ST7796, requiring ESP-IDF V5.1. Update the 🤖 Prompt for AI Agents |
||
| espressif/esp_lcd_gc9a01: "2.0.3" | ||
| espressif/esp_lcd_panel_io_additions: "1.0.1" | ||
| espressif/esp_tinyusb: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.