Skip to content

Commit 0984992

Browse files
committed
Merge remote-tracking branch 'origin/master' into 4bpp_rotation
2 parents 836369c + 592af1f commit 0984992

File tree

5 files changed

+103
-12
lines changed

5 files changed

+103
-12
lines changed

Extensions/Tcon.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,20 +268,29 @@ void TFT_eSPI::tconHostAreaPackedPixelWrite(TCONLdImgInfo* pstLdImgInfo,TCONArea
268268
tconLoadImgAreaStart(pstLdImgInfo , pstAreaImgInfo);
269269
//printf("---IT8951 Host Area Packed Pixel Write begin---\r\n");
270270
//Host Write Data
271-
uint16_t *mirroredFrameBuf = (uint16_t *)malloc(pstAreaImgInfo->usWidth * pstAreaImgInfo->usHeight * sizeof(uint16_t));
271+
272+
273+
uint16_t height = pstAreaImgInfo->usHeight;
274+
uint16_t width = pstAreaImgInfo->usWidth;
275+
if(pstLdImgInfo->usPixelFormat == IT8951_4BPP)
276+
width = width / 4;
277+
else if(pstLdImgInfo->usPixelFormat == IT8951_8BPP)
278+
width = width / 2;
279+
280+
TWord *mirroredFrameBuf = (TWord *)malloc(width * height * sizeof(TWord));
272281
if(mirroredFrameBuf == NULL) {
273282
return;
274283
}
275284

276-
for (uint16_t j = 0; j < pstAreaImgInfo->usHeight; j++) {
277-
for (uint16_t i = 0; i < pstAreaImgInfo->usWidth; i++) {
285+
for (uint16_t j = 0; j < height; j++) {
286+
for (uint16_t i = 0; i < width; i++) {
278287
if(pstLdImgInfo->usFilp)
279-
mirroredFrameBuf[j * pstAreaImgInfo->usWidth + i] = reverse_bits_16(pusFrameBuf[j * pstAreaImgInfo->usWidth + i]);
288+
mirroredFrameBuf[j * width + i] = reverse_bits_16(pusFrameBuf[j * width + i]);
280289
else
281-
mirroredFrameBuf[j * pstAreaImgInfo->usWidth + i] = pusFrameBuf[j * pstAreaImgInfo->usWidth + (pstAreaImgInfo->usWidth - 1 - i)];
290+
mirroredFrameBuf[j * width + i] = pusFrameBuf[j * width + (width - 1 - i)];
282291
}
283292
}
284-
tconWirteNData(mirroredFrameBuf, pstAreaImgInfo->usHeight * pstAreaImgInfo->usWidth / 2);
293+
tconWirteNData(mirroredFrameBuf, height * width );
285294
free(mirroredFrameBuf);
286295
// for(j=0;j< pstAreaImgInfo->usHeight;j++)
287296
// {
@@ -370,7 +379,7 @@ void TFT_eSPI::tconLoadImage(const TByte* pImgBuf, TWord usX, TWord usY, TWord u
370379
//Setting Load image information
371380
stLdImgInfo.ulStartFBAddr = (TDWord) pImgBuf;
372381
stLdImgInfo.usEndianType = IT8951_LDIMG_L_ENDIAN;
373-
stLdImgInfo.usPixelFormat = IT8951_4BPP; //we use 8bpp because IT8951 dose not support 1bpp mode for load image�Aso we use Load 8bpp mode ,but the transfer size needs to be reduced to Size/8
382+
stLdImgInfo.usPixelFormat = IT8951_4BPP;
374383
stLdImgInfo.usRotate = IT8951_ROTATE_0;
375384
stLdImgInfo.ulImgBufBaseAddr = _gulImgBufAddr;
376385
stLdImgInfo.usFilp = enFilp;

TFT_Drivers/ED2208_Init.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,12 @@
7676
writedata(0x00);
7777

7878
writecommand(EPD_TRES);
79-
writedata(0x03);
80-
writedata(0x20);
81-
writedata(0x01);
82-
writedata(0xE0);
79+
writedata((TFT_WIDTH >> 8) & 0xFF);
80+
writedata(TFT_WIDTH & 0xFF);
81+
writedata((TFT_HEIGHT >> 8) & 0xFF);
82+
writedata(TFT_HEIGHT & 0xFF);
8383

84+
8485
writecommand(EPD_VDCS);
8586
writedata(0x1E);
8687

User_Setups/Dynamic_Setup.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,10 @@
318318
#define USE_BWRY_EPAPER
319319
#define ENABLE_EPAPER_BOARD_PIN_SETUPS
320320
#include <User_Setups/Setup513_Seeed_XIAO_EPaper_2inch13_BWRY.h>
321+
#elif BOARD_SCREEN_COMBO == 514
322+
#define USE_COLORFULL_EPAPER
323+
#define ENABLE_EPAPER_BOARD_PIN_SETUPS
324+
#include <User_Setups/Setup514_Seeed_XIAO_EPaper_4inch0_colorful.h> // Setup file for Seeed XIAO with 4.0inch colorful ePaper
321325
#elif BOARD_SCREEN_COMBO == 520
322326
#define ENABLE_EPAPER_BOARD_PIN_SETUPS
323327
#include <User_Setups/Setup520_Seeed_reTerminal_E1001.h>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#include <Wire.h>
2+
3+
#define USER_SETUP_ID 514
4+
5+
#define ED2208_DRIVER
6+
7+
8+
#define EPAPER_ENABLE
9+
10+
#define TFT_WIDTH 400
11+
#define TFT_HEIGHT 600
12+
13+
#define EPD_WIDTH TFT_WIDTH
14+
#define EPD_HEIGHT TFT_HEIGHT
15+
16+
// #define EPD_HORIZONTAL_MIRROR
17+
18+
#ifdef ENABLE_EPAPER_BOARD_PIN_SETUPS
19+
#include "EPaper_Board_Pins_Setups.h"
20+
#else
21+
#define TFT_SCLK D8
22+
#define TFT_MISO D9
23+
#define TFT_MOSI D10
24+
#define TFT_CS D7 // Chip select control pin
25+
#define TFT_DC 10 // D16 Data Command control pin
26+
#define TFT_BUSY D3
27+
#define TFT_RST 38 // D11 Reset pin (could connect to RST pin)
28+
#endif
29+
30+
31+
32+
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
33+
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
34+
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
35+
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
36+
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
37+
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
38+
// #define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
39+
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
40+
41+
#define SMOOTH_FONT
42+
43+
#ifdef CONFIG_IDF_TARGET_ESP32S3
44+
#define USE_HSPI_PORT
45+
#endif
46+
47+
#if defined(SEEED_XIAO_M0)
48+
#define SPI_FREQUENCY 10000000
49+
#define SPI_READ_FREQUENCY 4000000
50+
#elif defined(ARDUINO_XIAO_ESP32S3) || defined(ARDUINO_XIAO_ESP32S3_PLUS)
51+
#define SPI_FREQUENCY 10000000
52+
#define SPI_READ_FREQUENCY 4000000
53+
#elif defined(ARDUINO_XIAO_ESP32C3)
54+
#define SPI_FREQUENCY 10000000
55+
#define SPI_READ_FREQUENCY 4000000
56+
#elif defined(ARDUINO_XIAO_ESP32C6)
57+
#define SPI_FREQUENCY 10000000
58+
#define SPI_READ_FREQUENCY 4000000
59+
#elif defined(ARDUINO_SEEED_XIAO_NRF52840) || defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) || defined(ARDUINO_Seeed_XIAO_nRF52840) || defined(ARDUINO_Seeed_XIAO_nRF52840_Sense)
60+
#define SPI_FREQUENCY 10000000
61+
#define SPI_READ_FREQUENCY 4000000
62+
#define ltoa itoa
63+
#elif defined(ARDUINO_SEEED_XIAO_RP2040) || defined(ARDUINO_SEEED_XIAO_RP2350)
64+
#define SPI_FREQUENCY 10000000
65+
#define SPI_READ_FREQUENCY 4000000
66+
#elif defined(ARDUINO_XIAO_RA4M1)
67+
#define SPI_FREQUENCY 10000000
68+
#define SPI_READ_FREQUENCY 4000000
69+
#elif defined (EFR32MG24B220F1536IM48)
70+
#define SPI_FREQUENCY 10000000
71+
#define SPI_READ_FREQUENCY 4000000
72+
#else
73+
#pragma message "Unknown board using default SPI settings (1MHz)"
74+
#define SPI_FREQUENCY 10000000
75+
#define SPI_READ_FREQUENCY 4000000
76+
#endif

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ <h2 data-lang-key="step3_title">Final step: Copy the Generated Code</h2>
525525
options: [
526526
{ value: "502", text: "7.5 inch monochrome ePaper Screen (UC8179)" },
527527
{ value: "509", text: "7.3 inch six-color ePaper Screen(ED2208)" },
528+
{ value: "514", text: "4.0 inch six-color ePaper Screen(ED2208)" },
528529
{ value: "510", text: "13.3 inch six-color ePaper Screen(T133A01)" },
529530
{ value: "511", text: "10.3 inch monochrome ePaper Screen(ED103TC2)" },
530531
{ value: "503", text: "5.83 inch monochrome ePaper Screen (UC8179)" },
@@ -610,7 +611,7 @@ <h2 data-lang-key="step3_title">Final step: Copy the Generated Code</h2>
610611
const ePaperDiv = document.getElementById('ePaperOptions');
611612

612613
// The ePaper driver choice is for all e-papers (502-511)
613-
const isEpaperWithDriverChoice = (selectedValue >= 502 && selectedValue <= 513);
614+
const isEpaperWithDriverChoice = (selectedValue >= 502 && selectedValue <= 514);
614615

615616
if (isEpaperWithDriverChoice) {
616617
ePaperDiv.style.display = 'block';

0 commit comments

Comments
 (0)