-
-
Notifications
You must be signed in to change notification settings - Fork 85
Add CYD-2432S024R Support #521
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
Draft
NellowTCS
wants to merge
11
commits into
TactilityProject:main
Choose a base branch
from
NellowTCS:cyd-2.4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3933d81
Add cyd-2432s024r config
NellowTCS 30d853e
Rechecking manufacturer docs
NellowTCS cdd2770
Should be correct now, enabling ci to test
NellowTCS 7117e6c
Update display configuration for swapXY and rgbElementOrder
NellowTCS 5441340
Modify display and touch configuration
NellowTCS 5d11ade
Modify display settings for axis swapping and mirroring
NellowTCS 08dec05
Fix formatting of mirrorY parameter in Display.cpp
NellowTCS e92898a
Change mirrorX and mirrorY settings to false
NellowTCS 4a1cf32
This works but is uncalibrated
NellowTCS aea0d74
Mirror X
NellowTCS 0a515cf
Mirror Y
NellowTCS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 ILI934x XPT2046 PwmBacklight driver vfs fatfs | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #include "devices/Display.h" | ||
| #include "devices/SdCard.h" | ||
| #include <driver/gpio.h> | ||
|
|
||
| #include <Tactility/hal/Configuration.h> | ||
| #include <Tactility/lvgl/LvglSync.h> | ||
| #include <PwmBacklight.h> | ||
|
|
||
| using namespace tt::hal; | ||
|
|
||
| static bool initBoot() { | ||
| // // Set the RGB LED Pins to output and turn them off | ||
| // ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_27, GPIO_MODE_OUTPUT)); // Red | ||
| // ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_12, GPIO_MODE_OUTPUT)); // Green | ||
| // ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_13, GPIO_MODE_OUTPUT)); // Blue | ||
|
|
||
| // // 0 on, 1 off | ||
| // ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_27, 1)); // Red | ||
| // ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_12, 1)); // Green | ||
| // ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_13, 1)); // Blue | ||
|
Contributor
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. Comments can be removed |
||
|
|
||
| return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT); | ||
| } | ||
|
|
||
| static DeviceVector createDevices() { | ||
| return { | ||
| createDisplay(), | ||
| createSdCard() | ||
| }; | ||
| } | ||
|
|
||
| extern const Configuration hardwareConfiguration = { | ||
| .initBoot = initBoot, | ||
| .createDevices = createDevices | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #include "Display.h" | ||
| #include "Xpt2046Touch.h" | ||
| #include <Ili934xDisplay.h> | ||
| #include <PwmBacklight.h> | ||
|
|
||
| static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch(esp_lcd_spi_bus_handle_t spiDevice) { | ||
| auto configuration = std::make_unique<Xpt2046Touch::Configuration>( | ||
| spiDevice, | ||
| TOUCH_CS_PIN, | ||
| LCD_HORIZONTAL_RESOLUTION, | ||
| LCD_VERTICAL_RESOLUTION, | ||
| true, // swapXY | ||
| false, // mirrorX | ||
| true // mirrorY | ||
| ); | ||
| return std::make_shared<Xpt2046Touch>(std::move(configuration)); | ||
| } | ||
|
|
||
| std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() { | ||
| auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration { | ||
| .spiHostDevice = LCD_SPI_HOST, | ||
| .csPin = LCD_PIN_CS, | ||
| .dcPin = LCD_PIN_DC, | ||
| .pixelClockFrequency = 40'000'000, | ||
| .transactionQueueDepth = 10 | ||
| }); | ||
|
|
||
| Ili934xDisplay::Configuration panel_configuration = { | ||
| .horizontalResolution = LCD_HORIZONTAL_RESOLUTION, | ||
| .verticalResolution = LCD_VERTICAL_RESOLUTION, | ||
| .gapX = 0, | ||
| .gapY = 0, | ||
| .swapXY = true, | ||
| .mirrorX = true, | ||
| .mirrorY = true, | ||
| .invertColor = false, | ||
| .swapBytes = true, | ||
| .bufferSize = LCD_BUFFER_SIZE, | ||
| .touch = createTouch(spi_configuration->spiHostDevice), | ||
| .backlightDutyFunction = driver::pwmbacklight::setBacklightDuty, | ||
| .resetPin = LCD_PIN_RST, | ||
| .rgbElementOrder = LCD_RGB_ELEMENT_ORDER_RGB | ||
| }; | ||
|
|
||
| return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #pragma once | ||
|
|
||
| #include <Tactility/hal/display/DisplayDevice.h> | ||
| #include <driver/gpio.h> | ||
| #include <driver/spi_common.h> | ||
| #include <memory> | ||
|
|
||
| // Display | ||
| 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_RST = GPIO_NUM_NC; // tied to ESP32 RST | ||
| constexpr auto LCD_PIN_CLK = GPIO_NUM_14; | ||
| constexpr auto LCD_PIN_MOSI = GPIO_NUM_13; | ||
| constexpr auto LCD_PIN_MISO = GPIO_NUM_12; | ||
| 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; | ||
|
|
||
| // Backlight | ||
| constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_27; | ||
|
|
||
| // Touch | ||
| constexpr auto TOUCH_CS_PIN = GPIO_NUM_33; | ||
| constexpr auto TOUCH_IRQ_PIN = GPIO_NUM_36; | ||
|
|
||
| std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #include "SdCard.h" | ||
| #include <tactility/device.h> | ||
| #include <Tactility/hal/sdcard/SpiSdCardDevice.h> | ||
|
|
||
| using tt::hal::sdcard::SpiSdCardDevice; | ||
|
|
||
| std::shared_ptr<SdCardDevice> createSdCard() { | ||
| auto config = std::make_unique<SpiSdCardDevice::Config>( | ||
| GPIO_NUM_5, | ||
| GPIO_NUM_NC, | ||
| GPIO_NUM_NC, | ||
| GPIO_NUM_NC, | ||
| SdCardDevice::MountBehaviour::AtBoot, | ||
| nullptr, | ||
| std::vector<gpio_num_t>(), | ||
| SPI3_HOST | ||
| ); | ||
|
|
||
| auto* spi_controller = device_find_by_name("spi1"); | ||
| check(spi_controller, "spi1 not found"); | ||
|
|
||
| return std::make_shared<SpiSdCardDevice>(std::move(config), spi_controller); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #pragma once | ||
|
|
||
| #include "Tactility/hal/sdcard/SdCardDevice.h" | ||
|
|
||
| using tt::hal::sdcard::SdCardDevice; | ||
|
|
||
| std::shared_ptr<SdCardDevice> createSdCard(); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #include <tactility/module.h> | ||
|
|
||
| extern "C" { | ||
|
|
||
| static error_t start() { | ||
| // Empty for now | ||
| return ERROR_NONE; | ||
| } | ||
|
|
||
| static error_t stop() { | ||
| // Empty for now | ||
| return ERROR_NONE; | ||
| } | ||
|
|
||
| struct Module cyd_2432s024r_module = { | ||
| .name = "cyd-2432s024r", | ||
| .start = start, | ||
| .stop = stop, | ||
| .symbols = nullptr, | ||
| .internal = nullptr | ||
| }; | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /dts-v1/; | ||
|
|
||
| #include <tactility/bindings/root.h> | ||
| #include <tactility/bindings/esp32_gpio.h> | ||
| #include <tactility/bindings/esp32_spi.h> | ||
| #include <tactility/bindings/esp32_uart.h> | ||
|
|
||
| / { | ||
| compatible = "root"; | ||
| model = "CYD 2432S024R"; | ||
|
|
||
| gpio0 { | ||
| compatible = "espressif,esp32-gpio"; | ||
| gpio-count = <40>; | ||
| }; | ||
|
|
||
| display_spi: spi0 { | ||
| compatible = "espressif,esp32-spi"; | ||
| host = <SPI2_HOST>; | ||
| pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>; | ||
| pin-miso = <&gpio0 12 GPIO_FLAG_NONE>; | ||
| pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>; | ||
| }; | ||
|
|
||
| sdcard_spi: spi1 { | ||
| compatible = "espressif,esp32-spi"; | ||
| host = <SPI3_HOST>; | ||
| pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>; | ||
| pin-miso = <&gpio0 19 GPIO_FLAG_NONE>; | ||
| pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>; | ||
| }; | ||
|
|
||
| uart1 { | ||
| compatible = "espressif,esp32-uart"; | ||
| port = <UART_NUM_1>; | ||
| pin-tx = <&gpio0 1 GPIO_FLAG_NONE>; | ||
| pin-rx = <&gpio0 3 GPIO_FLAG_NONE>; | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| [general] | ||
| vendor=CYD | ||
| name=2432S024R | ||
|
|
||
| [apps] | ||
| launcherAppId=Launcher | ||
|
|
||
| [hardware] | ||
| target=ESP32 | ||
| flashSize=4MB | ||
| spiRam=false | ||
|
|
||
| [display] | ||
| size=2.4" | ||
| shape=rectangle | ||
| dpi=167 | ||
|
|
||
| [lvgl] | ||
| colorDepth=16 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| dependencies: | ||
| - Platforms/platform-esp32 | ||
| dts: cyd,2432s024r.dts |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you forgot to remove this