Skip to content

Commit c4664a6

Browse files
add ESP32-S3 3.13 Display support
1 parent 1005ca3 commit c4664a6

File tree

2 files changed

+250
-36
lines changed

2 files changed

+250
-36
lines changed

examples/PDQgraphicstest/Arduino_GFX_dev_device.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// #define ESP32_LCDKIT_PAR8A
1717
// #define ESP32_LCDKIT_PAR8B
1818
// #define ESP32_LCDKIT_PAR16
19+
// #define ESP32_S3_3_13_DISPLAY
1920
// #define ESP32_S3_BOX_3
2021
// #define ESP32_S3_EYE
2122
// #define ESP32_S3_RGB
@@ -263,6 +264,24 @@ Arduino_DataBus *bus = new Arduino_ESP32PAR16(
263264
25 /* D8 */, 26 /* D9 */, 12 /* D10 */, 13 /* D11 */, 14 /* D12 */, 15 /* D13 */, 2 /* D14 */, 4 /* D15 */);
264265
Arduino_GFX *gfx = new Arduino_ILI9341(bus, GFX_NOT_DEFINED /* RST */, 1 /* rotation */);
265266

267+
#elif defined(ESP32_S3_3_13_DISPLAY)
268+
#define GFX_DEV_DEVICE ESP32_S3_3_13_DISPLAY
269+
#define GFX_BL 4
270+
Arduino_DataBus *bus = new Arduino_SWSPI(
271+
GFX_NOT_DEFINED /* DC */, 0 /* CS */,
272+
17 /* SCK */, 16 /* MOSI */, GFX_NOT_DEFINED /* MISO */);
273+
#define RGB_PANEL
274+
Arduino_ESP32RGBPanel *rgbpanel = new Arduino_ESP32RGBPanel(
275+
15 /* DE */, 5 /* VSYNC */, 6 /* HSYNC */, 7 /* PCLK */,
276+
19 /* R0 */, 8 /* R1 */, 18 /* R2 */, 17 /* R3 */, 16 /* R4 */,
277+
11 /* G0 */, 10 /* G1 */, 9 /* G2 */, 46 /* G3 */, 3 /* G4 */, 20 /* G5 */,
278+
47 /* B0 */, 21 /* B1 */, 14 /* B2 */, 13 /* B3 */, 12 /* B4 */,
279+
1 /* hsync_polarity */, 30 /* hsync_front_porch */, 3 /* hsync_pulse_width */, 30 /* hsync_back_porch */,
280+
1 /* vsync_polarity */, 20 /* vsync_front_porch */, 2 /* vsync_pulse_width */, 20 /* vsync_back_porch */);
281+
Arduino_RGB_Display *gfx = new Arduino_RGB_Display(
282+
376 /* width */, 960 /* height */, rgbpanel, 0 /* rotation */, true /* auto_flush */,
283+
bus, GFX_NOT_DEFINED /* RST */, gc9503v_type2_init_operations, sizeof(gc9503v_type2_init_operations));
284+
266285
#elif defined(ESP32_S3_BOX_3)
267286
#define GFX_DEV_DEVICE ARDUINO_ESP32_S3_BOX_3
268287
#define GFX_BL 47

src/display/Arduino_RGB_Display.h

Lines changed: 231 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,203 @@ static const uint8_t gc9503v_type1_init_operations[] = {
211211
WRITE_COMMAND_8, 0x29,
212212
END_WRITE};
213213

214+
static const uint8_t gc9503v_type2_init_operations[] = {
215+
BEGIN_WRITE,
216+
WRITE_COMMAND_8, 0xF0,
217+
WRITE_BYTES, 5, 0x55, 0xAA, 0x52, 0x08, 0x00,
218+
219+
WRITE_C8_D16, 0xF6, 0x5A, 0x87,
220+
221+
WRITE_C8_D8, 0xC1, 0x3F,
222+
WRITE_C8_D8, 0xCD, 0x25,
223+
WRITE_C8_D8, 0xC9, 0x10,
224+
WRITE_C8_D8, 0xF8, 0x8A,
225+
WRITE_C8_D8, 0xAC, 0x45,
226+
WRITE_C8_D8, 0xA7, 0x47,
227+
WRITE_C8_D8, 0xA0, 0x88,
228+
229+
WRITE_COMMAND_8, 0x86,
230+
WRITE_BYTES, 4, 0x99, 0xA3, 0xA3, 0x51,
231+
WRITE_COMMAND_8, 0xFA,
232+
WRITE_BYTES, 4, 0x08, 0x08, 0x00, 0x04,
233+
234+
WRITE_C8_D8, 0xA3, 0x6E,
235+
236+
WRITE_COMMAND_8, 0xFD,
237+
WRITE_BYTES, 3, 0x28, 0x3C, 0x00,
238+
239+
WRITE_C8_D8, 0x9A, 0x4B,
240+
WRITE_C8_D8, 0x9B, 0x4B,
241+
242+
WRITE_C8_D16, 0x82, 0x20, 0x20,
243+
244+
WRITE_C8_D8, 0xB1, 0x10,
245+
246+
WRITE_C8_D16, 0x7A, 0x0F, 0x13,
247+
WRITE_C8_D16, 0x7B, 0x0F, 0x13,
248+
249+
WRITE_COMMAND_8, 0x6D,
250+
WRITE_BYTES, 32,
251+
0x1e, 0x1e, 0x04, 0x02,
252+
0x0d, 0x1e, 0x12, 0x11,
253+
0x14, 0x13, 0x05, 0x06,
254+
0x1d, 0x1e, 0x1e, 0x1e,
255+
0x1e, 0x1e, 0x1e, 0x1d,
256+
0x06, 0x05, 0x0b, 0x0c,
257+
0x09, 0x0a, 0x1e, 0x0d,
258+
0x01, 0x03, 0x1e, 0x1e,
259+
260+
WRITE_COMMAND_8, 0x64,
261+
WRITE_BYTES, 16,
262+
0x38, 0x08, 0x03, 0xc0,
263+
0x03, 0x03, 0x38, 0x06,
264+
0x03, 0xc2, 0x03, 0x03,
265+
0x20, 0x6d, 0x20, 0x6d,
266+
267+
WRITE_COMMAND_8, 0x65,
268+
WRITE_BYTES, 16,
269+
0x38, 0x04, 0x03, 0xc4,
270+
0x03, 0x03, 0x38, 0x02,
271+
0x03, 0xc6, 0x03, 0x03,
272+
0x20, 0x6d, 0x20, 0x6d,
273+
274+
WRITE_COMMAND_8, 0x66,
275+
WRITE_BYTES, 16,
276+
0x83, 0xcf, 0x03, 0xc8,
277+
0x03, 0x03, 0x83, 0xd3,
278+
0x03, 0xd2, 0x03, 0x03,
279+
0x20, 0x6d, 0x20, 0x6d,
280+
281+
WRITE_COMMAND_8, 0x60,
282+
WRITE_BYTES, 8,
283+
0x38, 0x0C, 0x20, 0x6D,
284+
0x38, 0x0B, 0x20, 0x6D,
285+
286+
WRITE_COMMAND_8, 0x61,
287+
WRITE_BYTES, 8,
288+
0x38, 0x0A, 0x20, 0x6D,
289+
0x38, 0x09, 0x20, 0x6D,
290+
291+
WRITE_COMMAND_8, 0x62,
292+
WRITE_BYTES, 8,
293+
0x38, 0x25, 0x20, 0x6D,
294+
0x63, 0xC9, 0x20, 0x6D,
295+
296+
WRITE_COMMAND_8, 0x69,
297+
WRITE_BYTES, 7,
298+
0x14, 0x22, 0x14, 0x22,
299+
0x14, 0x22, 0x08,
300+
301+
WRITE_C8_D8, 0x6B, 0x07,
302+
303+
WRITE_COMMAND_8, 0xD1,
304+
WRITE_BYTES, 52,
305+
0x00, 0x00, 0x00, 0x70,
306+
0x00, 0x8f, 0x00, 0xab,
307+
0x00, 0xbf, 0x00, 0xdf,
308+
0x00, 0xfa, 0x01, 0x2a,
309+
0x01, 0x52, 0x01, 0x90,
310+
0x01, 0xc1, 0x02, 0x0e,
311+
0x02, 0x4f, 0x02, 0x51,
312+
0x02, 0x8d, 0x02, 0xd3,
313+
0x02, 0xff, 0x03, 0x3c,
314+
0x03, 0x64, 0x03, 0xa1,
315+
0x03, 0xf1, 0x03, 0xff,
316+
0x03, 0xfF, 0x03, 0xff,
317+
0x03, 0xFf, 0x03, 0xFF,
318+
319+
WRITE_COMMAND_8, 0xD2,
320+
WRITE_BYTES, 52,
321+
0x00, 0x00, 0x00, 0x70,
322+
0x00, 0x8f, 0x00, 0xab,
323+
0x00, 0xbf, 0x00, 0xdf,
324+
0x00, 0xfa, 0x01, 0x2a,
325+
0x01, 0x52, 0x01, 0x90,
326+
0x01, 0xc1, 0x02, 0x0e,
327+
0x02, 0x4f, 0x02, 0x51,
328+
0x02, 0x8d, 0x02, 0xd3,
329+
0x02, 0xff, 0x03, 0x3c,
330+
0x03, 0x64, 0x03, 0xa1,
331+
0x03, 0xf1, 0x03, 0xff,
332+
0x03, 0xfF, 0x03, 0xff,
333+
0x03, 0xFf, 0x03, 0xFF,
334+
335+
WRITE_COMMAND_8, 0xD3,
336+
WRITE_BYTES, 52,
337+
0x00, 0x00, 0x00, 0x70,
338+
0x00, 0x8f, 0x00, 0xab,
339+
0x00, 0xbf, 0x00, 0xdf,
340+
0x00, 0xfa, 0x01, 0x2a,
341+
0x01, 0x52, 0x01, 0x90,
342+
0x01, 0xc1, 0x02, 0x0e,
343+
0x02, 0x4f, 0x02, 0x51,
344+
0x02, 0x8d, 0x02, 0xd3,
345+
0x02, 0xff, 0x03, 0x3c,
346+
0x03, 0x64, 0x03, 0xa1,
347+
0x03, 0xf1, 0x03, 0xff,
348+
0x03, 0xfF, 0x03, 0xff,
349+
0x03, 0xFf, 0x03, 0xFF,
350+
351+
WRITE_COMMAND_8, 0xD4,
352+
WRITE_BYTES, 52,
353+
0x00, 0x00, 0x00, 0x70,
354+
0x00, 0x8f, 0x00, 0xab,
355+
0x00, 0xbf, 0x00, 0xdf,
356+
0x00, 0xfa, 0x01, 0x2a,
357+
0x01, 0x52, 0x01, 0x90,
358+
0x01, 0xc1, 0x02, 0x0e,
359+
0x02, 0x4f, 0x02, 0x51,
360+
0x02, 0x8d, 0x02, 0xd3,
361+
0x02, 0xff, 0x03, 0x3c,
362+
0x03, 0x64, 0x03, 0xa1,
363+
0x03, 0xf1, 0x03, 0xff,
364+
0x03, 0xfF, 0x03, 0xff,
365+
0x03, 0xFf, 0x03, 0xFF,
366+
367+
WRITE_COMMAND_8, 0xD5,
368+
WRITE_BYTES, 52,
369+
0x00, 0x00, 0x00, 0x70,
370+
0x00, 0x8f, 0x00, 0xab,
371+
0x00, 0xbf, 0x00, 0xdf,
372+
0x00, 0xfa, 0x01, 0x2a,
373+
0x01, 0x52, 0x01, 0x90,
374+
0x01, 0xc1, 0x02, 0x0e,
375+
0x02, 0x4f, 0x02, 0x51,
376+
0x02, 0x8d, 0x02, 0xd3,
377+
0x02, 0xff, 0x03, 0x3c,
378+
0x03, 0x64, 0x03, 0xa1,
379+
0x03, 0xf1, 0x03, 0xff,
380+
0x03, 0xfF, 0x03, 0xff,
381+
0x03, 0xFf, 0x03, 0xFF,
382+
383+
WRITE_COMMAND_8, 0xD6,
384+
WRITE_BYTES, 52,
385+
0x00, 0x00, 0x00, 0x70,
386+
0x00, 0x8f, 0x00, 0xab,
387+
0x00, 0xbf, 0x00, 0xdf,
388+
0x00, 0xfa, 0x01, 0x2a,
389+
0x01, 0x52, 0x01, 0x90,
390+
0x01, 0xc1, 0x02, 0x0e,
391+
0x02, 0x4f, 0x02, 0x51,
392+
0x02, 0x8d, 0x02, 0xd3,
393+
0x02, 0xff, 0x03, 0x3c,
394+
0x03, 0x64, 0x03, 0xa1,
395+
0x03, 0xf1, 0x03, 0xff,
396+
0x03, 0xfF, 0x03, 0xff,
397+
0x03, 0xFf, 0x03, 0xFF,
398+
WRITE_C8_D8, 0x3a, 0x55,
399+
400+
WRITE_COMMAND_8, 0x11,
401+
END_WRITE,
402+
403+
DELAY, 120,
404+
405+
BEGIN_WRITE,
406+
WRITE_COMMAND_8, 0x29,
407+
END_WRITE,
408+
409+
DELAY, 120};
410+
214411
static const uint8_t st7701_type1_init_operations[] = {
215412
BEGIN_WRITE,
216413
WRITE_COMMAND_8, 0xFF,
@@ -1250,7 +1447,7 @@ static const uint8_t st7701_type9_init_operations[] = {
12501447
WRITE_COMMAND_8, 0xFF,
12511448
WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x00,
12521449

1253-
//WRITE_COMMAND_8, 0x21, // 0x20 normal, 0x21 IPS // commented by manufacture
1450+
// WRITE_COMMAND_8, 0x21, // 0x20 normal, 0x21 IPS // commented by manufacture
12541451
WRITE_C8_D8, 0x3A, 0x60, // 0x70 RGB888, 0x60 RGB666, 0x50 RGB565
12551452

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

2172-
WRITE_C8_D16, 0xE5, 0x00, 0x00
2173-
};
2369+
WRITE_C8_D16, 0xE5, 0x00, 0x00};
21742370

21752371
// HD458002C40 4.58" bar display
21762372
// 1 /* hync_polarity */, 10 /* hsync_front_porch */, 10 /* hsync_pulse_width */, 50 /* hsync_back_porch */,
@@ -2254,45 +2450,44 @@ static const uint8_t HD458002C40_init_operations[] = {
22542450
BEGIN_WRITE,
22552451
WRITE_C8_D8, 0x35, 0x00,
22562452
WRITE_C8_D8, 0x3A, 0x66,
2257-
WRITE_COMMAND_8, 0x29
2258-
};
2453+
WRITE_COMMAND_8, 0x29};
22592454

22602455
class Arduino_RGB_Display : public Arduino_GFX
22612456
{
22622457
public:
2263-
Arduino_RGB_Display(
2264-
int16_t w, int16_t h, Arduino_ESP32RGBPanel *rgbpanel, uint8_t r = 0, bool auto_flush = true,
2265-
Arduino_DataBus *bus = NULL, int8_t rst = GFX_NOT_DEFINED, const uint8_t *init_operations = NULL, size_t init_operations_len = GFX_NOT_DEFINED,
2266-
uint8_t col_offset1 = 0, uint8_t row_offset1 = 0, uint8_t col_offset2 = 0, uint8_t row_offset2 = 0);
2267-
2268-
bool begin(int32_t speed = GFX_NOT_DEFINED) override;
2269-
void writePixelPreclipped(int16_t x, int16_t y, uint16_t color) override;
2270-
void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override;
2271-
void writeFastVLineCore(int16_t x, int16_t y, int16_t h, uint16_t color);
2272-
void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override;
2273-
void writeFastHLineCore(int16_t x, int16_t y, int16_t w, uint16_t color);
2274-
void writeFillRectPreclipped(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) override;
2275-
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;
2276-
void draw16bitRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
2277-
void draw16bitBeRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
2278-
void flush(void) override;
2279-
2280-
uint16_t *getFramebuffer();
2458+
Arduino_RGB_Display(
2459+
int16_t w, int16_t h, Arduino_ESP32RGBPanel *rgbpanel, uint8_t r = 0, bool auto_flush = true,
2460+
Arduino_DataBus *bus = NULL, int8_t rst = GFX_NOT_DEFINED, const uint8_t *init_operations = NULL, size_t init_operations_len = GFX_NOT_DEFINED,
2461+
uint8_t col_offset1 = 0, uint8_t row_offset1 = 0, uint8_t col_offset2 = 0, uint8_t row_offset2 = 0);
2462+
2463+
bool begin(int32_t speed = GFX_NOT_DEFINED) override;
2464+
void writePixelPreclipped(int16_t x, int16_t y, uint16_t color) override;
2465+
void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override;
2466+
void writeFastVLineCore(int16_t x, int16_t y, int16_t h, uint16_t color);
2467+
void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override;
2468+
void writeFastHLineCore(int16_t x, int16_t y, int16_t w, uint16_t color);
2469+
void writeFillRectPreclipped(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) override;
2470+
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;
2471+
void draw16bitRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
2472+
void draw16bitBeRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
2473+
void flush(void) override;
2474+
2475+
uint16_t *getFramebuffer();
22812476

22822477
protected:
2283-
uint16_t *_framebuffer;
2284-
size_t _framebuffer_size;
2285-
Arduino_ESP32RGBPanel *_rgbpanel;
2286-
bool _auto_flush;
2287-
Arduino_DataBus *_bus;
2288-
int8_t _rst;
2289-
const uint8_t *_init_operations;
2290-
size_t _init_operations_len;
2291-
int16_t MAX_X, MAX_Y;
2292-
uint8_t COL_OFFSET1, ROW_OFFSET1;
2293-
uint8_t COL_OFFSET2, ROW_OFFSET2;
2294-
uint8_t _xStart, _yStart;
2295-
uint16_t _fb_width, _fb_height, _fb_max_x, _fb_max_y;
2478+
uint16_t *_framebuffer;
2479+
size_t _framebuffer_size;
2480+
Arduino_ESP32RGBPanel *_rgbpanel;
2481+
bool _auto_flush;
2482+
Arduino_DataBus *_bus;
2483+
int8_t _rst;
2484+
const uint8_t *_init_operations;
2485+
size_t _init_operations_len;
2486+
int16_t MAX_X, MAX_Y;
2487+
uint8_t COL_OFFSET1, ROW_OFFSET1;
2488+
uint8_t COL_OFFSET2, ROW_OFFSET2;
2489+
uint8_t _xStart, _yStart;
2490+
uint16_t _fb_width, _fb_height, _fb_max_x, _fb_max_y;
22962491

22972492
private:
22982493
};

0 commit comments

Comments
 (0)