mirror of
https://github.com/BruceDevices/firmware.git
synced 2026-03-13 10:12:21 +08:00
Display HAL Update for P4 DSI displays
This commit is contained in:
@@ -253,7 +253,11 @@
|
||||
// Temporary, delete after finish Interfaces
|
||||
|
||||
#ifndef SMOOTH_FONT
|
||||
#define SMOOTH_FONT
|
||||
#define SMOOTH_FONT 1
|
||||
#endif
|
||||
|
||||
#ifndef BTN_ALIAS
|
||||
#define BTN_ALIAS "Sel"
|
||||
#endif
|
||||
|
||||
#ifndef DEEPSLEEP_WAKEUP_PIN
|
||||
|
||||
@@ -243,6 +243,24 @@ Bus 3: `Arduino_ESP32RGBPanel` (RGB panel)
|
||||
#define TFT_PREF_SPEED 16000000
|
||||
```
|
||||
|
||||
Bus 4: `Arduino_ESP32DSIPanel` (DSI used in ESP32-P4)
|
||||
```c
|
||||
// Example of T-Display P4 TFT
|
||||
#define TFT_DATABUS_N 4
|
||||
#define TFT_HSYNC_PULSE_WIDTH 28
|
||||
#define TFT_HSYNC_BACK_PORCH 26
|
||||
#define TFT_HSYNC_FRONT_PORCH 20
|
||||
#define TFT_VSYNC_PULSE_WIDTH 2
|
||||
#define TFT_VSYNC_BACK_PORCH 22
|
||||
#define TFT_VSYNC_FRONT_PORCH 200
|
||||
#define TFT_PREF_SPEED 60000000
|
||||
|
||||
#define TFT_DISPLAY_DRIVER_N 50
|
||||
#define TFT_WIDTH 540
|
||||
#define TFT_HEIGHT 1168
|
||||
#define TFT_RST -1
|
||||
#define TFT_DSI_INIT hi8561_lcd_init
|
||||
```
|
||||
### Display driver selection (`TFT_DISPLAY_DRIVER_N`)
|
||||
|
||||
All drivers use `TFT_DISPLAY_DRIVER_N`. The grouping below matches the constructor signature used in
|
||||
|
||||
@@ -63,9 +63,16 @@ tft_display::tft_display(int16_t _W, int16_t _H) : _height(_H), _width(_W) {
|
||||
bus = new TFT_DATABUS(
|
||||
TFT_DC, TFT_CS, TFT_WR, TFT_RD, TFT_D0, TFT_D1, TFT_D2, TFT_D3, TFT_D4, TFT_D5, TFT_D6, TFT_D7
|
||||
);
|
||||
#elif TFT_DATABUS_N== 4
|
||||
bus = new TFT_DATABUS(TFT_HSYNC_PULSE_WIDTH, TFT_HSYNC_BACK_PORCH, TFT_HSYNC_FRONT_PORCH,
|
||||
TFT_VSYNC_PULSE_WIDTH, TFT_VSYNC_BACK_PORCH, TFT_VSYNC_FRONT_PORCH, TFT_PREF_SPEED);
|
||||
#endif
|
||||
#if TFT_DISPLAY_DRIVER_N == 50
|
||||
#error "Arduino_DSI_Display requires a DSI panel instance; not supported in this init."
|
||||
#if !defined(TFT_RST) || !defined(TFT_WIDTH) || !defined(TFT_HEIGHT) || !defined(TFT_DSI_INIT)
|
||||
#error "Missing Macros definitions of: TFT_RST, TFT_WIDTH, TFT_HEIGHT"
|
||||
#endif
|
||||
_gfx = new TFT_DISPLAY_DRIVER(TFT_WIDTH, TFT_HEIGHT, bus, 0, true, TFT_RST,
|
||||
TFT_DSI_INIT, sizeof(TFT_DSI_INIT) / sizeof(lcd_init_cmd_t));
|
||||
#elif TFT_DISPLAY_DRIVER_N >= 47 && TFT_DISPLAY_DRIVER_N <= 48
|
||||
#if !defined(TFT_RST) || !defined(TFT_WIDTH) || !defined(TFT_HEIGHT)
|
||||
#error "Missing Macros definitions of: TFT_RST, TFT_WIDTH, TFT_HEIGHT"
|
||||
@@ -287,15 +294,7 @@ void tft_display::invertDisplay(bool i) {
|
||||
if (_gfx) _gfx->invertDisplay(i);
|
||||
}
|
||||
|
||||
void tft_display::sleep(bool value) {
|
||||
if (value) {
|
||||
_gfx->writecommand(0x10);
|
||||
delay(5);
|
||||
} else {
|
||||
_gfx->writecommand(0x11);
|
||||
delay(120);
|
||||
}
|
||||
}
|
||||
void tft_display::sleep(bool value) {}
|
||||
|
||||
void tft_display::setSwapBytes(bool swap) { _swapBytes = swap; }
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ class tft_sprite;
|
||||
class tft_logger;
|
||||
|
||||
#if defined(USE_ARDUINO_GFX)
|
||||
#include "tft_defines.h"
|
||||
#include <Arduino_GFX_Library.h>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
@@ -15,12 +16,13 @@ class tft_logger;
|
||||
#include <memory>
|
||||
// clang-format off
|
||||
// Check Data bus
|
||||
#if !defined(TFT_DATABUS_N) || TFT_DATABUS_N > 3
|
||||
#if !defined(TFT_DATABUS_N) || TFT_DATABUS_N > 4
|
||||
#warning "Please define the Data bus used for this board:\n \
|
||||
- 0: Arduino_HWSPI: Shared SPI with other devices;\n \
|
||||
- 1: Arduino_ESP32QSPI: Quad SPI, used in AMOLED and some new displays;\n \
|
||||
- 2: Arduino_ESP32PAR8Q: Parallel 8 bit;\n \
|
||||
- 3: Arduino_ESP32RGBPanel: Parallel 16 bit;\n \
|
||||
- 4: Arduino_ESP32DSIPanel: DSI Panel for P4 devices;\n \
|
||||
\n \
|
||||
Using Arduino_HWSPI as default."
|
||||
#define TFT_DATABUS_N 0
|
||||
@@ -86,15 +88,39 @@ class tft_logger;
|
||||
TFT_PREF_SPEED"
|
||||
#endif
|
||||
|
||||
#if !defined(TFT_WIDTH) || defined(TFT_HEIGHT)
|
||||
#if !defined(TFT_WIDTH) || !defined(TFT_HEIGHT)
|
||||
#error "Missing Macros definitions of: TFT_WIDTH, TFT_HEIGHT"
|
||||
#endif
|
||||
#elif TFT_DATABUS_N == 4
|
||||
#include "ardgfx_inits.h"
|
||||
#define TFT_DATABUS_TYPE Arduino_ESP32DSIPanel
|
||||
#define TFT_DATABUS Arduino_ESP32DSIPanel
|
||||
#if !defined(TFT_HSYNC_PULSE_WIDTH) || !defined(TFT_HSYNC_BACK_PORCH) || !defined(TFT_HSYNC_FRONT_PORCH) || \
|
||||
!defined(TFT_VSYNC_PULSE_WIDTH) || !defined(TFT_VSYNC_BACK_PORCH) || !defined(TFT_VSYNC_FRONT_PORCH) || \
|
||||
!defined(TFT_PREF_SPEED)
|
||||
#error "Missing Definitions for: \n \
|
||||
TFT_HSYNC_FRONT_PORCH,\n \
|
||||
TFT_HSYNC_PULSE_WIDTH,\n \
|
||||
TFT_HSYNC_BACK_PORCH,\n \
|
||||
TFT_VSYNC_FRONT_PORCH,\n \
|
||||
TFT_VSYNC_PULSE_WIDTH,\n \
|
||||
TFT_VSYNC_BACK_PORCH,\n \
|
||||
TFT_PREF_SPEED"
|
||||
#endif
|
||||
|
||||
#if !defined(TFT_WIDTH) || !defined(TFT_HEIGHT) || !defined(TFT_RST) || !defined(TFT_DSI_INIT)
|
||||
#error "Missing Macros definitions of: TFT_WIDTH, TFT_HEIGHT, TFT_RST, TFT_DSI_INIT"
|
||||
#endif
|
||||
#ifndef TFT_DISPLAY_DRIVER_N
|
||||
#define TFT_DISPLAY_DRIVER_N 50
|
||||
#endif
|
||||
#else
|
||||
#error "Invalid TFT_DATABUS_N\n Please define the Data bus used for this board:\n \
|
||||
- 0: Arduino_HWSPI: Shared SPI with other devices;\n \
|
||||
- 1: Arduino_ESP32QSPI: Quad SPI, used in AMOLED and some new displays;\n \
|
||||
- 2: Arduino_ESP32PAR8Q: Parallel 8 bit;\n \
|
||||
- 3: Arduino_ESP32RGBPanel: Parallel 16 bit;"
|
||||
- 3: Arduino_ESP32RGBPanel: Parallel 16 bit;\n \
|
||||
- 4: Arduino_ESP32DSIPanel: DSI Panel for P4 devices;"
|
||||
#endif
|
||||
|
||||
// Set Databus Type for constructor
|
||||
@@ -104,7 +130,9 @@ class tft_logger;
|
||||
#endif
|
||||
#define TFT_DATABUS_TYPE Arduino_ESP32RGBPanel
|
||||
#else
|
||||
#define TFT_DATABUS_TYPE Arduino_DataBus
|
||||
#ifndef TFT_DATABUS_TYPE
|
||||
#define TFT_DATABUS_TYPE Arduino_DataBus
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(TFT_DISPLAY_DRIVER_N)
|
||||
|
||||
153
lib/HAL/display/ardgfx_inits.h
Normal file
153
lib/HAL/display/ardgfx_inits.h
Normal file
@@ -0,0 +1,153 @@
|
||||
#ifndef LIB_HAL_ARDGFX_INIT_H
|
||||
#define LIB_HAL_ARDGFX_INIT_H
|
||||
#include <pins_arduino.h>
|
||||
|
||||
#if defined(USE_ARDUINO_GFX)
|
||||
|
||||
#include <Arduino_GFX_Library.h>
|
||||
|
||||
static const lcd_init_cmd_t hi8561_lcd_init_cmd[] = {
|
||||
// {cmd, { data }, data_size, delay_ms}
|
||||
/**** CMD_Page 3 ****/
|
||||
{0xDF, (uint8_t[]){0x90, 0x69, 0xF9}, 3, 0 },
|
||||
{0xDE, (uint8_t[]){0x00}, 1, 0 },
|
||||
{0xBB, (uint8_t[]){0x0F, 0x10, 0x43, 0x50, 0x32, 0x44, 0x44}, 7, 0 },
|
||||
{0xBF, (uint8_t[]){0x46, 0x32}, 2, 0 },
|
||||
{0xC0, (uint8_t[]){0x01, 0xAD, 0x01, 0xAD}, 4, 0 },
|
||||
{0xBD, (uint8_t[]){0x00, 0xB4}, 2, 0 },
|
||||
{0xC6,
|
||||
(uint8_t[]){0x00, 0x7D, 0x00, 0xC8, 0x00, 0x17, 0x1A, 0x82, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01},
|
||||
23, 0 },
|
||||
{0xC8, (uint8_t[]){0x23, 0x48, 0x87}, 3, 0 },
|
||||
// {0xCC, (uint8_t[]){0x33}, 1, 0},//4lane
|
||||
{0xCC, (uint8_t[]){0x31}, 1, 0 }, // 2lane
|
||||
// {0xCC, (uint8_t[]){0x30}, 1, 0}, // 1lane
|
||||
{0xBC, (uint8_t[]){0x2E, 0x80, 0x84}, 3, 0 },
|
||||
{0xC3,
|
||||
(uint8_t[]){0x3B, 0x01, 0x02, 0x05, 0x0C, 0x0C, 0x75, 0x0A, 0x79, 0x0A, 0x79, 0x02, 0x6E,
|
||||
0x02, 0x6E, 0x02, 0x6E, 0x0A, 0x0D, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F},
|
||||
25, 0 },
|
||||
{0xC4,
|
||||
(uint8_t[]){0x01, 0x02, 0x05, 0x0C, 0x0C, 0x75, 0x0A, 0x79, 0x0A, 0x79, 0x02, 0x6E,
|
||||
0x02, 0x6E, 0x02, 0x6E, 0x0A, 0x0D, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F},
|
||||
24, 0 },
|
||||
{0xC5,
|
||||
(uint8_t[]){0x03, 0x05, 0x0C, 0x0C, 0x75, 0x0A, 0x79, 0x0A, 0x79, 0x02, 0x6E, 0x02,
|
||||
0x6E, 0x02, 0x6E, 0x0A, 0x0D, 0x0A, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F},
|
||||
23, 0 },
|
||||
{0xD7,
|
||||
(uint8_t[]){
|
||||
0x00, 0x0A, 0x63, 0x0A, 0x63, 0x0A, 0x63, 0x0A, 0x63, 0x0A, 0x63, 0x0A, 0x63, 0x0A, 0x63, 0x0A, 0x63
|
||||
}, 17,
|
||||
0 },
|
||||
{0xCB,
|
||||
(uint8_t[]){0x7F, 0x78, 0x71, 0x64, 0x5A, 0x58, 0x4B, 0x51, 0x3A, 0x53, 0x51, 0x4F, 0x6A, 0x54, 0x57,
|
||||
0x46, 0x3F, 0x2F, 0x1B, 0x0F, 0x08, 0x7F, 0x78, 0x71, 0x64, 0x5A, 0x58, 0x4B, 0x51, 0x3A,
|
||||
0x53, 0x51, 0x4F, 0x6A, 0x54, 0x57, 0x46, 0x3F, 0x2F, 0x1B, 0x0F, 0x08, 0x00},
|
||||
43, 0 },
|
||||
{0xCE,
|
||||
(uint8_t[]){0x00, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
|
||||
0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C},
|
||||
23, 0 },
|
||||
{0xCF,
|
||||
(uint8_t[]){0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
45, 0 },
|
||||
{0xD0,
|
||||
(uint8_t[]){0x00, 0x1F, 0x1F, 0x11, 0x1E, 0x1F, 0x0F, 0x0F, 0x0D, 0x0D, 0x0B, 0x0B, 0x09, 0x09, 0x07,
|
||||
0x07, 0x05, 0x05, 0x01, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
29, 0 },
|
||||
{0xD1,
|
||||
(uint8_t[]){0x00, 0x1F, 0x1F, 0x10, 0x1E, 0x1F, 0x0E, 0x0E, 0x0C, 0x0C, 0x0A, 0x0A, 0x08, 0x08, 0x06,
|
||||
0x06, 0x04, 0x04, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
29, 0 },
|
||||
{0xD2,
|
||||
(uint8_t[]){0x00, 0x5F, 0x1F, 0x10, 0x1F, 0x1E, 0x08, 0x08, 0x4A, 0x0A, 0x0C, 0x0C, 0x0E, 0x0E, 0x04,
|
||||
0x04, 0x06, 0x06, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
29, 0 },
|
||||
{0xD3,
|
||||
(uint8_t[]){0x00, 0x1F, 0x1F, 0x11, 0x1F, 0x1E, 0x09, 0x09, 0x0B, 0x0B, 0x0D, 0x0D, 0x0F, 0x0F, 0x05,
|
||||
0x05, 0x07, 0x07, 0x01, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
29, 0 },
|
||||
{0xD4,
|
||||
(uint8_t[]){0x00, 0x20, 0x0B, 0x00, 0x0D, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x03, 0x03, 0x03, 0x00, 0x81, 0x04, 0xAE, 0x04, 0xB0, 0x04, 0xB2, 0x04, 0xB4,
|
||||
0x04, 0xB6, 0x04, 0xB8, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x06,
|
||||
0x44, 0x06, 0x46, 0x03, 0x03, 0x00, 0x00, 0x07, 0x00, 0x06, 0x04, 0xA7, 0x04, 0xA8, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00},
|
||||
87, 0 },
|
||||
{0xD5,
|
||||
(uint8_t[]){0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00,
|
||||
0x07, 0x32, 0x5A, 0x00, 0x00, 0x3C, 0x00, 0x1E, 0x00, 0x1E, 0xB3, 0x00, 0x0F,
|
||||
0x06, 0x0C, 0x00, 0x71, 0x20, 0x04, 0x10, 0x04, 0x06, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x1F, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
61, 0 },
|
||||
{0xCD, (uint8_t[]){0x00, 0x00}, 2, 0 },
|
||||
|
||||
{0xDE, (uint8_t[]){0x01}, 1, 0 },
|
||||
{0xB9, (uint8_t[]){0x00, 0xFF, 0xFF, 0x04}, 4, 0 },
|
||||
{0xC7, (uint8_t[]){0x1F, 0x14, 0x0E}, 3, 0 },
|
||||
|
||||
{0xDE, (uint8_t[]){0x02}, 1, 0 },
|
||||
{0xE5,
|
||||
(uint8_t[]){0x00, 0x60, 0x60, 0x02, 0x18, 0x60, 0x18, 0x60, 0x09, 0x04, 0x00, 0xC5,
|
||||
0x01, 0x2C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04},
|
||||
24, 0 },
|
||||
{0xE6, (uint8_t[]){0x10, 0x10, 0x82}, 3, 0 },
|
||||
{0xC4, (uint8_t[]){0x00, 0x11, 0x07, 0x00, 0x11, 0x01, 0x08}, 7, 0 },
|
||||
{0xC3, (uint8_t[]){0x20, 0xFF}, 2, 0 },
|
||||
{0xBD, (uint8_t[]){0x1B}, 1, 0 },
|
||||
{0xC6, (uint8_t[]){0x4A, 0x00}, 2, 0 },
|
||||
{0xCD, (uint8_t[]){0x14, 0x64, 0x11, 0x40}, 4, 0 },
|
||||
{0xC1, (uint8_t[]){0x00, 0x40, 0x00, 0x02, 0x02, 0x02, 0x02, 0x7F, 0x00, 0x00}, 10, 0 },
|
||||
{0xB3, (uint8_t[]){0x00, 0xA8}, 2, 0 },
|
||||
{0xBB, (uint8_t[]){0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x40, 0x43, 0x04}, 11, 0 },
|
||||
{0xC2, (uint8_t[]){0x02, 0x42, 0x50, 0x00, 0x02, 0xE4, 0x61, 0x73, 0xF9, 0x08}, 10, 0 },
|
||||
{0xEC,
|
||||
(uint8_t[]){0x07, 0x07, 0x40, 0x00, 0x22, 0x02, 0x00, 0xFF, 0x08, 0x7C, 0x00, 0x00, 0x00, 0x00},
|
||||
14, 0 },
|
||||
|
||||
{0xDE, (uint8_t[]){0x03}, 1, 0 },
|
||||
{0xD1, (uint8_t[]){0x00, 0x00, 0x21, 0xFF, 0x00}, 5, 0 },
|
||||
|
||||
{0xDE, (uint8_t[]){0x00}, 1, 0 },
|
||||
{0x35, (uint8_t[]){0x00}, 0, 30 },
|
||||
|
||||
{0x11, (uint8_t[]){0x00}, 0, 120},
|
||||
|
||||
{0x29, (uint8_t[]){0x00}, 0, 50 },
|
||||
|
||||
//============ Gamma END===========
|
||||
};
|
||||
|
||||
#define CONFIG_SCREEN_PIXEL_FORMAT_RGB565 1
|
||||
|
||||
static const lcd_init_cmd_t rm69a10_lcd_init_cmd[] = {
|
||||
// {cmd, { data }, data_size, delay_ms}
|
||||
/**** CMD_Page 3 ****/
|
||||
{0xFE, (uint8_t[]){0xFD}, 1, 0 },
|
||||
{0x80, (uint8_t[]){0xFC}, 1, 0 },
|
||||
{0xFE, (uint8_t[]){0x00}, 1, 0 },
|
||||
{0x2A, (uint8_t[]){0x00, 0x00, 0x02, 0x37}, 4, 0 },
|
||||
{0x2B, (uint8_t[]){0x00, 0x00, 0x04, 0xCF}, 4, 0 },
|
||||
{0x31, (uint8_t[]){0x00, 0x03, 0x02, 0x34}, 4, 0 },
|
||||
{0x30, (uint8_t[]){0x00, 0x00, 0x04, 0xCF}, 4, 0 },
|
||||
{0x12, (uint8_t[]){0x00}, 1, 0 },
|
||||
{0x35, (uint8_t[]){0x00}, 1, 0 },
|
||||
#if CONFIG_SCREEN_PIXEL_FORMAT_RGB565
|
||||
{0x3A, (uint8_t[]){0x75}, 1, 0 }, // interface pixel format 16bit/pixel
|
||||
#elif CONFIG_SCREEN_PIXEL_FORMAT_RGB888
|
||||
{0x3A, (uint8_t[]){0x77}, 1, 0}, // interface pixel format 24bit/pixel
|
||||
#endif
|
||||
{0x51, (uint8_t[]){0xFE}, 1, 0 }, // Brightness to 100
|
||||
// {0x51, (uint8_t[]){0x00}, 1, 0}, // 设置屏幕亮度为0
|
||||
{0x11, (uint8_t[]){0x00}, 0, 120},
|
||||
{0x29, (uint8_t[]){0x00}, 0, 0 },
|
||||
//============ Gamma END===========
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
@@ -283,15 +283,7 @@ void tft_display::invertDisplay(bool i) {
|
||||
lgfx::LGFX_Device::invertDisplay(i);
|
||||
}
|
||||
|
||||
void tft_display::sleep(bool value) {
|
||||
if (value) {
|
||||
writecommand(0x10);
|
||||
delay(5);
|
||||
} else {
|
||||
writecommand(0x11);
|
||||
delay(120);
|
||||
}
|
||||
}
|
||||
void tft_display::sleep(bool value) {}
|
||||
|
||||
void tft_display::setSwapBytes(bool swap) { _swapBytes = swap; }
|
||||
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include "tft_defines.h"
|
||||
|
||||
class tft_display : private lgfx::LGFX_Device {
|
||||
public:
|
||||
explicit tft_display(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
|
||||
|
||||
@@ -165,15 +165,7 @@ void tft_display::invertDisplay(bool i) {
|
||||
M5.Display.invertDisplay(i);
|
||||
}
|
||||
|
||||
void tft_display::sleep(bool value) {
|
||||
if (value) {
|
||||
writecommand(0x10);
|
||||
delay(5);
|
||||
} else {
|
||||
writecommand(0x11);
|
||||
delay(120);
|
||||
}
|
||||
}
|
||||
void tft_display::sleep(bool value) {}
|
||||
|
||||
void tft_display::setSwapBytes(bool swap) { _swapBytes = swap; }
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include "tft_defines.h"
|
||||
class tft_display {
|
||||
public:
|
||||
explicit tft_display(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
|
||||
|
||||
@@ -1,49 +1,11 @@
|
||||
#ifndef LIB_HAL_DISPLAY_TFT_H
|
||||
#define LIB_HAL_DISPLAY_TFT_H
|
||||
#include <pins_arduino.h>
|
||||
|
||||
#if !defined(USE_ARDUINO_GFX) && !defined(USE_LOVYANGFX) && !defined(USE_TFT_ESPI) && !defined(USE_M5GFX)
|
||||
#define USE_TFT_ESPI
|
||||
#endif
|
||||
|
||||
#ifndef TL_DATUM
|
||||
#define TL_DATUM 0
|
||||
#define TC_DATUM 1
|
||||
#define TR_DATUM 2
|
||||
#define ML_DATUM 3
|
||||
#define MC_DATUM 4
|
||||
#define MR_DATUM 5
|
||||
#define BL_DATUM 6
|
||||
#define BC_DATUM 7
|
||||
#define BR_DATUM 8
|
||||
#endif
|
||||
|
||||
#ifndef TFT_BLACK
|
||||
#define TFT_BLACK 0x0000
|
||||
#define TFT_NAVY 0x000F
|
||||
#define TFT_DARKGREEN 0x03E0
|
||||
#define TFT_DARKCYAN 0x03EF
|
||||
#define TFT_MAROON 0x7800
|
||||
#define TFT_PURPLE 0x780F
|
||||
#define TFT_OLIVE 0x7BE0
|
||||
#define TFT_LIGHTGREY 0xD69A
|
||||
#define TFT_DARKGREY 0x7BEF
|
||||
#define TFT_BLUE 0x001F
|
||||
#define TFT_GREEN 0x07E0
|
||||
#define TFT_CYAN 0x07FF
|
||||
#define TFT_RED 0xF800
|
||||
#define TFT_MAGENTA 0xF81F
|
||||
#define TFT_YELLOW 0xFFE0
|
||||
#define TFT_WHITE 0xFFFF
|
||||
#define TFT_ORANGE 0xFDA0
|
||||
#define TFT_GREENYELLOW 0xB7E0
|
||||
#define TFT_PINK 0xFE19
|
||||
#define TFT_BROWN 0x9A60
|
||||
#define TFT_GOLD 0xFEA0
|
||||
#define TFT_SILVER 0xC618
|
||||
#define TFT_SKYBLUE 0x867D
|
||||
#define TFT_VIOLET 0x915C
|
||||
#define TFT_TRANSPARENT 0x0120
|
||||
#endif
|
||||
|
||||
class TFT_eSPI;
|
||||
class tft_sprite;
|
||||
class tft_logger;
|
||||
|
||||
40
lib/HAL/display/tft_defines.h
Normal file
40
lib/HAL/display/tft_defines.h
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
#ifndef TL_DATUM
|
||||
#define TL_DATUM 0
|
||||
#define TC_DATUM 1
|
||||
#define TR_DATUM 2
|
||||
#define ML_DATUM 3
|
||||
#define MC_DATUM 4
|
||||
#define MR_DATUM 5
|
||||
#define BL_DATUM 6
|
||||
#define BC_DATUM 7
|
||||
#define BR_DATUM 8
|
||||
#endif
|
||||
|
||||
#ifndef TFT_BLACK
|
||||
#define TFT_BLACK 0x0000
|
||||
#define TFT_NAVY 0x000F
|
||||
#define TFT_DARKGREEN 0x03E0
|
||||
#define TFT_DARKCYAN 0x03EF
|
||||
#define TFT_MAROON 0x7800
|
||||
#define TFT_PURPLE 0x780F
|
||||
#define TFT_OLIVE 0x7BE0
|
||||
#define TFT_LIGHTGREY 0xD69A
|
||||
#define TFT_DARKGREY 0x7BEF
|
||||
#define TFT_BLUE 0x001F
|
||||
#define TFT_GREEN 0x07E0
|
||||
#define TFT_CYAN 0x07FF
|
||||
#define TFT_RED 0xF800
|
||||
#define TFT_MAGENTA 0xF81F
|
||||
#define TFT_YELLOW 0xFFE0
|
||||
#define TFT_WHITE 0xFFFF
|
||||
#define TFT_ORANGE 0xFDA0
|
||||
#define TFT_GREENYELLOW 0xB7E0
|
||||
#define TFT_PINK 0xFE19
|
||||
#define TFT_BROWN 0x9A60
|
||||
#define TFT_GOLD 0xFEA0
|
||||
#define TFT_SILVER 0xC618
|
||||
#define TFT_SKYBLUE 0x867D
|
||||
#define TFT_VIOLET 0x915C
|
||||
#define TFT_TRANSPARENT 0x0120
|
||||
#endif
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <pins_arduino.h>
|
||||
#ifdef USE_TFT_ESPI
|
||||
#include <TFT_eSPI.h>
|
||||
|
||||
#include "tft_defines.h"
|
||||
class tft_display : private TFT_eSPI {
|
||||
public:
|
||||
explicit tft_display(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
|
||||
|
||||
16
patch.py
16
patch.py
@@ -25,11 +25,13 @@ if not isfile(join(FRAMEWORK_DIR,mcu, "lib", ".patched")):
|
||||
FRAMEWORK_DIR, mcu, "lib", "libnet80211.a.patched"
|
||||
)
|
||||
|
||||
if mcu=="esp32c5":
|
||||
if mcu=="esp32c5" or mcu=="esp32c6" :
|
||||
env.Execute(
|
||||
"pio pkg exec -p toolchain-riscv32-esp -- riscv32-esp-elf-objcopy --weaken-symbol=ieee80211_raw_frame_sanity_check %s %s"
|
||||
% (original_file, patched_file)
|
||||
)
|
||||
elif mcu=="esp32p4":
|
||||
"""Do nothing"""
|
||||
else:
|
||||
env.Execute(
|
||||
"pio pkg exec -p toolchain-xtensa-%s -- xtensa-%s-elf-objcopy --weaken-symbol=ieee80211_raw_frame_sanity_check %s %s"
|
||||
@@ -38,8 +40,16 @@ if not isfile(join(FRAMEWORK_DIR,mcu, "lib", ".patched")):
|
||||
|
||||
if isfile("%s.old" % (original_file)):
|
||||
remove("%s.old" % (original_file))
|
||||
rename(original_file, "%s.old" % (original_file))
|
||||
rename(patched_file, original_file)
|
||||
|
||||
if isfile(original_file):
|
||||
rename(original_file, "%s.old" % (original_file))
|
||||
else:
|
||||
print("Patch: Original file not found")
|
||||
|
||||
if isfile(patched_file):
|
||||
rename(patched_file, original_file)
|
||||
else:
|
||||
print("Patch: Patched file not found")
|
||||
|
||||
|
||||
def _touch(path):
|
||||
|
||||
@@ -72,11 +72,13 @@ extra_configs =
|
||||
boards/*/*.ini
|
||||
|
||||
[env]
|
||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.34/platform-espressif32.zip
|
||||
;https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
|
||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.36/platform-espressif32.zip ; Arduino 3.3.6
|
||||
;https://github.com/pioarduino/platform-espressif32/releases/download/55.03.34/platform-espressif32.zip ; Arduino 3.3.4
|
||||
;https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip ; Last Version
|
||||
platform_packages =
|
||||
framework-arduinoespressif32-libs @ https://github.com/bmorcelli/esp32-arduino-lib-builder/releases/download/idf-release_v5.5/bruce_esp32-arduino-libs-20251205-131242.zip
|
||||
;framework-arduinoespressif32-libs @ https://github.com/bmorcelli/esp32-arduino-lib-builder/releases/download/idf-release_v5.5/esp32-arduino-libs-20250919-170356.zip
|
||||
framework-arduinoespressif32-libs @ https://github.com/bmorcelli/esp32-arduino-lib-builder/releases/download/idf-release_v5.5/bruce_esp32-arduino-libs-20260122-160712.zip ; Arduino 3.3.6
|
||||
;framework-arduinoespressif32-libs @ https://github.com/bmorcelli/esp32-arduino-lib-builder/releases/download/idf-release_v5.5/bruce_esp32-arduino-libs-20251205-131242.zip ; Arduino 3.3.4
|
||||
;framework-arduinoespressif32-libs @ https://github.com/bmorcelli/esp32-arduino-lib-builder/releases/download/idf-release_v5.5/esp32-arduino-libs-20250919-170356.zip ; Arduino 3.3.1
|
||||
|
||||
monitor_filters = esp32_exception_decoder, send_on_enter, colorize
|
||||
framework = arduino
|
||||
|
||||
@@ -430,7 +430,9 @@ void setup() {
|
||||
.cc = "US",
|
||||
.schan = 1,
|
||||
.nchan = 14,
|
||||
#ifdef CONFIG_ESP_PHY_MAX_TX_POWER
|
||||
.max_tx_power = CONFIG_ESP_PHY_MAX_TX_POWER, // 20
|
||||
#endif
|
||||
.policy = WIFI_COUNTRY_POLICY_MANUAL
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user