Add Yeacreate Nscreen32

This commit is contained in:
fvanroie 2021-06-22 23:14:16 +02:00
parent b6072c08ed
commit 37face7114
8 changed files with 132 additions and 14 deletions

View File

@ -44,7 +44,7 @@ jobs:
run: | run: |
cat platformio_override.ini cat platformio_override.ini
- name: Run PlatformIO - name: Run PlatformIO
run: pio run -e d1-mini-esp32_ili9341 -e esp32-touchdown -e freetouchdeck -e huzzah32-featherwing-24 -e huzzah32-featherwing-35 -e lanbon_l8 -e m5stack-core2 -e wt32-sc01 -e d1-mini-esp8266_ili9341 -e linux_sdl_64bits run: pio run -e yeacreate-nscreen32 -e d1-mini-esp32_ili9341 -e esp32-touchdown -e freetouchdeck -e huzzah32-featherwing-24 -e huzzah32-featherwing-35 -e lanbon_l8 -e m5stack-core2 -e wt32-sc01 -e d1-mini-esp8266_ili9341 -e linux_sdl_64bits
- name: Upload output file - name: Upload output file
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:

View File

@ -48,7 +48,7 @@ jobs:
run: | run: |
cat platformio_override.ini cat platformio_override.ini
- name: Run PlatformIO - name: Run PlatformIO
run: pio run -e d1-mini-esp32_ili9341 -e esp32-touchdown -e freetouchdeck -e huzzah32-featherwing-24 -e huzzah32-featherwing-35 -e lanbon_l8 -e m5stack-core2 -e wt32-sc01 -e d1-mini-esp8266_ili9341 -e linux_sdl_64bits run: pio run -e yeacreate-nscreen32 -e d1-mini-esp32_ili9341 -e esp32-touchdown -e freetouchdeck -e huzzah32-featherwing-24 -e huzzah32-featherwing-35 -e lanbon_l8 -e m5stack-core2 -e wt32-sc01 -e d1-mini-esp8266_ili9341 -e linux_sdl_64bits
- name: Upload output file - name: Upload output file
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:

View File

@ -1,4 +1,5 @@
#if TOUCH_DRIVER == 911 /*
#if TOUCH_DRIVER == 91100
#include <Wire.h> #include <Wire.h>
#include "Goodix.h" #include "Goodix.h"
@ -105,4 +106,5 @@ void GT911_loop()
{ {
touch.loop(); touch.loop();
} }
#endif #endif
*/

View File

@ -1,10 +1,11 @@
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie /* MIT License - Copyright (c) 2019-2021 Francis Van Roie
For full license information read the LICENSE file in the project folder */ For full license information read the LICENSE file in the project folder */
/*
#ifndef HASP_DRV_911_H #ifndef HASP_DRV_911_H
#define HASP_DRV_911_H #define HASP_DRV_911_H
#if TOUCH_DRIVER == 911 #if TOUCH_DRIVER == 91100
#include "hasp_debug.h" // for TAG_DRVR #include "hasp_debug.h" // for TAG_DRVR
@ -13,4 +14,5 @@ void GT911_init();
void GT911_loop(); void GT911_loop();
#endif #endif
#endif #endif
*/

View File

@ -63,7 +63,7 @@ void drv_touch_init(uint8_t rotation)
#endif #endif
#elif TOUCH_DRIVER == 911 #elif TOUCH_DRIVER == 911
GT911_init(); // GT911_init();
#elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller #elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller
// Touch_init(); // Touch_init();
@ -96,7 +96,7 @@ static inline bool drv_touchpad_getXY(int16_t* touchX, int16_t* touchY)
touched = XPT2046_getXY(&normal_x, &normal_y, true); touched = XPT2046_getXY(&normal_x, &normal_y, true);
#elif TOUCH_DRIVER == 911 #elif TOUCH_DRIVER == 911
touched = GT911_getXY(&normal_x, &normal_y, true); // touched = GT911_getXY(&normal_x, &normal_y, true);
#elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller #elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller
touched = Touch_getXY(&normal_x, &normal_y, false); touched = Touch_getXY(&normal_x, &normal_y, false);
@ -221,6 +221,6 @@ IRAM_ATTR bool drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* dat
IRAM_ATTR void drv_touch_loop() IRAM_ATTR void drv_touch_loop()
{ {
#if TOUCH_DRIVER == 911 #if TOUCH_DRIVER == 911
GT911_loop(); // GT911_loop();
#endif #endif
} }

View File

@ -51,15 +51,18 @@ class BaseTouch {
#warning Building for XPT2046 #warning Building for XPT2046
//#include "touch_driver_xpt2046.h" //#include "touch_driver_xpt2046.h"
#include "touch_driver_tftespi.h" #include "touch_driver_tftespi.h"
#elif TOUCH_DRIVER == 5206
#warning Building for FT5206
#include "touch_driver_ft5206.h"
#elif TOUCH_DRIVER == 6336 #elif TOUCH_DRIVER == 6336
#warning Building for FT6336 #warning Building for FT6336
#include "touch_driver_ft6336u.h" #include "touch_driver_ft6336u.h"
#elif TOUCH_DRIVER == 610 #elif TOUCH_DRIVER == 610
#warning Building for STMPE610 #warning Building for STMPE610
#include "touch_driver_stmpe610.h" #include "touch_driver_stmpe610.h"
#elif TOUCH_DRIVER == 5206 #elif TOUCH_DRIVER == 911
#warning Building for FT5206 #warning Building for GT911
#include "touch_driver_ft5206.h" #include "touch_driver_gt911.h"
#else #else
#warning Building for Generic Touch #warning Building for Generic Touch
using dev::BaseTouch; using dev::BaseTouch;

View File

@ -0,0 +1,110 @@
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie
For full license information read the LICENSE file in the project folder */
#ifndef HASP_GT911_TOUCH_DRIVER_H
#define HASP_GT911_TOUCH_DRIVER_H
#ifdef ARDUINO
#include "hasp_conf.h"
#include "Arduino.h"
#include <Wire.h>
#include "Goodix.h"
#include "ArduinoLog.h"
#include "touch_driver.h" // base class
#include "../../hasp/hasp.h" // for hasp_sleep_state
extern uint8_t hasp_sleep_state;
#define INT_PIN (TOUCH_IRQ)
#define RST_PIN (TOUCH_RST) // -1 if pin is connected to VCC else set pin number
static Goodix touch = Goodix();
// static int8_t GT911_num_touches;
// static GTPoint* GT911_points;
// Store touch points into global variable
IRAM_ATTR void GT911_setXY(int8_t contacts, GTPoint* points)
{
// GT911_num_touches = contacts;
// GT911_points = points;
// LOG_VERBOSE(TAG_GUI, F("Contacts: %d"), contacts);
// for(int i = 0; i < contacts; i++) {
// LOG_VERBOSE(TAG_GUI, F("C%d: #%d %d,%d s:%d"), i, points[i].trackId, points[i].x, points[i].y,
// points[i].area); yield();
// }
}
IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
{
// LOG_VERBOSE(TAG_GUI, F("Contacts: %d"), GT911_num_touches);
static GTPoint points[5];
if(touch.readInput((uint8_t*)&points)>0) {
if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle
data->point.x = points[0].x;
data->point.y = points[0].y;
data->state = LV_INDEV_STATE_PR;
} else {
data->state = LV_INDEV_STATE_REL;
}
touch.loop(); // reset IRQ
/*Return `false` because we are not buffering and no more data to read*/
return false;
}
namespace dev {
class TouchGt911 : public BaseTouch {
public:
IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
{
return touch_read(indev_driver, data);
}
void init(int w, int h)
{
Wire.begin(TOUCH_SDA, TOUCH_SCL, I2C_TOUCH_FREQUENCY);
delay(300);
touch.setHandler(GT911_setXY);
if(touch.begin(INT_PIN, RST_PIN)) {
LOG_VERBOSE(TAG_DRVR, F("Goodix GT911 reset OK"));
} else {
LOG_WARNING(TAG_DRVR, F("Goodix GT911 reset failed"));
}
Serial.print("Check ACK on addr request on 0x");
// Serial.print(touch.i2cAddr, HEX);
// Wire.beginTransmission(touch.i2cAddr);
int error;
// = Wire.endTransmission();
if(error == 0) {
// Serial.println(": SUCCESS");
} else {
// Serial.print(": ERROR #");
// Serial.println(error);
}
LOG_INFO(TAG_DRVR, F("Goodix GT911 touch driver started"));
}
};
} // namespace dev
using dev::TouchGt911;
extern dev::TouchGt911 haspTouch;
#endif // ARDUINO
#endif // HASP_GT911_TOUCH_DRIVER_H

View File

@ -43,7 +43,8 @@ build_flags =
-D TOUCH_SCL=22 -D TOUCH_SCL=22
-D TOUCH_IRQ=5 -D TOUCH_IRQ=5
-D TOUCH_RST=23 -D TOUCH_RST=23
-D TOUCH_FREQUENCY=400000 ;-D TOUCH_FREQUENCY=400000
-D I2C_TOUCH_FREQUENCY=400000
-D SPI_FREQUENCY=40000000 -D SPI_FREQUENCY=40000000
-D SPI_READ_FREQUENCY=20000000 -D SPI_READ_FREQUENCY=20000000
;endregion ;endregion
@ -55,7 +56,7 @@ build_flags =
lib_deps = lib_deps =
${env.lib_deps} ${env.lib_deps}
${esp32.lib_deps} ${esp32.lib_deps}
git+https://github.com/aselectroworks/Arduino-FT6336U.git git+https://github.com/netwizeBE/arduino-goodix.git
lib_ignore = lib_ignore =
${env.lib_ignore} ${env.lib_ignore}