Skip to content

Commit

Permalink
add ESP32-S3 3.13 Display support
Browse files Browse the repository at this point in the history
  • Loading branch information
moononournation committed Oct 31, 2024
1 parent 1005ca3 commit c4664a6
Show file tree
Hide file tree
Showing 2 changed files with 250 additions and 36 deletions.
19 changes: 19 additions & 0 deletions examples/PDQgraphicstest/Arduino_GFX_dev_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// #define ESP32_LCDKIT_PAR8A
// #define ESP32_LCDKIT_PAR8B
// #define ESP32_LCDKIT_PAR16
// #define ESP32_S3_3_13_DISPLAY
// #define ESP32_S3_BOX_3
// #define ESP32_S3_EYE
// #define ESP32_S3_RGB
Expand Down Expand Up @@ -263,6 +264,24 @@ Arduino_DataBus *bus = new Arduino_ESP32PAR16(
25 /* D8 */, 26 /* D9 */, 12 /* D10 */, 13 /* D11 */, 14 /* D12 */, 15 /* D13 */, 2 /* D14 */, 4 /* D15 */);
Arduino_GFX *gfx = new Arduino_ILI9341(bus, GFX_NOT_DEFINED /* RST */, 1 /* rotation */);

#elif defined(ESP32_S3_3_13_DISPLAY)
#define GFX_DEV_DEVICE ESP32_S3_3_13_DISPLAY
#define GFX_BL 4
Arduino_DataBus *bus = new Arduino_SWSPI(
GFX_NOT_DEFINED /* DC */, 0 /* CS */,
17 /* SCK */, 16 /* MOSI */, GFX_NOT_DEFINED /* MISO */);
#define RGB_PANEL
Arduino_ESP32RGBPanel *rgbpanel = new Arduino_ESP32RGBPanel(
15 /* DE */, 5 /* VSYNC */, 6 /* HSYNC */, 7 /* PCLK */,
19 /* R0 */, 8 /* R1 */, 18 /* R2 */, 17 /* R3 */, 16 /* R4 */,
11 /* G0 */, 10 /* G1 */, 9 /* G2 */, 46 /* G3 */, 3 /* G4 */, 20 /* G5 */,
47 /* B0 */, 21 /* B1 */, 14 /* B2 */, 13 /* B3 */, 12 /* B4 */,
1 /* hsync_polarity */, 30 /* hsync_front_porch */, 3 /* hsync_pulse_width */, 30 /* hsync_back_porch */,
1 /* vsync_polarity */, 20 /* vsync_front_porch */, 2 /* vsync_pulse_width */, 20 /* vsync_back_porch */);
Arduino_RGB_Display *gfx = new Arduino_RGB_Display(
376 /* width */, 960 /* height */, rgbpanel, 0 /* rotation */, true /* auto_flush */,
bus, GFX_NOT_DEFINED /* RST */, gc9503v_type2_init_operations, sizeof(gc9503v_type2_init_operations));

#elif defined(ESP32_S3_BOX_3)
#define GFX_DEV_DEVICE ARDUINO_ESP32_S3_BOX_3
#define GFX_BL 47
Expand Down
267 changes: 231 additions & 36 deletions src/display/Arduino_RGB_Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,203 @@ static const uint8_t gc9503v_type1_init_operations[] = {
WRITE_COMMAND_8, 0x29,
END_WRITE};

static const uint8_t gc9503v_type2_init_operations[] = {
BEGIN_WRITE,
WRITE_COMMAND_8, 0xF0,
WRITE_BYTES, 5, 0x55, 0xAA, 0x52, 0x08, 0x00,

WRITE_C8_D16, 0xF6, 0x5A, 0x87,

WRITE_C8_D8, 0xC1, 0x3F,
WRITE_C8_D8, 0xCD, 0x25,
WRITE_C8_D8, 0xC9, 0x10,
WRITE_C8_D8, 0xF8, 0x8A,
WRITE_C8_D8, 0xAC, 0x45,
WRITE_C8_D8, 0xA7, 0x47,
WRITE_C8_D8, 0xA0, 0x88,

WRITE_COMMAND_8, 0x86,
WRITE_BYTES, 4, 0x99, 0xA3, 0xA3, 0x51,
WRITE_COMMAND_8, 0xFA,
WRITE_BYTES, 4, 0x08, 0x08, 0x00, 0x04,

WRITE_C8_D8, 0xA3, 0x6E,

WRITE_COMMAND_8, 0xFD,
WRITE_BYTES, 3, 0x28, 0x3C, 0x00,

WRITE_C8_D8, 0x9A, 0x4B,
WRITE_C8_D8, 0x9B, 0x4B,

WRITE_C8_D16, 0x82, 0x20, 0x20,

WRITE_C8_D8, 0xB1, 0x10,

WRITE_C8_D16, 0x7A, 0x0F, 0x13,
WRITE_C8_D16, 0x7B, 0x0F, 0x13,

WRITE_COMMAND_8, 0x6D,
WRITE_BYTES, 32,
0x1e, 0x1e, 0x04, 0x02,
0x0d, 0x1e, 0x12, 0x11,
0x14, 0x13, 0x05, 0x06,
0x1d, 0x1e, 0x1e, 0x1e,
0x1e, 0x1e, 0x1e, 0x1d,
0x06, 0x05, 0x0b, 0x0c,
0x09, 0x0a, 0x1e, 0x0d,
0x01, 0x03, 0x1e, 0x1e,

WRITE_COMMAND_8, 0x64,
WRITE_BYTES, 16,
0x38, 0x08, 0x03, 0xc0,
0x03, 0x03, 0x38, 0x06,
0x03, 0xc2, 0x03, 0x03,
0x20, 0x6d, 0x20, 0x6d,

WRITE_COMMAND_8, 0x65,
WRITE_BYTES, 16,
0x38, 0x04, 0x03, 0xc4,
0x03, 0x03, 0x38, 0x02,
0x03, 0xc6, 0x03, 0x03,
0x20, 0x6d, 0x20, 0x6d,

WRITE_COMMAND_8, 0x66,
WRITE_BYTES, 16,
0x83, 0xcf, 0x03, 0xc8,
0x03, 0x03, 0x83, 0xd3,
0x03, 0xd2, 0x03, 0x03,
0x20, 0x6d, 0x20, 0x6d,

WRITE_COMMAND_8, 0x60,
WRITE_BYTES, 8,
0x38, 0x0C, 0x20, 0x6D,
0x38, 0x0B, 0x20, 0x6D,

WRITE_COMMAND_8, 0x61,
WRITE_BYTES, 8,
0x38, 0x0A, 0x20, 0x6D,
0x38, 0x09, 0x20, 0x6D,

WRITE_COMMAND_8, 0x62,
WRITE_BYTES, 8,
0x38, 0x25, 0x20, 0x6D,
0x63, 0xC9, 0x20, 0x6D,

WRITE_COMMAND_8, 0x69,
WRITE_BYTES, 7,
0x14, 0x22, 0x14, 0x22,
0x14, 0x22, 0x08,

WRITE_C8_D8, 0x6B, 0x07,

WRITE_COMMAND_8, 0xD1,
WRITE_BYTES, 52,
0x00, 0x00, 0x00, 0x70,
0x00, 0x8f, 0x00, 0xab,
0x00, 0xbf, 0x00, 0xdf,
0x00, 0xfa, 0x01, 0x2a,
0x01, 0x52, 0x01, 0x90,
0x01, 0xc1, 0x02, 0x0e,
0x02, 0x4f, 0x02, 0x51,
0x02, 0x8d, 0x02, 0xd3,
0x02, 0xff, 0x03, 0x3c,
0x03, 0x64, 0x03, 0xa1,
0x03, 0xf1, 0x03, 0xff,
0x03, 0xfF, 0x03, 0xff,
0x03, 0xFf, 0x03, 0xFF,

WRITE_COMMAND_8, 0xD2,
WRITE_BYTES, 52,
0x00, 0x00, 0x00, 0x70,
0x00, 0x8f, 0x00, 0xab,
0x00, 0xbf, 0x00, 0xdf,
0x00, 0xfa, 0x01, 0x2a,
0x01, 0x52, 0x01, 0x90,
0x01, 0xc1, 0x02, 0x0e,
0x02, 0x4f, 0x02, 0x51,
0x02, 0x8d, 0x02, 0xd3,
0x02, 0xff, 0x03, 0x3c,
0x03, 0x64, 0x03, 0xa1,
0x03, 0xf1, 0x03, 0xff,
0x03, 0xfF, 0x03, 0xff,
0x03, 0xFf, 0x03, 0xFF,

WRITE_COMMAND_8, 0xD3,
WRITE_BYTES, 52,
0x00, 0x00, 0x00, 0x70,
0x00, 0x8f, 0x00, 0xab,
0x00, 0xbf, 0x00, 0xdf,
0x00, 0xfa, 0x01, 0x2a,
0x01, 0x52, 0x01, 0x90,
0x01, 0xc1, 0x02, 0x0e,
0x02, 0x4f, 0x02, 0x51,
0x02, 0x8d, 0x02, 0xd3,
0x02, 0xff, 0x03, 0x3c,
0x03, 0x64, 0x03, 0xa1,
0x03, 0xf1, 0x03, 0xff,
0x03, 0xfF, 0x03, 0xff,
0x03, 0xFf, 0x03, 0xFF,

WRITE_COMMAND_8, 0xD4,
WRITE_BYTES, 52,
0x00, 0x00, 0x00, 0x70,
0x00, 0x8f, 0x00, 0xab,
0x00, 0xbf, 0x00, 0xdf,
0x00, 0xfa, 0x01, 0x2a,
0x01, 0x52, 0x01, 0x90,
0x01, 0xc1, 0x02, 0x0e,
0x02, 0x4f, 0x02, 0x51,
0x02, 0x8d, 0x02, 0xd3,
0x02, 0xff, 0x03, 0x3c,
0x03, 0x64, 0x03, 0xa1,
0x03, 0xf1, 0x03, 0xff,
0x03, 0xfF, 0x03, 0xff,
0x03, 0xFf, 0x03, 0xFF,

WRITE_COMMAND_8, 0xD5,
WRITE_BYTES, 52,
0x00, 0x00, 0x00, 0x70,
0x00, 0x8f, 0x00, 0xab,
0x00, 0xbf, 0x00, 0xdf,
0x00, 0xfa, 0x01, 0x2a,
0x01, 0x52, 0x01, 0x90,
0x01, 0xc1, 0x02, 0x0e,
0x02, 0x4f, 0x02, 0x51,
0x02, 0x8d, 0x02, 0xd3,
0x02, 0xff, 0x03, 0x3c,
0x03, 0x64, 0x03, 0xa1,
0x03, 0xf1, 0x03, 0xff,
0x03, 0xfF, 0x03, 0xff,
0x03, 0xFf, 0x03, 0xFF,

WRITE_COMMAND_8, 0xD6,
WRITE_BYTES, 52,
0x00, 0x00, 0x00, 0x70,
0x00, 0x8f, 0x00, 0xab,
0x00, 0xbf, 0x00, 0xdf,
0x00, 0xfa, 0x01, 0x2a,
0x01, 0x52, 0x01, 0x90,
0x01, 0xc1, 0x02, 0x0e,
0x02, 0x4f, 0x02, 0x51,
0x02, 0x8d, 0x02, 0xd3,
0x02, 0xff, 0x03, 0x3c,
0x03, 0x64, 0x03, 0xa1,
0x03, 0xf1, 0x03, 0xff,
0x03, 0xfF, 0x03, 0xff,
0x03, 0xFf, 0x03, 0xFF,
WRITE_C8_D8, 0x3a, 0x55,

WRITE_COMMAND_8, 0x11,
END_WRITE,

DELAY, 120,

BEGIN_WRITE,
WRITE_COMMAND_8, 0x29,
END_WRITE,

DELAY, 120};

static const uint8_t st7701_type1_init_operations[] = {
BEGIN_WRITE,
WRITE_COMMAND_8, 0xFF,
Expand Down Expand Up @@ -1250,7 +1447,7 @@ static const uint8_t st7701_type9_init_operations[] = {
WRITE_COMMAND_8, 0xFF,
WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x00,

//WRITE_COMMAND_8, 0x21, // 0x20 normal, 0x21 IPS // commented by manufacture
// WRITE_COMMAND_8, 0x21, // 0x20 normal, 0x21 IPS // commented by manufacture
WRITE_C8_D8, 0x3A, 0x60, // 0x70 RGB888, 0x60 RGB666, 0x50 RGB565

WRITE_COMMAND_8, 0x11, // Sleep Out
Expand Down Expand Up @@ -2169,8 +2366,7 @@ static const uint8_t HD371001C40_init_operations[] = {
WRITE_COMMAND_8, 0xFF,
WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x10,

WRITE_C8_D16, 0xE5, 0x00, 0x00
};
WRITE_C8_D16, 0xE5, 0x00, 0x00};

// HD458002C40 4.58" bar display
// 1 /* hync_polarity */, 10 /* hsync_front_porch */, 10 /* hsync_pulse_width */, 50 /* hsync_back_porch */,
Expand Down Expand Up @@ -2254,45 +2450,44 @@ static const uint8_t HD458002C40_init_operations[] = {
BEGIN_WRITE,
WRITE_C8_D8, 0x35, 0x00,
WRITE_C8_D8, 0x3A, 0x66,
WRITE_COMMAND_8, 0x29
};
WRITE_COMMAND_8, 0x29};

class Arduino_RGB_Display : public Arduino_GFX
{
public:
Arduino_RGB_Display(
int16_t w, int16_t h, Arduino_ESP32RGBPanel *rgbpanel, uint8_t r = 0, bool auto_flush = true,
Arduino_DataBus *bus = NULL, int8_t rst = GFX_NOT_DEFINED, const uint8_t *init_operations = NULL, size_t init_operations_len = GFX_NOT_DEFINED,
uint8_t col_offset1 = 0, uint8_t row_offset1 = 0, uint8_t col_offset2 = 0, uint8_t row_offset2 = 0);

bool begin(int32_t speed = GFX_NOT_DEFINED) override;
void writePixelPreclipped(int16_t x, int16_t y, uint16_t color) override;
void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override;
void writeFastVLineCore(int16_t x, int16_t y, int16_t h, uint16_t color);
void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override;
void writeFastHLineCore(int16_t x, int16_t y, int16_t w, uint16_t color);
void writeFillRectPreclipped(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) override;
void drawIndexedBitmap(int16_t x, int16_t y, uint8_t *bitmap, uint16_t *color_index, int16_t w, int16_t h, int16_t x_skip = 0) override;
void draw16bitRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
void draw16bitBeRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
void flush(void) override;

uint16_t *getFramebuffer();
Arduino_RGB_Display(
int16_t w, int16_t h, Arduino_ESP32RGBPanel *rgbpanel, uint8_t r = 0, bool auto_flush = true,
Arduino_DataBus *bus = NULL, int8_t rst = GFX_NOT_DEFINED, const uint8_t *init_operations = NULL, size_t init_operations_len = GFX_NOT_DEFINED,
uint8_t col_offset1 = 0, uint8_t row_offset1 = 0, uint8_t col_offset2 = 0, uint8_t row_offset2 = 0);

bool begin(int32_t speed = GFX_NOT_DEFINED) override;
void writePixelPreclipped(int16_t x, int16_t y, uint16_t color) override;
void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override;
void writeFastVLineCore(int16_t x, int16_t y, int16_t h, uint16_t color);
void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override;
void writeFastHLineCore(int16_t x, int16_t y, int16_t w, uint16_t color);
void writeFillRectPreclipped(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) override;
void drawIndexedBitmap(int16_t x, int16_t y, uint8_t *bitmap, uint16_t *color_index, int16_t w, int16_t h, int16_t x_skip = 0) override;
void draw16bitRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
void draw16bitBeRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
void flush(void) override;

uint16_t *getFramebuffer();

protected:
uint16_t *_framebuffer;
size_t _framebuffer_size;
Arduino_ESP32RGBPanel *_rgbpanel;
bool _auto_flush;
Arduino_DataBus *_bus;
int8_t _rst;
const uint8_t *_init_operations;
size_t _init_operations_len;
int16_t MAX_X, MAX_Y;
uint8_t COL_OFFSET1, ROW_OFFSET1;
uint8_t COL_OFFSET2, ROW_OFFSET2;
uint8_t _xStart, _yStart;
uint16_t _fb_width, _fb_height, _fb_max_x, _fb_max_y;
uint16_t *_framebuffer;
size_t _framebuffer_size;
Arduino_ESP32RGBPanel *_rgbpanel;
bool _auto_flush;
Arduino_DataBus *_bus;
int8_t _rst;
const uint8_t *_init_operations;
size_t _init_operations_len;
int16_t MAX_X, MAX_Y;
uint8_t COL_OFFSET1, ROW_OFFSET1;
uint8_t COL_OFFSET2, ROW_OFFSET2;
uint8_t _xStart, _yStart;
uint16_t _fb_width, _fb_height, _fb_max_x, _fb_max_y;

private:
};
Expand Down

0 comments on commit c4664a6

Please sign in to comment.