-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #826 from Llgok/master
The addition of support for T-Panel (verified)
- Loading branch information
Showing
8 changed files
with
308 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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,43 @@ | ||
{ | ||
"build": { | ||
"arduino": { | ||
"ldscript": "esp32s3_out.ld" | ||
}, | ||
"core": "esp32", | ||
"extra_flags": [ | ||
"-DARDUINO_ESP32S3_DEV", | ||
"-DARDUINO_USB_MODE=1", | ||
"-DARDUINO_RUNNING_CORE=1", | ||
"-DARDUINO_EVENT_RUNNING_CORE=1" | ||
], | ||
"f_cpu": "240000000L", | ||
"f_flash": "80000000L", | ||
"flash_mode": "qio", | ||
"mcu": "esp32s3", | ||
"variant": "esp32s3" | ||
}, | ||
"connectivity": [ | ||
"wifi" | ||
], | ||
"debug": { | ||
"default_tool": "esp-builtin", | ||
"onboard_tools": [ | ||
"esp-builtin" | ||
], | ||
"openocd_target": "esp32s3.cfg" | ||
}, | ||
"frameworks": [ | ||
"arduino", | ||
"espidf" | ||
], | ||
"name": "ESP32-S3-FLASH-16MB", | ||
"upload": { | ||
"flash_size": "16MB", | ||
"maximum_ram_size": 327680, | ||
"maximum_size": 16777216, | ||
"require_upload_port": true, | ||
"speed": 921600 | ||
}, | ||
"url": "null", | ||
"vendor": "null" | ||
} |
This file contains 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 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 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 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,72 @@ | ||
/* MIT License - Copyright (c) 2019-2024 Francis Van Roie | ||
For full license information read the LICENSE file in the project folder */ | ||
|
||
#if defined(ARDUINO) && (TOUCH_DRIVER == 0x3240) && !defined(HASP_USE_LGFX_TOUCH) | ||
#include <Arduino.h> | ||
#include "ArduinoLog.h" | ||
#include "hasp_conf.h" | ||
#include "touch_driver_cst3240.h" | ||
|
||
#include <Wire.h> | ||
#include "TouchLib.h" | ||
|
||
#include "touch_driver.h" // base class | ||
#include "touch_helper.h" // i2c scanner | ||
|
||
#include "../../hasp/hasp.h" // for hasp_sleep_state | ||
extern uint8_t hasp_sleep_state; | ||
|
||
TouchLib touch(Wire, TOUCH_SDA, TOUCH_SCL, I2C_TOUCH_ADDRESS); | ||
|
||
namespace dev { | ||
|
||
IRAM_ATTR bool TouchCst3240::read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) | ||
{ | ||
touch.read(); | ||
TP_Point t = touch.getPoint(0); | ||
|
||
if((touch.getPointNum() == 1) && (t.pressure > 0) && (t.state != 0)) { | ||
|
||
if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle | ||
|
||
#ifdef TOUCH_WIDTH | ||
data->point.x = map(t.x, 0, TOUCH_WIDTH - 1, 0, TFT_WIDTH - 1); | ||
#else | ||
data->point.x = t.x; | ||
#endif | ||
|
||
#ifdef TOUCH_HEIGHT | ||
data->point.y = map(t.y, 0, TOUCH_HEIGHT - 1, 0, TFT_HEIGHT - 1); | ||
#else | ||
data->point.y = t.y; | ||
#endif | ||
|
||
data->state = LV_INDEV_STATE_PR; | ||
hasp_set_sleep_offset(0); // Reset the offset | ||
|
||
} else { | ||
data->state = LV_INDEV_STATE_REL; | ||
} | ||
|
||
/*Return `false` because we are not buffering and no more data to read*/ | ||
return false; | ||
} | ||
|
||
void TouchCst3240::init(int w, int h) | ||
{ | ||
Wire.begin(TOUCH_SDA, TOUCH_SCL, (uint32_t)I2C_TOUCH_FREQUENCY); | ||
if(touch.init() == true) { | ||
LOG_INFO(TAG_DRVR, "CST3240 %s (480x480)", D_SERVICE_STARTED); | ||
} else { | ||
LOG_WARNING(TAG_DRVR, "CST3240 %s", D_SERVICE_START_FAILED); | ||
} | ||
|
||
Wire.begin(TOUCH_SDA, TOUCH_SCL, (uint32_t)I2C_TOUCH_FREQUENCY); | ||
touch_scan(Wire); // The address could change during begin, so scan afterwards | ||
} | ||
|
||
} // namespace dev | ||
|
||
dev::TouchCst3240 haspTouch; | ||
|
||
#endif // ARDUINO |
This file contains 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,26 @@ | ||
/* MIT License - Copyright (c) 2019-2024 Francis Van Roie | ||
For full license information read the LICENSE file in the project folder */ | ||
|
||
#ifndef HASP_CST3240_TOUCH_DRIVER_H | ||
#define HASP_CST3240_TOUCH_DRIVER_H | ||
|
||
#ifdef ARDUINO | ||
#include "lvgl.h" | ||
#include "touch_driver.h" | ||
|
||
namespace dev { | ||
|
||
class TouchCst3240 : public BaseTouch { | ||
public: | ||
IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data); | ||
void init(int w, int h); | ||
}; | ||
|
||
} // namespace dev | ||
|
||
using dev::TouchCst3240; | ||
extern dev::TouchCst3240 haspTouch; | ||
|
||
#endif // ARDUINO | ||
|
||
#endif // HASP_CST3240_TOUCH_DRIVER_H |
This file contains 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 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 |
---|---|---|
|
@@ -8,17 +8,30 @@ | |
|
||
[lilygo-t-panel] | ||
extends = arduino_esp32s3_v2 | ||
board = esp32-s3-devkitc-1 | ||
board_build.arduino.memory_type = qio_opi | ||
board = esp32s3_flash_16MB | ||
|
||
; board_build.memory_type = qio_opi ;Enable internal PSRAM | ||
board_build.memory_type = qio_qspi ;Enable external PSRAM | ||
|
||
board_upload.flash_size = 16MB | ||
board_build.partitions = default_16MB.csv | ||
|
||
build_flags = | ||
-D HASP_MODEL="Lilygo T-Panel v1.2" | ||
${arduino_esp32s3_v2.build_flags} | ||
${esp32s3.ps_ram} | ||
-DLILYGO_T_PANEL | ||
-D LILYGO_T_PANEL=1 | ||
;-DARDUINO_USB_CDC_ON_BOOT | ||
;-DUSE_USB_CDC_CONSOLE | ||
|
||
-Wall ;all errors that everybody could agree on | ||
-Wextra ;somebody agree on | ||
; -Werror ;Think of "Warning" as "Error". | ||
; -D CORE_DEBUG_LEVEL=1 ;Debug level 0-5 | ||
-D BOARD_HAS_PSRAM ;Enable external PSRAM | ||
-D ARDUINO_USB_MODE=1 | ||
-D ARDUINO_USB_CDC_ON_BOOT=0 ;1 is to use the USB port as a serial port | ||
-D ARDUINO_RUNNING_CORE=1 ; Arduino Runs On Core (setup, loop) | ||
-D ARDUINO_EVENT_RUNNING_CORE=1 ; Events Run On Core | ||
|
||
;region -- ArduinoGFX build options ------------------------ | ||
-D HASP_USE_ARDUINOGFX=1 | ||
|
@@ -49,27 +62,29 @@ build_flags = | |
-D TFT_BCKL=14 | ||
|
||
; Touch Settings | ||
-D TOUCH_MODULES_CST_MUTUAL | ||
-D TOUCH_DRIVER=0x3240 | ||
-D TOUCH_WIDTH=480 | ||
-D TOUCH_HEIGHT=480 | ||
-D TOUCH_SDA=17 | ||
-D TOUCH_SCL=18 | ||
-D TOUCH_INT=21 | ||
-D TOUCH_RST=4 | ||
-D TOUCH_RST=-1 | ||
-D TOUCH_CS=-1 | ||
-D TOUCH_DRIVER=0x3240 | ||
; -D TOUCH_IRQ= | ||
; -D I2C_TOUCH_FREQUENCY= | ||
; -D I2C_TOUCH_ADDRESS= | ||
-D TOUCH_IRQ=TOUCH_INT | ||
-D I2C_TOUCH_FREQUENCY=400000UL | ||
-D I2C_TOUCH_ADDRESS=0x5A | ||
; -D I2C_TOUCH_PORT= | ||
|
||
-D LV_DISP_DEF_REFR_PERIOD=10 | ||
|
||
;endregion | ||
|
||
lib_deps = | ||
${arduino_esp32s3_v2.lib_deps} | ||
; moononournation/GFX Library for [email protected] ; Update needs modification of custom PCA class ; ${ft6336.lib_deps} | ||
; ; git+https://github.com/admarschoonen/TouchLib.git | ||
; moononournation/GFX Library for [email protected] ; | ||
git+https://github.com/mmMicky/TouchLib.git | ||
moononournation/GFX Library for [email protected] | ||
[env:lilygo-t-panel_16MB] | ||
extends = lilygo-t-panel, flash_16mb | ||
monitor_port = COM8 | ||
upload_port = COM8 | ||
; monitor_port = COM8 | ||
; upload_port = COM8 |