mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
Merge branch 'master' of https://github.com/HASwitchPlate/openHASP
This commit is contained in:
commit
bfe590741a
@ -112,7 +112,7 @@ lib_deps =
|
||||
|
||||
[arduinogfx]
|
||||
lib_deps =
|
||||
moononournation/GFX Library for Arduino@1.4.0 ; Update needs modification of custom PCA class
|
||||
moononournation/GFX Library for Arduino@1.4.7 ; Update needs modification of custom PCA class
|
||||
;git+https://github.com/moononournation/Arduino_GFX.git
|
||||
|
||||
[tft_espi]
|
||||
|
@ -17,7 +17,7 @@ Contributors:
|
||||
/----------------------------------------------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#if defined(ARDUINO) && defined(LGFX_USE_V1)
|
||||
#if defined(ARDUINO) && defined(LGFX_USE_V1) && !defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "LovyanGFX.hpp"
|
||||
|
@ -32,6 +32,7 @@ enum lv_hasp_obj_type_t {
|
||||
TFT_PANEL_RM68140,
|
||||
TFT_PANEL_RGB,
|
||||
TFT_PANEL_EPD,
|
||||
TFT_PANEL_GC9A01,
|
||||
TFT_PANEL_LAST,
|
||||
};
|
||||
|
||||
|
@ -85,6 +85,10 @@ void ArduinoGfx::init(int w, int h)
|
||||
/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
|
||||
tft = new Arduino_RGB_Display(w, h, rgbpanel, 0 /* rotation */, TFT_AUTO_FLUSH, bus, TFT_RST,
|
||||
st7701_type1_init_operations, sizeof(st7701_type1_init_operations));
|
||||
#elif(TFT_WIDTH == 480) && (TFT_HEIGHT == 272) && defined(NV3041A_DRIVER)
|
||||
Arduino_DataBus* bus = new Arduino_ESP32QSPI(TFT_CS, TFT_SCK, TFT_D0, TFT_D1, TFT_D2, TFT_D3);
|
||||
Arduino_GFX* g = new Arduino_NV3041A(bus, TFT_RST, TFT_ROTATION, TFT_IPS);
|
||||
tft = g;
|
||||
#elif 1
|
||||
/* Reset is not implemented in the panel */
|
||||
if(TFT_RST != GFX_NOT_DEFINED) {
|
||||
@ -262,6 +266,116 @@ void IRAM_ATTR ArduinoGfx::flush_pixels(lv_disp_drv_t* disp, const lv_area_t* ar
|
||||
|
||||
bool ArduinoGfx::is_driver_pin(uint8_t pin)
|
||||
{
|
||||
if(false // start condition is always needed
|
||||
|
||||
// Use individual checks instead of switch statement, as some case labels could be duplicated
|
||||
#ifdef TFT_MOSI
|
||||
|| (pin == TFT_MOSI)
|
||||
#endif
|
||||
#ifdef TFT_MISO
|
||||
|| (pin == TFT_MISO)
|
||||
#endif
|
||||
#ifdef TFT_SCLK
|
||||
|| (pin == TFT_SCLK)
|
||||
#endif
|
||||
#ifdef TFT_CS
|
||||
|| (pin == TFT_CS)
|
||||
#endif
|
||||
#ifdef TFT_DC
|
||||
|| (pin == TFT_DC)
|
||||
#endif
|
||||
#ifdef TFT_DE
|
||||
|| (pin == TFT_DE)
|
||||
#endif
|
||||
#ifdef TFT_PCLK
|
||||
|| (pin == TFT_PCLK)
|
||||
#endif
|
||||
#ifdef TFT_VSYNC
|
||||
|| (pin == TFT_VSYNC)
|
||||
#endif
|
||||
#ifdef TFT_HSYNC
|
||||
|| (pin == TFT_HSYNC)
|
||||
#endif
|
||||
#ifdef TFT_BCKL
|
||||
|| (pin == TFT_BCKL)
|
||||
#endif
|
||||
#ifdef TFT_RST
|
||||
|| (pin == TFT_RST)
|
||||
#endif
|
||||
#ifdef TFT_BUSY
|
||||
|| (pin == TFT_BUSY)
|
||||
#endif
|
||||
#ifdef TFT_RD
|
||||
|| (pin == TFT_RD)
|
||||
#endif
|
||||
#ifdef TFT_R0
|
||||
|| (pin == TFT_R0)
|
||||
#endif
|
||||
#ifdef TFT_R1
|
||||
|| (pin == TFT_R1)
|
||||
#endif
|
||||
#ifdef TFT_R2
|
||||
|| (pin == TFT_R2)
|
||||
#endif
|
||||
#ifdef TFT_R3
|
||||
|| (pin == TFT_R3)
|
||||
#endif
|
||||
#ifdef TFT_R4
|
||||
|| (pin == TFT_R4)
|
||||
#endif
|
||||
#ifdef TFT_G0
|
||||
|| (pin == TFT_G0)
|
||||
#endif
|
||||
#ifdef TFT_G1
|
||||
|| (pin == TFT_G1)
|
||||
#endif
|
||||
#ifdef TFT_G2
|
||||
|| (pin == TFT_G2)
|
||||
#endif
|
||||
#ifdef TFT_G3
|
||||
|| (pin == TFT_G3)
|
||||
#endif
|
||||
#ifdef TFT_G4
|
||||
|| (pin == TFT_G4)
|
||||
#endif
|
||||
#ifdef TFT_B0
|
||||
|| (pin == TFT_B0)
|
||||
#endif
|
||||
#ifdef TFT_B1
|
||||
|| (pin == TFT_B1)
|
||||
#endif
|
||||
#ifdef TFT_B2
|
||||
|| (pin == TFT_B2)
|
||||
#endif
|
||||
#ifdef TFT_B3
|
||||
|| (pin == TFT_B3)
|
||||
#endif
|
||||
#ifdef TFT_B4
|
||||
|| (pin == TFT_B4)
|
||||
#endif
|
||||
#ifdef TOUCH_SDA
|
||||
|| (pin == TOUCH_SDA)
|
||||
#endif
|
||||
#ifdef TOUCH_SCL
|
||||
|| (pin == TOUCH_SCL)
|
||||
#endif
|
||||
#ifdef TOUCH_RST
|
||||
|| (pin == TOUCH_RST)
|
||||
#endif
|
||||
#ifdef TOUCH_IRQ
|
||||
|| (pin == TOUCH_IRQ)
|
||||
#endif
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
#ifndef TFT_SPI_OVERLAP
|
||||
if((pin >= 12) && (pin <= 14)) return true; // HSPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -299,6 +413,8 @@ const char* ArduinoGfx::get_tft_model()
|
||||
return "R61529";
|
||||
#elif defined(RM68140_DRIVER)
|
||||
return "RM68140";
|
||||
#elif defined(NV3041A_DRIVER)
|
||||
return "NV3041A";
|
||||
#else
|
||||
return "Other";
|
||||
#endif
|
||||
@ -336,6 +452,8 @@ uint32_t ArduinoGfx::get_tft_driver()
|
||||
return 0x61529;
|
||||
#elif defined(RM68140_DRIVER)
|
||||
return 0x68140;
|
||||
#elif defined(NV3041A_DRIVER)
|
||||
return 0x3041A;
|
||||
#else
|
||||
return 0x0;
|
||||
#endif
|
||||
|
@ -94,8 +94,12 @@ static lgfx::Bus_Parallel8* init_parallel_8_bus(Preferences* prefs, int8_t data_
|
||||
cfg.pin_rd = prefs->getInt("rd", TFT_RD);
|
||||
cfg.pin_wr = prefs->getInt("wr", TFT_WR);
|
||||
cfg.pin_rs = prefs->getInt("rs", TFT_DC);
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32C3
|
||||
cfg.freq_write = prefs->getUInt("write_freq", SPI_FREQUENCY);
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
uint8_t port = prefs->getUInt("i2s_port", 0);
|
||||
switch(port) {
|
||||
#if SOC_I2S_NUM > 1
|
||||
@ -328,6 +332,11 @@ lgfx::Panel_Device* LovyanGfx::_init_panel(lgfx::IBus* bus)
|
||||
LOG_VERBOSE(TAG_TFT, F("Panel_RGB"));
|
||||
break;
|
||||
}
|
||||
case TFT_PANEL_GC9A01: {
|
||||
panel = new lgfx::Panel_GC9A01();
|
||||
LOG_VERBOSE(TAG_TFT, F("Panel_GC9A01"));
|
||||
break;
|
||||
}
|
||||
default: { // Needs to be in curly braces
|
||||
LOG_FATAL(TAG_TFT, F(D_SERVICE_START_FAILED ": %s line %d"), __FILE__, __LINE__);
|
||||
}
|
||||
@ -455,6 +464,31 @@ lgfx::ITouch* _init_touch(Preferences* preferences)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TOUCH_DRIVER == 0x816
|
||||
{
|
||||
auto touch = new lgfx::Touch_CST816S();
|
||||
auto cfg = touch->config();
|
||||
|
||||
cfg.x_min = 0;
|
||||
cfg.x_max = TFT_WIDTH - 1;
|
||||
cfg.y_min = 0;
|
||||
cfg.y_max = TFT_HEIGHT - 1;
|
||||
cfg.pin_int = TOUCH_IRQ;
|
||||
cfg.bus_shared = true;
|
||||
cfg.offset_rotation = TOUCH_OFFSET_ROTATION;
|
||||
|
||||
// I2C接続の場合
|
||||
cfg.i2c_port = I2C_TOUCH_PORT;
|
||||
cfg.i2c_addr = I2C_TOUCH_ADDRESS;
|
||||
cfg.pin_sda = TOUCH_SDA;
|
||||
cfg.pin_scl = TOUCH_SCL;
|
||||
cfg.freq = I2C_TOUCH_FREQUENCY;
|
||||
|
||||
touch->config(cfg);
|
||||
return touch;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // HASP_USE_LGFX_TOUCH
|
||||
|
||||
return nullptr;
|
||||
@ -1261,6 +1295,8 @@ const char* LovyanGfx::get_tft_model()
|
||||
return "R61529";
|
||||
#elif defined(RM68140_DRIVER)
|
||||
return "RM68140";
|
||||
#elif defined(GC9A01_DRIVER)
|
||||
return "GC9A01";
|
||||
#else
|
||||
return "Other";
|
||||
#endif
|
||||
@ -1302,6 +1338,8 @@ uint32_t LovyanGfx::get_tft_driver()
|
||||
return TFT_PANEL_EPD;
|
||||
#elif defined(RGB_DRIVER)
|
||||
return TFT_PANEL_RGB;
|
||||
#elif defined(GC9A01_DRIVER)
|
||||
return TFT_PANEL_GC9A01;
|
||||
#else
|
||||
return TFT_PANEL_UNKNOWN;
|
||||
#endif
|
||||
|
@ -212,6 +212,7 @@ int Parser::format_bytes(size_t filesize, char* buf, size_t len)
|
||||
return snprintf_P(buf, len, PSTR("%d" D_DECIMAL_POINT "%02d " D_FILE_SIZE_MEGABYTES), filesize / 100,
|
||||
filesize % 100);
|
||||
|
||||
filesize = filesize / D_FILE_SIZE_DIVIDER; // multiply by 100 for 2 decimal place
|
||||
return snprintf_P(buf, len, PSTR("%d" D_DECIMAL_POINT "%02d " D_FILE_SIZE_GIGABYTES), filesize / 100,
|
||||
filesize % 100);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ void filesystemList()
|
||||
#else
|
||||
if(!HASP_FS.begin(true)) { // default vfs path: /littlefs
|
||||
#endif
|
||||
LOG_ERROR(TAG_FILE, F("Flash file system not mouted."));
|
||||
LOG_ERROR(TAG_FILE, F("Flash file system not mounted."));
|
||||
} else {
|
||||
|
||||
LOG_VERBOSE(TAG_FILE, F("Listing files on the internal flash:"));
|
||||
|
@ -341,7 +341,7 @@ void guiSetup()
|
||||
#endif
|
||||
gui_hide_pointer(false);
|
||||
if(mouse_indev != NULL) {
|
||||
lv_indev_set_cursor(mouse_indev, cursor); /*Connect the image object to the driver*/
|
||||
lv_indev_set_cursor(mouse_indev, cursor); /*Connect the image object to the driver*/
|
||||
}
|
||||
|
||||
#if HASP_TARGET_ARDUINO
|
||||
|
54
user_setups/esp32/ttgo-t-watch.ini
Normal file
54
user_setups/esp32/ttgo-t-watch.ini
Normal file
@ -0,0 +1,54 @@
|
||||
[ttgo-t-watch]
|
||||
|
||||
extends = arduino_esp32_v2
|
||||
board = esp32dev
|
||||
|
||||
build_flags =
|
||||
${arduino_esp32_v2.build_flags}
|
||||
${esp32.ps_ram}
|
||||
|
||||
;region -- TFT_eSPI build options ------------------------
|
||||
-D LGFX_USE_V1=1
|
||||
-D HASP_USE_LGFX_TOUCH=1
|
||||
-D ST7789_DRIVER=1
|
||||
-D TFT_HEIGHT=240
|
||||
-D TFT_WIDTH=240
|
||||
-D TFT_DC=27
|
||||
-D TFT_CS=5
|
||||
-D TFT_MOSI=19
|
||||
-D TFT_RST=-1
|
||||
-D TFT_SCLK=18
|
||||
-D TFT_BCKL=12
|
||||
-D SPI_FREQUENCY=40000000
|
||||
-D I2C_TOUCH_ADDRESS=0x38
|
||||
-D I2C_TOUCH_FREQUENCY=400000
|
||||
-D TOUCH_DRIVER=0x6336
|
||||
-D I2C_TOUCH_PORT=1
|
||||
-D TOUCH_IRQ=38
|
||||
-D TOUCH_RST=-1
|
||||
-D TOUCH_SDA=23
|
||||
-D TOUCH_SCL=32
|
||||
;endregion
|
||||
|
||||
lib_deps =
|
||||
${arduino_esp32_v2.lib_deps}
|
||||
${lovyangfx.lib_deps}
|
||||
${ft6336.lib_deps}
|
||||
|
||||
[env:ttgo-t-watch-2019]
|
||||
extends = ttgo-t-watch, flash_16mb
|
||||
|
||||
build_flags =
|
||||
${ttgo-t-watch.build_flags}
|
||||
-D HASP_MODEL="TTgo T-Watch 2019"
|
||||
-D INVERT_COLORS=1
|
||||
|
||||
[env:ttgo-t-watch-2020]
|
||||
extends = ttgo-t-watch, flash_16mb
|
||||
|
||||
build_flags =
|
||||
${ttgo-t-watch.build_flags}
|
||||
-D HASP_MODEL="TTgo T-Watch 2020"
|
||||
-D TFT_ROTATION=0
|
||||
;-D TFT_ROTATION=2
|
||||
-D TOUCH_OFFSET_ROTATION=4 ; 1=swap xy, 2=invert x, 4=inverty
|
35
user_setups/esp32c3/2424S012.ini
Normal file
35
user_setups/esp32c3/2424S012.ini
Normal file
@ -0,0 +1,35 @@
|
||||
[env:2424S012]
|
||||
extends = arduino_esp32c3_v2, flash_4mb
|
||||
; Close enough, sets it up to use USB-CDC rather than uart
|
||||
board = seeed_xiao_esp32c3
|
||||
|
||||
build_flags =
|
||||
-D HASP_MODEL="ESP32-2424S012"
|
||||
${arduino_esp32c3_v2.build_flags}
|
||||
${esp32c3.no_ps_ram}
|
||||
|
||||
; Display configuration
|
||||
-D LGFX_USE_V1=1
|
||||
-D HASP_USE_LGFX_TOUCH=1
|
||||
;CST816S driver
|
||||
-D TOUCH_DRIVER=0x816
|
||||
-D GC9A01_DRIVER=1
|
||||
-D TFT_WIDTH=240
|
||||
-D TFT_HEIGHT=240
|
||||
-D TOUCH_SDA=4
|
||||
-D TOUCH_SCL=5
|
||||
-D TOUCH_IRQ=0
|
||||
-D TOUCH_RST=1
|
||||
-D I2C_TOUCH_FREQUENCY=400000
|
||||
-D I2C_TOUCH_PORT=0
|
||||
-D I2C_TOUCH_ADDRESS=0x15
|
||||
-D TFT_SCLK=6
|
||||
-D TFT_MOSI=7
|
||||
-D TFT_DC=2
|
||||
-D TFT_CS=10
|
||||
-D TFT_BCKL=3
|
||||
-D SERIAL_SPEED=-1 ;otherwise requires serial term to boot first time
|
||||
|
||||
lib_deps =
|
||||
${arduino_esp32s3_v2.lib_deps}
|
||||
${lovyangfx.lib_deps}
|
59
user_setups/esp32s3/guition-jc4827w543.ini
Normal file
59
user_setups/esp32s3/guition-jc4827w543.ini
Normal file
@ -0,0 +1,59 @@
|
||||
;***************************************************;
|
||||
; Guition ESP32-S3 TFT 4.3" ;
|
||||
; - Custom esp32-s3 board ;
|
||||
; - nv3041a 480x272 ;
|
||||
; - gt911 touch controller ;
|
||||
;***************************************************;
|
||||
|
||||
[guition-esp32-s3-tft]
|
||||
extends = arduino_esp32s3_v2
|
||||
board = esp32-s3-devkitc-1
|
||||
board_build.arduino.memory_type = qio_opi
|
||||
|
||||
build_flags =
|
||||
${arduino_esp32s3_v2.build_flags}
|
||||
${esp32s3.ps_ram}
|
||||
;-D HASP_MODEL="Guition 4.3\""
|
||||
|
||||
;region -- ArduinoGFX build options ------------------------
|
||||
-D HASP_USE_ARDUINOGFX
|
||||
-D NV3041A_DRIVER
|
||||
;endregion
|
||||
|
||||
lib_deps =
|
||||
${arduino_esp32s3_v2.lib_deps}
|
||||
${arduinogfx.lib_deps}
|
||||
${goodix.lib_deps}
|
||||
|
||||
|
||||
[guition-tft-common-pins]
|
||||
build_flags =
|
||||
-D TFT_BCKL=1
|
||||
-D TFT_CS=45
|
||||
-D TFT_SCK=47
|
||||
-D TFT_D0=21
|
||||
-D TFT_D1=48
|
||||
-D TFT_D2=40
|
||||
-D TFT_D3=39
|
||||
-D TFT_RST=GFX_NOT_DEFINED
|
||||
-D TFT_ROTATION=0
|
||||
-D TFT_IPS=true
|
||||
-D TFT_WIDTH=480
|
||||
-D TFT_HEIGHT=272
|
||||
|
||||
[guition-jc4827w543c]
|
||||
extends = guition-esp32-s3-tft, flash_4mb
|
||||
debug_tool = esp-builtin
|
||||
debug_build_flags = -Os # optimize for size
|
||||
build_flags =
|
||||
-D HASP_MODEL="Guition ESP32-S3 JC4827W543C"
|
||||
${guition-esp32-s3-tft.build_flags}
|
||||
${guition-tft-common-pins.build_flags}
|
||||
; Touch Settings
|
||||
-D TOUCH_DRIVER=0x0911
|
||||
-D TOUCH_SCL=4
|
||||
-D TOUCH_SDA=8
|
||||
-D TOUCH_IRQ=-1
|
||||
-D TOUCH_RST=38
|
||||
-D I2C_TOUCH_FREQUENCY=0
|
||||
-D I2C_TOUCH_ADDRESS=0x5D
|
Loading…
x
Reference in New Issue
Block a user