Crowpanel 2.4,2.8 and 3.5 support (#6355)

Co-authored-by: mverch67 <manuel.verch@gmx.de>
This commit is contained in:
Thomas Göttgens
2025-04-17 16:03:37 +02:00
committed by GitHub
parent c177c6d655
commit ef14967fbf
14 changed files with 789 additions and 32 deletions

View File

@@ -0,0 +1,64 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include <stdint.h>
// static const uint8_t LED_BUILTIN = -1;
// static const uint8_t TX = 43;
// static const uint8_t RX = 44;
static const uint8_t SDA = 39;
static const uint8_t SCL = 40;
// Default SPI will be mapped to Radio
static const uint8_t SS = -1;
static const uint8_t MOSI = 48;
static const uint8_t MISO = 47;
static const uint8_t SCK = 41;
#ifndef CROW_SELECT
static const uint8_t SPI_MOSI = 6;
static const uint8_t SPI_SCK = 5;
static const uint8_t SPI_MISO = 4;
static const uint8_t SPI_CS = 7; // SD does not support -1
static const uint8_t SDCARD_CS = SPI_CS;
#endif
static const uint8_t A0 = 1;
static const uint8_t A1 = 2;
static const uint8_t A2 = 3;
static const uint8_t A3 = 4;
static const uint8_t A4 = 5;
static const uint8_t A5 = 6;
static const uint8_t A6 = 7;
static const uint8_t A7 = 8;
static const uint8_t A8 = 9;
static const uint8_t A9 = 10;
static const uint8_t A10 = 11;
static const uint8_t A11 = 12;
static const uint8_t A12 = 13;
static const uint8_t A13 = 14;
static const uint8_t A14 = 15;
static const uint8_t A15 = 16;
static const uint8_t A16 = 17;
static const uint8_t A17 = 18;
static const uint8_t A18 = 19;
static const uint8_t A19 = 20;
static const uint8_t T1 = 1;
static const uint8_t T2 = 2;
static const uint8_t T3 = 3;
static const uint8_t T4 = 4;
static const uint8_t T5 = 5;
static const uint8_t T6 = 6;
static const uint8_t T7 = 7;
static const uint8_t T8 = 8;
static const uint8_t T9 = 9;
static const uint8_t T10 = 10;
static const uint8_t T11 = 11;
static const uint8_t T12 = 12;
static const uint8_t T13 = 13;
static const uint8_t T14 = 14;
#endif /* Pins_Arduino_h */

View File

@@ -0,0 +1,123 @@
[crowpanel_base]
extends = esp32s3_base
board = crowpanel
board_check = true
upload_protocol = esptool
board_build.partitions = default_16MB.csv ; must be here for some reason, board.json is not enough !?
build_flags = ${esp32s3_base.build_flags} -Os
-I variants/elecrow_panel
-D ELECROW
-D ELECROW_PANEL
-D CONFIG_ARDUHAL_LOG_COLORS
-D RADIOLIB_DEBUG_SPI=0
-D RADIOLIB_DEBUG_PROTOCOL=0
-D RADIOLIB_DEBUG_BASIC=0
-D RADIOLIB_VERBOSE_ASSERT=0
-D RADIOLIB_SPI_PARANOID=0
-D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1
-D MESHTASTIC_EXCLUDE_INPUTBROKER=1
-D MESHTASTIC_EXCLUDE_WEBSERVER=1
-D MESHTASTIC_EXCLUDE_SERIAL=1
-D MESHTASTIC_EXCLUDE_SOCKETAPI=1
-D MESHTASTIC_EXCLUDE_SCREEN=1
-D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1
; -D INPUTDRIVER_BUTTON_TYPE=0
-D HAS_TELEMETRY=0
-D CONFIG_DISABLE_HAL_LOCKS=1
-D HAS_SCREEN=0
-D HAS_TFT=1
-D RAM_SIZE=6144
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_CONF_INCLUDE_SIMPLE
-D LV_COMP_CONF_INCLUDE_SIMPLE
-D LV_USE_SYSMON=0
-D LV_USE_PROFILER=0
-D LV_USE_PERF_MONITOR=0
-D LV_USE_MEM_MONITOR=0
-D LV_USE_LOG=0
-D LV_BUILD_TEST=0
-D USE_LOG_DEBUG
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
-D USE_PACKET_API
lib_deps = ${esp32s3_base.lib_deps}
${device-ui_base.lib_deps}
earlephilhower/ESP8266Audio@^1.9.9
earlephilhower/ESP8266SAM@^1.0.1
lovyan03/LovyanGFX@^1.2.0
hideakitai/TCA9534@^0.1.1
[env:elecrow-24-28-tft]
extends = crowpanel_base
build_flags =
${crowpanel_base.build_flags}
-D TFT_HEIGHT=320 ; needed in variant.h
-D HAS_SDCARD
-D SDCARD_USE_SOFT_SPI
-D SPI_DRIVER_SELECT=2
-D USE_PIN_BUZZER
; -D INPUTDRIVER_BUTTON_TYPE=0 ; no button as this pin is assigned to LoRa cs!
-D SCREEN_TOUCH_INT=47 ; used to wake up the MCU by touch
-D LGFX_DRIVER_TEMPLATE
-D LGFX_DRIVER=LGFX_GENERIC
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_GENERIC.h\"
-D SPI_FREQUENCY=80000000
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D LGFX_PANEL=ST7789
-D LGFX_ROTATION=1
-D LGFX_CFG_HOST=SPI2_HOST
-D LGFX_PIN_SCK=42
-D LGFX_PIN_MOSI=39
-D LGFX_PIN_DC=41
-D LGFX_PIN_CS=40
-D LGFX_PIN_BL=38
-D LGFX_TOUCH=FT5x06
-D LGFX_TOUCH_I2C_ADDR=0x38
-D LGFX_TOUCH_I2C_SDA=15
-D LGFX_TOUCH_I2C_SCL=16
-D LGFX_TOUCH_INT=47
-D LGFX_TOUCH_RST=48
-D LGFX_TOUCH_ROTATION=0
-D VIEW_320x240
-D MAP_FULL_REDRAW
[env:elecrow-35-tft]
extends = crowpanel_base
build_flags =
${crowpanel_base.build_flags}
-D TFT_HEIGHT=480 ; needed in variant.h
-D HAS_SDCARD
-D SDCARD_USE_SOFT_SPI
-D SPI_DRIVER_SELECT=2
-D USE_PIN_BUZZER
; -D INPUTDRIVER_BUTTON_TYPE=0 ; no button as this pin is assigned to LoRa cs!
-D SCREEN_TOUCH_INT=47 ; used to wake up the MCU by touch
-D LV_CACHE_DEF_SIZE=2097152
-D LGFX_DRIVER_TEMPLATE
-D LGFX_DRIVER=LGFX_GENERIC
-D GFX_DRIVER_INC=\"graphics/LGFX/LGFX_GENERIC.h\"
-D SPI_FREQUENCY=60000000
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D LGFX_PANEL=ILI9488
-D LGFX_ROTATION=0
-D LGFX_CFG_HOST=SPI2_HOST
-D LGFX_PIN_SCK=42
-D LGFX_PIN_MOSI=39
-D LGFX_PIN_DC=41
-D LGFX_PIN_CS=40
-D LGFX_PIN_BL=38
-D LGFX_TOUCH=GT911
-D LGFX_TOUCH_I2C_ADDR=0x5D
-D LGFX_TOUCH_I2C_SDA=15
-D LGFX_TOUCH_I2C_SCL=16
-D LGFX_TOUCH_INT=47
-D LGFX_TOUCH_RST=48
-D LGFX_TOUCH_ROTATION=0
-D DISPLAY_SET_RESOLUTION
-D VIEW_320x240
-D MAP_FULL_REDRAW

View File

@@ -0,0 +1,195 @@
#define I2C_SDA 15
#define I2C_SCL 16
#if TFT_HEIGHT == 320 && not defined(HAS_TFT) // 2.4 and 2.8 TFT
// ST7789 TFT LCD
#define ST7789_CS 40
#define ST7789_RS 41 // DC
#define ST7789_SDA 39 // MOSI
#define ST7789_SCK 42
#define ST7789_RESET -1
#define ST7789_MISO 38
#define ST7789_BUSY -1
#define ST7789_BL 38
#define ST7789_SPI_HOST SPI2_HOST
#define TFT_BL 38
#define SPI_FREQUENCY 60000000
#define SPI_READ_FREQUENCY 16000000
#define TFT_OFFSET_ROTATION 0
#define SCREEN_ROTATE
#define TFT_DUMMY_READ_PIXELS 8
#define SCREEN_TRANSITION_FRAMERATE 5
#define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness
#define HAS_TOUCHSCREEN 1
#define SCREEN_TOUCH_INT 47
#define SCREEN_TOUCH_RST 48
#define TOUCH_I2C_PORT 0
#define TOUCH_SLAVE_ADDRESS 0x38 // FT5x06
#endif
#if TFT_HEIGHT == 480 && not defined(HAS_TFT) // 3.5 TFT
// ILI9488 TFT LCD
#define ILI9488_CS 40
#define ILI9488_RS 41 // DC
#define ILI9488_SDA 39 // MOSI
#define ILI9488_SCK 42
#define ILI9488_RESET -1
#define ILI9488_MISO 38
#define ILI9488_BUSY -1
#define ILI9488_BL 38
#define ILI9488_SPI_HOST SPI2_HOST
#define TFT_BL 38
#define SPI_FREQUENCY 40000000
#define SPI_READ_FREQUENCY 16000000
#define TFT_OFFSET_ROTATION 0
#define SCREEN_ROTATE
#define TFT_DUMMY_READ_PIXELS 8
#define SCREEN_TRANSITION_FRAMERATE 5
#define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness
#define HAS_TOUCHSCREEN 1
#define SCREEN_TOUCH_INT 47
#define SCREEN_TOUCH_RST 48
#define TOUCH_I2C_PORT 0
#define TOUCH_SLAVE_ADDRESS 0x5D // GT911
#endif
#ifdef CROW_SELECT
#define ST72xx_DE 42
#define ST72xx_VSYNC 41
#define ST72xx_HSYNC 40
#define ST72xx_PCLK 39
#define ST72xx_R0 7
#define ST72xx_R1 17
#define ST72xx_R2 18
#define ST72xx_R3 3
#define ST72xx_R4 46
#define ST72xx_G0 9
#define ST72xx_G1 10
#define ST72xx_G2 11
#define ST72xx_G3 12
#define ST72xx_G4 13
#define ST72xx_G5 14
#define ST72xx_B0 21
#define ST72xx_B1 47
#define ST72xx_B2 48
#define ST72xx_B3 45
#define ST72xx_B4 38
#define HAS_TOUCHSCREEN 1
#define TOUCH_I2C_PORT 0
#define TOUCH_SLAVE_ADDRESS 0x5D // GT911
#endif
#if defined(CROW_SELECT) && CROW_SELECT == 1 // 4.3 TFT 800x480
#define ST7265_HSYNC_POLARITY 0
#define ST7265_HSYNC_FRONT_PORCH 24
#define ST7265_HSYNC_PULSE_WIDTH 8
#define ST7265_HSYNC_BACK_PORCH 24
#define ST7265_VSYNC_POLARITY 1
#define ST7265_VSYNC_FRONT_PORCH 24
#define ST7265_VSYNC_PULSE_WIDTH 8
#define ST7265_VSYNC_BACK_PORCH 24
#define ST7265_PCLK_ACTIVE_NEG 1
#endif
#if defined(CROW_SELECT) && CROW_SELECT == 2 // 5.0 TFT 800x480
#define ST7262_HSYNC_POLARITY 0
#define ST7262_HSYNC_FRONT_PORCH 8
#define ST7262_HSYNC_PULSE_WIDTH 4
#define ST7262_HSYNC_BACK_PORCH 8
#define ST7262_VSYNC_POLARITY 0
#define ST7262_VSYNC_FRONT_PORCH 8
#define ST7262_VSYNC_PULSE_WIDTH 4
#define ST7262_VSYNC_BACK_PORCH 8
#define ST7262_PCLK_ACTIVE_NEG 0
#endif
#if defined(CROW_SELECT) && CROW_SELECT == 3 // 7.0 TFT 800x480
#define SC7277_HSYNC_POLARITY 0
#define SC7277_HSYNC_FRONT_PORCH 8
#define SC7277_HSYNC_PULSE_WIDTH 4
#define SC7277_HSYNC_BACK_PORCH 8
#define SC7277_VSYNC_POLARITY 0
#define SC7277_VSYNC_FRONT_PORCH 8
#define SC7277_VSYNC_PULSE_WIDTH 4
#define SC7277_VSYNC_BACK_PORCH 8
#define SC7277_PCLK_ACTIVE_NEG 0
#endif
#if TFT_HEIGHT == 320 // 2.4-2.8 have I2S audio
// dac / amp
// #define HAS_I2S // didn't get I2S sound working
#define PIN_BUZZER 8 // using pwm buzzer instead (nobody will notice, lol)
#define DAC_I2S_BCK 13
#define DAC_I2S_WS 11
#define DAC_I2S_DOUT 12
#define DAC_I2S_MCLK 8 // don't use GPIO0 because it's assigned to LoRa or button
#else
#define PIN_BUZZER 8
#endif
// GPS via UART1 connector
#define HAS_GPS 1
#define GPS_DEFAULT_NOT_PRESENT 1
#define GPS_RX_PIN 18
#define GPS_TX_PIN 17
// Extension Slot Layout, viewed from above (2.4-3.5)
// DIO1/IO1 o o IO2/NRESET
// SCK/IO10 o o IO16/NC
// MISO/IO9 o o IO15/NC
// MOSI/IO3 o o NC/DIO2
// 3V3 o o IO46/BUSY
// GND o o IO0/NSS
// 5V/NC o o NC/DIO3
// J9 J8
// Extension Slot Layout, viewed from above (4.3-7.0)
// !! DIO1/IO20 o o IO19/NRESET !!
// !! SCK/IO5 o o IO16/NC
// !! MISO/IO4 o o IO15/NC
// !! MOSI/IO6 o o NC/DIO2
// 3V3 o o IO2/BUSY !!
// GND o o IO0/NSS
// 5V/NC o o NC/DIO3
// J9 J8
// LoRa
#define USE_SX1262
#define LORA_CS 0 // GND
#if TFT_HEIGHT == 320 || TFT_HEIGHT == 480 // 2.4 - 3.5 TFT
#define LORA_SCK 10
#define LORA_MISO 9
#define LORA_MOSI 3
#define LORA_RESET 2
#define LORA_DIO1 1 // SX1262 IRQ
#define LORA_DIO2 46 // SX1262 BUSY
// need to pull IO45 low to enable LORA and disable Microphone on 24 28 35
#define SENSOR_POWER_CTRL_PIN 45
#define SENSOR_POWER_ON LOW
#else
#define LORA_SCK 5
#define LORA_MISO 4
#define LORA_MOSI 6
#define LORA_RESET 19
#define LORA_DIO1 20 // SX1262 IRQ
#define LORA_DIO2 2 // SX1262 BUSY
#endif
#define HW_SPI1_DEVICE
#define SX126X_CS LORA_CS
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 3.3
#define USE_VIRTUAL_KEYBOARD 1
#define DISPLAY_CLOCK_FRAME 1