add some new panels

+ new 1.54
+ new 1.54b
+ 4.37b
+ 10.2b
+ ED060KD1
This commit is contained in:
sunwoods
2025-05-04 22:32:37 +08:00
parent b280200154
commit 7091345ffd
12 changed files with 383 additions and 34 deletions
+3 -1
View File
@@ -17,4 +17,6 @@ board_build.arduino.partitions = app3M_fat9M_16MB.csv
board_build.arduino.memory_type = qio_opi
build_flags = -DBOARD_HAS_PSRAM
board_upload.flash_size = 16MB
lib_deps = bblanchon/ArduinoJson@^7.3.1
lib_deps =
bblanchon/ArduinoJson@^7.3.1
bitbank2/FastEPD@^1.2.0
+2 -1
View File
@@ -15,7 +15,8 @@
#include <ArduinoJson.h>
/* Size, current position index and byte array of the buffer -----------------*/
#define Buff__SIZE 800*480 // may need increase
// #define Buff__SIZE 800*480 // may need increase
#define Buff__SIZE 1920*1080 // increase for ES108FC
#define JSON_BUFF_SIZE 256
+42 -3
View File
@@ -24,6 +24,9 @@
#include "epd_panel/epd9in7g.h"
#include "epd_panel/EPD_9in69b.h"
#include "epd_panel/epd7in3e.h"
#include "epd_panel/epd4in37b.h"
#include "epd_panel/epd10in2.h"
#include "epd_panel/ED060KD1.h"
/* Lut mono ------------------------------------------------------------------*/
byte lut_full_mono[] =
@@ -42,6 +45,23 @@ byte lut_partial_mono[] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
byte LUT_DATA[] =
{ //30 bytes
0x66,0x66,0x44,0x66,0xAA,0x11,
0x80,0x08,0x11,0x18,0x81,0x18,
0x11,0x88,0x11,0x88,0x11,0x88,
0x00,0x00,0xFF,0xFF,0xFF,0xFF,
0x5F,0xAF,0xFF,0xFF,0x2F,0x00
};
byte LUT_DATA_part[] =
{ //30 bytes
0x10,0x18,0x18,0x28,0x18,0x18,
0x18,0x18,0x08,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x13,0x11,0x22,0x63,
0x11,0x00,0x00,0x00,0x00,0x00
};
byte lut_vcom0[] = { 15, 0x0E, 0x14, 0x01, 0x0A, 0x06, 0x04, 0x0A, 0x0A, 0x0F, 0x03, 0x03, 0x0C, 0x06, 0x0A, 0x00 };
byte lut_w [] = { 15, 0x0E, 0x14, 0x01, 0x0A, 0x46, 0x04, 0x8A, 0x4A, 0x0F, 0x83, 0x43, 0x0C, 0x86, 0x0A, 0x04 };
byte lut_b [] = { 15, 0x0E, 0x14, 0x01, 0x8A, 0x06, 0x04, 0x8A, 0x4A, 0x0F, 0x83, 0x43, 0x0C, 0x06, 0x4A, 0x04 };
@@ -159,6 +179,19 @@ void EPD_WaitUntilIdle_high()
while(digitalRead(PIN_SPI_BUSY) == 1) delay(100);
}
void EPD_WaitUntilIdle_high(int timeoutInMil)
{
//1: busy, 0: idle
int delay_time = 0;
while(digitalRead(PIN_SPI_BUSY) == 1) {
delay(100);
delay_time += 100;
if (delay_time > timeoutInMil) {
break;
}
}
}
/* Send a one-argument command -----------------------------------------------*/
void EPD_Send_1(byte c, byte v1)
{
@@ -650,8 +683,10 @@ void(*EPD_dispLoad)(); // Pointer on a image data writting function
/* Array of sets describing the usage of e-Papers ----------------------------*/
EPD_dispInfo EPD_dispMass[] =
{
{ EPD_Init_1in54 , EPD_loadA, -1 , 0, EPD_showA, "1.54 inch" },// a 0
{ EPD_Init_1in54b, EPD_loadB, 0x13, EPD_loadA, EPD_showB, "1.54 inch b" },// b 1
// { EPD_Init_1in54 , EPD_loadA, -1 , 0, EPD_showA, "1.54 inch" },// a 0
{ EPD_Init_1in54_V1 , EPD_loadA, -1 , 0, EPD_1IN54_Show_V1, "1.54 inch" },// a 0
// { EPD_Init_1in54b, EPD_loadB, 0x13, EPD_loadA, EPD_showB, "1.54 inch b" },// b 1
{ EPD_Init_1in54b, EPD_loadA, 0x13, EPD_loadA, EPD_showB, "1.54 inch b" },// b 1
{ EPD_Init_1in54c, EPD_loadA, 0x13, EPD_loadA, EPD_showB, "1.54 inch c" },// c 2
{ EPD_Init_2in13 , EPD_loadC, -1 , 0, EPD_showA, "2.13 inch" },// d 3
{ EPD_Init_2in13b, EPD_loadA, 0x13, EPD_loadA, EPD_showB, "2.13 inch b" },// e 4
@@ -694,8 +729,12 @@ EPD_dispInfo EPD_dispMass[] =
{ EPD_3IN52_Init, EPD_loadA, -1, 0, EPD_3IN52_Show, "3.52 inch" },// 41
{ EPD_2IN7_V2_Init, EPD_loadA, -1 , 0, EPD_2IN7_V2_Show, "2.7 inch V2" },// 42
{ EPD_7IN3F_init, EPD_loadG, -1 , 0, EPD_7IN3F_Show, "7.3 inch F" },// 43
{ EPD_12in48B_Init, NULL, 0x13, NULL, EPD_12in48B_Show, "12.48 inch B V1" },// 44
{ EPD_12in48B_Init, NULL, 0x13, NULL, EPD_12in48B_Show, "12.48 inch B" },// 44
{ EPD_9IN7G_init, EPD_loadA, -1 , 0, EPD_9IN7G_Show, "9.7 inch G" },// 45
{ EPD_9IN69B_Init, EPD_loadA, -1 , EPD_loadAFilp, EPD_9IN69B_Show, "9.69 inch B" },// 46
{ EPD_7IN3E_init, EPD_loadG, -1 , 0, EPD_7IN3E_Show, "7.3 inch E" },// 47
{ EPD_Init_4in37b, EPD_loadAFilp, 0x13, EPD_loadAFilp, EPD_4IN37B_Show, "4.37 inch B" },// 48
{ EPD_Init_1in54_V2 , EPD_loadA, -1 , 0, EPD_1IN54_Show_V2, "1.54 inch V2" },// 49
{ EPD_10IN2B_Init , EPD_loadA, 0x26, EPD_loadAFilp, EPD_10IN2B_Show, "10.2 inch B" },// 50
{ EPD_ED060KD1_init, EPD_ED060KD1_Load, -1, 0, EPD_ED060KD1_Show, "6.0 inch Parallel" },// 51
};
+1 -1
View File
@@ -52,7 +52,7 @@ void EPD_WaitUntilIdle();
/* Waiting the e-Paper is ready for further instructions ---------------------*/
void EPD_WaitUntilIdle_high();
void EPD_WaitUntilIdle_high(int timeoutInMil);
/* Send a one-argument command -----------------------------------------------*/
void EPD_Send_1(byte c, byte v1);
+3
View File
@@ -61,6 +61,9 @@ extern int PIN_SPI_DC;
extern byte lut_full_mono[];
extern byte lut_partial_mono[];
extern byte LUT_DATA[];
extern byte LUT_DATA_part[];
extern byte lut_vcom0[];
extern byte lut_w [];
extern byte lut_b [];
+8 -5
View File
@@ -215,16 +215,18 @@ void EPDWifi::Web_EPD_Init(String arg_info) {
deserializeJson(document, arg_info);
EPD_dispIndex = document["epdInd"];
// temporarily compatible with web
if (EPD_dispIndex == 0) {
EPD_dispIndex = 44;
}
// // temporarily compatible with web
// if (EPD_dispIndex == 0) {
// EPD_dispIndex = 44;
// }
// 12.48 use specific pins initialization
if (EPD_dispIndex == 44) {
EPD_12in48b_initSPI();
} else if (EPD_dispIndex == 46) {
EPD_9IN69B_InitSPI();
} else if (EPD_dispIndex == 48) {
EPD_ED060KD1_InitMode(document["mode"]);
} else {
EPD_SPISetCfg(document["din"], document["sck"], document["cs"], document["dc"], document["rst"], document["busy"]);
EPD_initSPI();
@@ -234,6 +236,7 @@ void EPDWifi::Web_EPD_Init(String arg_info) {
// Print log message: initialization of e-Paper (e-Paper's type)
Serial.printf("EPD_dispIndex %d", EPD_dispIndex);
Serial.printf("EPD %s", EPD_dispMass[EPD_dispIndex].title);
Serial.println();
// Initialization
EPD_dispInit();
@@ -341,7 +344,7 @@ void EPDWifi::Web_EPD_LoadA(String arg_info) {
loaded_size += Buff__bufInd;
Serial.printf("Buff__bufInd=%d, loaded_size=%d\n", Buff__bufInd, loaded_size);
Serial.println("LOADA");
// Serial.println("LOADA");
// 12.48 & 9.69 use specific pins initialization
if (EPD_dispIndex == 44) {
+2
View File
@@ -77,4 +77,6 @@ extern void EPD_9IN69B_SendCommandM(UBYTE Reg);
extern void EPD_9IN69B_SendDataM(UBYTE Data);
extern void EPD_9IN69B_SendCommandS(UBYTE Reg);
extern void EPD_9IN69B_SendDataS(UBYTE Data);
extern void EPD_ED060KD1_InitMode(int mode);
#endif
+116
View File
@@ -0,0 +1,116 @@
#include "FastEPD.h"
#define POWER_PIN GPIO_NUM_46
#define ED060KD1_WIDTH 1448
#define ED060KD1_HEIGHT 1072
FASTEPD epaper; // a static instance of the FastEPD class
bool panel_init_done = false;
int pixel_index = 0;
void Power_on() {
digitalWrite(POWER_PIN, HIGH);
}
void Power_off() {
digitalWrite(POWER_PIN, LOW);
}
int EPD_ED060KD1_init() {
Serial.println("EPD_ED060KD1_init");
int rc;
pixel_index = 0;
if (panel_init_done != true) {
rc = epaper.initPanel(BB_PANEL_EPDIY_V7);
if (rc != 0) {
Serial.printf("init failed. rc=%d\n", rc);
return rc;
}
rc = epaper.setPanelSize(ED060KD1_WIDTH, ED060KD1_HEIGHT);
if (rc != 0) {
Serial.printf("set panel size failed. rc=%d\n", rc);
return rc;
}
panel_init_done = true;
}
rc = epaper.setMode(BB_MODE_4BPP);
if (rc != 0) {
Serial.printf("set mode failed. rc=%d\n", rc);
return rc;
}
Serial.println("clear white");
// The default drawing mode is 1-bit per pixel
epaper.clearWhite(true); // fill the current image buffer and eink panel with white
Serial.println("init done.");
return 0;
}
void EPD_ED060KD1_Load() {
Serial.printf("EPD_ED060KD1_Load, %d\n", pixel_index);
int pos = 0;
uint8_t *s, *d, *pBuffer = epaper.currentBuffer();
// Enumerate all of image data bytes
while (pos < Buff__bufInd)
{
// Get current byte
int value = Buff__getByte(pos);
// Invert byte's bits in case of '2.7' e-Paper
if (EPD_invert) value = ~value;
for (int i = 0; i < 8; i++) {
if (i % 2 == 0) {
if (value & (128 >> i)) {
// pBuffer[pixel_index] &= 0x0f;
} else {
pBuffer[pixel_index] &= 0x0f;
}
} else {
if (value & (128 >> i)) {
// pBuffer[pixel_index] &= 0xf0;
} else {
pBuffer[pixel_index] &= 0xf0;
}
pixel_index++;
}
}
// Increment the current byte index on 2 characters
pos += 2;
}
}
static void EPD_ED060KD1_Show() {
Serial.println("EPD_ED060KD1_Show");
Serial.printf("pixel_index=%d\n", pixel_index);
// Serial.println("full update");
epaper.fullUpdate();
}
// // Graphics modes
// enum {
// BB_MODE_NONE = 0,
// BB_MODE_1BPP, // 1 bit per pixel
// BB_MODE_4BPP, // 4 bits per pixel
// };
void EPD_ED060KD1_InitMode(int mode) {
Serial.printf("EPD_ED060KD1_InitMode: mode=%d\n", mode);
// power on
pinMode(POWER_PIN, OUTPUT);
Power_on();
}
+7 -7
View File
@@ -34,13 +34,13 @@
#define _EPD_9IN69B_H_
// use 7 pins, specially defined here
#define EPD_MOSI_PIN 18
#define EPD_SCK_PIN 17
#define EPD_CS_PIN 16
#define EPD_DC_PIN 15
#define EPD_RST_PIN 14
#define EPD_BUSY_PIN 13
#define EPD_CS_S_PIN 12
#define EPD_MOSI_PIN 3
#define EPD_SCK_PIN 46
#define EPD_CS_PIN 9
#define EPD_DC_PIN 10
#define EPD_RST_PIN 11
#define EPD_BUSY_PIN 12
#define EPD_CS_S_PIN 13
// Display resolution
#define EPD_9IN69B_WIDTH 960
+74
View File
@@ -0,0 +1,74 @@
int EPD_10IN2B_Init()
{
EPD_Reset();
// EPD_WaitUntilIdle();
//960x640
EPD_SendCommand(0x12); //SWRESET
EPD_WaitUntilIdle_high(); //waiting for the electronic paper IC to release the idle signal
EPD_SendCommand(0x0C); // Soft start setting
EPD_SendData(0xAE);
EPD_SendData(0xC7);
EPD_SendData(0xC3);
EPD_SendData(0xC0);
EPD_SendData(0x80);
EPD_SendCommand(0x01); // Set MUX as 639
EPD_SendData(0x7F);
EPD_SendData(0x02);
EPD_SendData(0x00);
EPD_SendCommand(0x11); // Data entry mode
// EPD_SendData(0x01); // Y increment, X decrement
EPD_SendData(0x03); // Y increment, X increment
EPD_SendCommand(0x44);
EPD_SendData(0x00); // RAM x address start at 0
EPD_SendData(0x00);
EPD_SendData(0xBF); // RAM x address end at 3BFh -> 959
EPD_SendData(0x03);
EPD_SendCommand(0x45);
// EPD_SendData(0x7F); // RAM y address start at 27Fh;
// EPD_SendData(0x02);
// EPD_SendData(0x00); // RAM y address end at 00h;
// EPD_SendData(0x00);
EPD_SendData(0x00); // 0 ->
EPD_SendData(0x00);
EPD_SendData(0x7F); // Height - 1
EPD_SendData(0x02);
EPD_SendCommand(0x3C); // VBD
EPD_SendData(0x01); // LUT1, for white
EPD_SendCommand(0x18);
EPD_SendData(0X80);
EPD_SendCommand(0x4E);
EPD_SendData(0x00);
EPD_SendData(0x00);
EPD_SendCommand(0x4F);
EPD_SendData(0x7F);
EPD_SendData(0x02);
EPD_SendCommand(0x24); //write RAM for black(0)/white (1)
delay(2);
return 0;
}
static void EPD_10IN2B_Show(void)
{
EPD_SendCommand(0x22); //Display Update Control
EPD_SendData(0xF7);
EPD_SendCommand(0x20); //Activate Display Update Sequence
EPD_WaitUntilIdle_high();
EPD_SendCommand(0x10); //enter deep sleep
EPD_SendData(0x01);
delay(100);
}
+80 -16
View File
@@ -9,10 +9,10 @@
******************************************************************************
*/
int EPD_Init_1in54()
int EPD_Init_1in54(int version)
{
int EPD1in54 = 2;
if(EPD1in54 == 1) {
if(version == 1) {
Serial.print("\r\nEPD1in54 V1");
EPD_Reset();
EPD_Send_3(0x01, 199, 0, 00);//DRIVER_OUTPUT_CONTROL: LO(EPD_HEIGHT-1), HI(EPD_HEIGHT-1). GD = 0; SM = 0; TB = 0;
@@ -80,16 +80,53 @@ int EPD_Init_1in54()
return 0;
}
void EPD_1IN54_Show(void)
int EPD_Init_1in54_V1()
{
int EPD1in54 = 2;
if(EPD1in54 == 1) {
return EPD_Init_1in54(2);
}
int EPD_Init_1in54_V2()
{
// return EPD_Init_1in54(1);
Serial.print("\r\nEPD1in54 V2");
EPD_Reset();
EPD_Send_3(0x01, 199, 0, 00);//DRIVER_OUTPUT_CONTROL: LO(EPD_HEIGHT-1), HI(EPD_HEIGHT-1). GD = 0; SM = 0; TB = 0;
EPD_Send_3(0x0C, 0xD7, 0xD6, 0x9D);//BOOSTER_SOFT_START_CONTROL
EPD_Send_1(0x2C, 0x77);//WRITE_VCOM_REGISTER: VCOM 7C
EPD_Send_1(0x3A, 0x1A);//SET_DUMMY_LINE_PERIOD: 4 dummy lines per gate
EPD_Send_1(0x3B, 0x08);//SET_GATE_TIME: 2us per line
// EPD_Send_1(0x11, 0x01);//DATA_ENTRY_MODE_SETTING: X increment; Y decrement
EPD_Send_1(0x11, 0x03);//DATA_ENTRY_MODE_SETTING: X increment; Y increment
EPD_Send_1(0x3C, 0x33);
// EPD_lut(0x32, 30, &lut_full_mono[0]);
// 这里cmd 0x11控制x和y坐标的增减算法,0x44和0x45控制x和y坐标的起始/结束地址
EPD_Send_2(0x44, 0, 24);//SET_RAM_X_ADDRESS_START_END_POSITION: LO(x >> 3), LO((w-1) >> 3)
// EPD_Send_4(0x45, 199, 0, 0, 0);//SET_RAM_Y_ADDRESS_START_END_POSITION: LO(y), HI(y), LO(h - 1), HI(h - 1)
EPD_Send_4(0x45, 0, 0, 199, 0);//SET_RAM_Y_ADDRESS_START_END_POSITION: LO(y), HI(y), LO(h - 1), HI(h - 1)
EPD_Send_1(0x4E, 0);//LO(x >> 3)
EPD_Send_2(0x4F, 199, 0);//LO(y), HI(y >> 8)
EPD_lut(0x32, 30, LUT_DATA);
EPD_SendCommand(0x24);//WRITE_RAM
delay(2);
return 0;
}
void EPD_1IN54_Show(int version)
{
if(version == 1) {
Serial.print("\r\n EPD_1IN54_Show");
// Refresh
EPD_Send_1(0x22, 0xC4);// DISPLAY_UPDATE_CONTROL_2
EPD_SendCommand( 0x20);// MASTER_ACTIVATION
EPD_WaitUntilIdle_high(2000);
EPD_SendCommand( 0xFF);// TERMINATE_FRAME_READ_WRITE
EPD_WaitUntilIdle();
// Sleep
EPD_SendCommand(0x10);// DEEP_SLEEP_MODE
@@ -105,22 +142,49 @@ void EPD_1IN54_Show(void)
}
}
void EPD_1IN54_Show_V1(void)
{
EPD_1IN54_Show(2);
}
void EPD_1IN54_Show_V2(void)
{
EPD_1IN54_Show(1);
}
// int EPD_Init_1in54b()
// {
// EPD_Reset();
// EPD_Send_4(0x01, 0x07, 0x00, 0x08, 0x00);//POWER_SETTING
// EPD_Send_3(0x06, 0x07, 0x07, 0x07);//BOOSTER_SOFT_START
// EPD_SendCommand(0x04);//POWER_ON
// EPD_WaitUntilIdle();
// EPD_Send_1(0x00, 0xCF);//PANEL_SETTING
// EPD_Send_1(0x50, 0x37);//VCOM_AND_DATA_INTERVAL_SETTING
// EPD_Send_1(0x30, 0x39);//PLL_CONTROL
// EPD_Send_3(0x61, 0xC8, 0x00, 0xC8);//TCON_RESOLUTION
// EPD_Send_1(0x82, 0x0E);//VCM_DC_SETTING_REGISTER
// EPD_SetLutBw (&lut_vcom0[0], &lut_w[0], &lut_b[0], &lut_g1[0], &lut_g2[0]);
// EPD_SetLutRed(&lut_vcom1[0], &lut_red0[0], &lut_red1[0]);
// EPD_SendCommand(0x10);//DATA_START_TRANSMISSION_1
// delay(2);
// return 0;
// }
int EPD_Init_1in54b()
{
EPD_Reset();
EPD_Send_4(0x01, 0x07, 0x00, 0x08, 0x00);//POWER_SETTING
EPD_Send_3(0x06, 0x07, 0x07, 0x07);//BOOSTER_SOFT_START
EPD_SendCommand(0x04);//POWER_ON
EPD_WaitUntilIdle();
EPD_Send_1(0x00, 0xCF);//PANEL_SETTING
EPD_Send_1(0x50, 0x37);//VCOM_AND_DATA_INTERVAL_SETTING
EPD_Send_1(0x30, 0x39);//PLL_CONTROL
EPD_Send_3(0x61, 0xC8, 0x00, 0xC8);//TCON_RESOLUTION
EPD_Send_1(0x82, 0x0E);//VCM_DC_SETTING_REGISTER
EPD_Send_2(0x00, 0x0F, 0x89);//PANEL_SETTING
EPD_SetLutBw (&lut_vcom0[0], &lut_w[0], &lut_b[0], &lut_g1[0], &lut_g2[0]);
EPD_SetLutRed(&lut_vcom1[0], &lut_red0[0], &lut_red1[0]);
EPD_Send_3(0x61, 0xC8, 0x00, 0xC8);//TCON_RESOLUTION
EPD_Send_1(0x50, 0x77);//VCOM_AND_DATA_INTERVAL_SETTING
EPD_SendCommand(0x10);//DATA_START_TRANSMISSION_1
delay(2);
+45
View File
@@ -0,0 +1,45 @@
int EPD_Init_4in37b()
{
EPD_Reset();
//Soft-reset
EPD_Send_1(0x00, 0x0e);
EPD_WaitUntilIdle();
//Input Temperature
EPD_Send_1(0xe5, 0x19);
//Active Temperature
EPD_Send_1(0xe0, 0x02);
//PSR
EPD_Send_2(0x00, 0xcf, 0x8d);
// EPD_SendCommand(0x04);//POWER_ON
// EPD_WaitUntilIdle();
// EPD_Send_2(0x00, 0x0F, 0x89);//PANEL_SETTING
// EPD_Send_3(0x61, 0xB0, 0x01, 0xE0);//TCON_RESOLUTION
// EPD_Send_1(0x50, 0x77);//VCOM_AND_DATA_INTERVAL_SETTING;
EPD_SendCommand(0x10);//DATA_START_TRANSMISSION_1
delay(2);
return 0;
}
void EPD_4IN37B_Show()
{
EPD_SendCommand(0x04);//POWER_ON
// EPD_Send_1(0x04, 0x00);//POWER_ON
EPD_WaitUntilIdle();
// Refresh
EPD_SendCommand(0x12);// DISPLAY_REFRESH
delay(100);
EPD_WaitUntilIdle();
// Sleep
EPD_SendCommand(0x02);// POWER_OFF
EPD_WaitUntilIdle();
// EPD_Send_1(0x07, 0xA5);// DEEP_SLEEP
}