-
Notifications
You must be signed in to change notification settings - Fork 43
Elecrow 5 and 7 inches support #309
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
themelisx
wants to merge
14
commits into
jgauchia:devel
Choose a base branch
from
themelisx:elecrow_support_5_and_7_inches
base: devel
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
14 commits
Select commit
Hold shift + click to select a range
1c5ae23
Merge pull request #227 from jgauchia/devel
jgauchia a2af2a5
Merge pull request #254 from jgauchia/devel
jgauchia 769fa25
Merge pull request #255 from jgauchia/devel
jgauchia 9255b0b
Merge pull request #263 from jgauchia/devel
jgauchia 8df8d23
New Release
jgauchia 67ec113
Merge pull request #290 from jgauchia/devel
jgauchia 50f962b
Elecrow 5 and 7 inches support
themelisx b57970a
platformio fixes
themelisx 263275b
code cleanup
themelisx deaa7d1
build error fix
themelisx 8a7f496
touch screen fixes
themelisx 3001885
GIOP port fix
themelisx 347f218
wip
themelisx 677009e
Merge branch 'master' into elecrow_support_5_and_7_inches
themelisx 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| { | ||
| "build": { | ||
| "arduino":{ | ||
| "ldscript": "esp32s3_out.ld", | ||
| "partitions": "elecrow_4MB.csv", | ||
| "memory_type": "qio_opi" | ||
| }, | ||
| "core": "esp32", | ||
| "extra_flags": [ | ||
| "-DARDUINO_ESP32S3_DEV", | ||
| "-DBOARD_HAS_PSRAM", | ||
| "-DARDUINO_USB_MODE=1", | ||
| "-DARDUINO_USB_CDC_ON_BOOT=1" | ||
| ], | ||
| "f_cpu": "240000000L", | ||
| "f_flash": "80000000L", | ||
| "flash_mode": "qio", | ||
| "psram_type": "opi", | ||
| "hwids": [ | ||
| [ | ||
| "0x303A", | ||
| "0x1001" | ||
| ] | ||
| ], | ||
| "mcu": "esp32s3", | ||
| "variant": "esp32s3" | ||
| }, | ||
| "connectivity": [ | ||
| "wifi", | ||
| "bluetooth" | ||
| ], | ||
| "debug": { | ||
| "default_tool": "esp-builtin", | ||
| "onboard_tools": [ | ||
| "esp-builtin" | ||
| ], | ||
| "openocd_target": "esp32s3.cfg" | ||
| }, | ||
| "frameworks": [ | ||
| "arduino", | ||
| "espidf" | ||
| ], | ||
| "name": "ESP32-S3 DevKitC-1 4MB Elecrow", | ||
| "upload": { | ||
| "flash_size": "4MB", | ||
| "maximum_size": 4194304, | ||
| "maximum_ram_size": 327680, | ||
| "require_upload_port": true, | ||
| "speed": 921600 | ||
| }, | ||
| "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html", | ||
| "vendor": "Espressif" | ||
| } |
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,6 @@ | ||
| # Name, Type, SubType, Offset, Size | ||
| nvs, data, nvs, 0x9000, 0x5000 | ||
| otadata, data, ota, 0xE000, 0x2000 | ||
| app0, app, ota_0, 0x10000, 0x2E5000 | ||
| spiffs, data, spiffs, 0x2F5000, 0x030000 | ||
| coredump, data, coredump,0x325000, 0x008000 |
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,220 @@ | ||
| /******************************************************************************* | ||
| * Touch libraries: | ||
| * FT6X36: https://github.com/strange-v/FT6X36.git | ||
| * GT911: https://github.com/TAMCTec/gt911-arduino.git | ||
| * XPT2046: https://github.com/PaulStoffregen/XPT2046_Touchscreen.git | ||
| ******************************************************************************/ | ||
|
|
||
| /* uncomment for FT6X36 */ | ||
| // #define TOUCH_FT6X36 | ||
| // #define TOUCH_FT6X36_SCL 38//19 | ||
| // #define TOUCH_FT6X36_SDA 37//18 | ||
| // #define TOUCH_FT6X36_INT 4//39 | ||
| // #define TOUCH_SWAP_XY | ||
| // #define TOUCH_MAP_X1 800 | ||
| // #define TOUCH_MAP_X2 0 | ||
| // #define TOUCH_MAP_Y1 0 | ||
| // #define TOUCH_MAP_Y2 480 | ||
|
|
||
| /* uncomment for GT911 */ | ||
| #define TOUCH_GT911 | ||
| #define TOUCH_GT911_SCL 20//20 | ||
| #define TOUCH_GT911_SDA 19//19 | ||
| #define TOUCH_GT911_INT -1//-1 | ||
| #define TOUCH_GT911_RST -1//38 | ||
| #define TOUCH_GT911_ROTATION ROTATION_NORMAL | ||
| #define TOUCH_MAP_X1 800//480 | ||
| #define TOUCH_MAP_X2 0 | ||
| #define TOUCH_MAP_Y1 480//272 | ||
| #define TOUCH_MAP_Y2 0 | ||
|
|
||
| /* uncomment for XPT2046 */ | ||
| // #define TOUCH_XPT2046 | ||
| // #define TOUCH_XPT2046_SCK 12 | ||
| // #define TOUCH_XPT2046_MISO 13 | ||
| // #define TOUCH_XPT2046_MOSI 11 | ||
| // #define TOUCH_XPT2046_CS 38 | ||
| // #define TOUCH_XPT2046_INT 36 | ||
| // #define TOUCH_XPT2046_ROTATION 0 | ||
| // #define TOUCH_MAP_X1 4000 | ||
| // #define TOUCH_MAP_X2 100 | ||
| // #define TOUCH_MAP_Y1 100 | ||
| // #define TOUCH_MAP_Y2 4000 | ||
|
|
||
| LGFX lcd; | ||
|
|
||
| int touch_last_x = 0, touch_last_y = 0; | ||
|
|
||
| #if defined(TOUCH_FT6X36) | ||
| #include <Wire.h> | ||
| #include <FT6X36.h> | ||
| FT6X36 ts(&Wire, TOUCH_FT6X36_INT); | ||
| bool touch_touched_flag = true, touch_released_flag = true; | ||
|
|
||
| #elif defined(TOUCH_GT911) | ||
| #include <Wire.h> | ||
| #include <TAMC_GT911.h> | ||
| TAMC_GT911 ts = TAMC_GT911(TOUCH_GT911_SDA, TOUCH_GT911_SCL, TOUCH_GT911_INT, TOUCH_GT911_RST, max(TOUCH_MAP_X1, TOUCH_MAP_X2), max(TOUCH_MAP_Y1, TOUCH_MAP_Y2)); | ||
|
|
||
| #elif defined(TOUCH_XPT2046) | ||
| #include <XPT2046_Touchscreen.h> | ||
| #include <SPI.h> | ||
| XPT2046_Touchscreen ts(TOUCH_XPT2046_CS, TOUCH_XPT2046_INT); | ||
|
|
||
| #endif | ||
|
|
||
| #if defined(TOUCH_FT6X36) | ||
| void touch(TPoint p, TEvent e) | ||
| { | ||
| if (e != TEvent::Tap && e != TEvent::DragStart && e != TEvent::DragMove && e != TEvent::DragEnd) | ||
| { | ||
| return; | ||
| } | ||
| // translation logic depends on screen rotation | ||
| #if defined(TOUCH_SWAP_XY) | ||
| touch_last_x = map(p.y, TOUCH_MAP_X1, TOUCH_MAP_X2, 0, lcd.width()); | ||
| touch_last_y = map(p.x, TOUCH_MAP_Y1, TOUCH_MAP_Y2, 0, lcd.height()); | ||
| #else | ||
| touch_last_x = map(p.x, TOUCH_MAP_X1, TOUCH_MAP_X2, 0, lcd.width()); | ||
| touch_last_y = map(p.y, TOUCH_MAP_Y1, TOUCH_MAP_Y2, 0, lcd.height()); | ||
| #endif | ||
| switch (e) | ||
| { | ||
| case TEvent::Tap: | ||
| Serial.println("Tap"); | ||
| touch_touched_flag = true; | ||
| touch_released_flag = true; | ||
| break; | ||
| case TEvent::DragStart: | ||
| Serial.println("DragStart"); | ||
| touch_touched_flag = true; | ||
| break; | ||
| case TEvent::DragMove: | ||
| Serial.println("DragMove"); | ||
| touch_touched_flag = true; | ||
| break; | ||
| case TEvent::DragEnd: | ||
| Serial.println("DragEnd"); | ||
| touch_released_flag = true; | ||
| break; | ||
| default: | ||
| Serial.println("UNKNOWN"); | ||
| break; | ||
| } | ||
| } | ||
| #endif | ||
|
|
||
| void touch_init() | ||
| { | ||
| #if defined(TOUCH_FT6X36) | ||
| Wire.begin(TOUCH_FT6X36_SDA, TOUCH_FT6X36_SCL); | ||
| ts.begin(); | ||
| ts.registerTouchHandler(touch); | ||
|
|
||
| #elif defined(TOUCH_GT911) | ||
| Wire.begin(TOUCH_GT911_SDA, TOUCH_GT911_SCL); | ||
| ts.begin(); | ||
| ts.setRotation(TOUCH_GT911_ROTATION); | ||
|
|
||
| #elif defined(TOUCH_XPT2046) | ||
| SPI.begin(TOUCH_XPT2046_SCK, TOUCH_XPT2046_MISO, TOUCH_XPT2046_MOSI, TOUCH_XPT2046_CS); | ||
| ts.begin(); | ||
| ts.setRotation(TOUCH_XPT2046_ROTATION); | ||
|
|
||
| #endif | ||
| } | ||
|
|
||
| bool touch_has_signal() | ||
| { | ||
| #if defined(TOUCH_FT6X36) | ||
| ts.loop(); | ||
| return touch_touched_flag || touch_released_flag; | ||
|
|
||
| #elif defined(TOUCH_GT911) | ||
| return true; | ||
|
|
||
| #elif defined(TOUCH_XPT2046) | ||
| return ts.tirqTouched(); | ||
|
|
||
| #else | ||
| return false; | ||
| #endif | ||
| } | ||
|
|
||
| bool touch_touched() | ||
| { | ||
| #if defined(TOUCH_FT6X36) | ||
| if (touch_touched_flag) | ||
| { | ||
| touch_touched_flag = false; | ||
| return true; | ||
| } | ||
| else | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| #elif defined(TOUCH_GT911) | ||
| ts.read(); | ||
| if (ts.isTouched) | ||
| { | ||
| #if defined(TOUCH_SWAP_XY) | ||
| touch_last_x = map(ts.points[0].y, TOUCH_MAP_X1, TOUCH_MAP_X2, 0, lcd.width() - 1); | ||
| touch_last_y = map(ts.points[0].x, TOUCH_MAP_Y1, TOUCH_MAP_Y2, 0, lcd.height() - 1); | ||
| #else | ||
| touch_last_x = map(ts.points[0].x, TOUCH_MAP_X1, TOUCH_MAP_X2, 0, lcd.width() - 1); | ||
| touch_last_y = map(ts.points[0].y, TOUCH_MAP_Y1, TOUCH_MAP_Y2, 0, lcd.height() - 1); | ||
| #endif | ||
| return true; | ||
| } | ||
| else | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| #elif defined(TOUCH_XPT2046) | ||
| if (ts.touched()) | ||
| { | ||
| TS_Point p = ts.getPoint(); | ||
| #if defined(TOUCH_SWAP_XY) | ||
| touch_last_x = map(p.y, TOUCH_MAP_X1, TOUCH_MAP_X2, 0, lcd.width() - 1); | ||
| touch_last_y = map(p.x, TOUCH_MAP_Y1, TOUCH_MAP_Y2, 0, lcd.height() - 1); | ||
| #else | ||
| touch_last_x = map(p.x, TOUCH_MAP_X1, TOUCH_MAP_X2, 0, lcd.width() - 1); | ||
| touch_last_y = map(p.y, TOUCH_MAP_Y1, TOUCH_MAP_Y2, 0, lcd.height() - 1); | ||
| #endif | ||
| return true; | ||
| } | ||
| else | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| #else | ||
| return false; | ||
| #endif | ||
| } | ||
|
|
||
| bool touch_released() | ||
| { | ||
| #if defined(TOUCH_FT6X36) | ||
| if (touch_released_flag) | ||
| { | ||
| touch_released_flag = false; | ||
| return true; | ||
| } | ||
| else | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| #elif defined(TOUCH_GT911) | ||
| return true; | ||
|
|
||
| #elif defined(TOUCH_XPT2046) | ||
| return true; | ||
|
|
||
| #else | ||
| return false; | ||
| #endif | ||
| } | ||
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
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.
Workaround.. I think LovyanGFX has support for GT911 touch