From baef87908e363a85921ce8f7070ea46b3b5735f2 Mon Sep 17 00:00:00 2001 From: Larry Bank Date: Thu, 14 Aug 2025 23:39:19 +0100 Subject: [PATCH] Added CrowPanel 4-gray version --- src/bb_ep.inl | 71 +++++++++++++++++++++++++++++++++++++++++++---- src/bb_epaper.cpp | 3 +- src/bb_epaper.h | 3 ++ 3 files changed, 71 insertions(+), 6 deletions(-) diff --git a/src/bb_ep.inl b/src/bb_ep.inl index cf9f12b..79c0e5b 100644 --- a/src/bb_ep.inl +++ b/src/bb_ep.inl @@ -1040,6 +1040,37 @@ const uint8_t epd29z_init_full[] PROGMEM = 0, // end }; /* epd29z_init_full */ +const uint8_t epd29z_init_gray[] PROGMEM = +{ + BUSY_WAIT, + 0x04, 0x01,0x27,0x01,0x00, + 0x02, 0x11, 0x03, + 0x03, 0x44, 0x00, 0x0f, + 0x05, 0x45, 0x00, 0x00, 0x27, 0x01, + 0x02, 0x3c, 0x00, + 0x02, 0x18, 0x80, + 0x02, 0x4e, 0x00, + 0x03, 0x4f, 0x00, 0x00, + BUSY_WAIT, + 154, 0x32, // 4-gray LUT + 0x9a, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT 0 + 0x96, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT 2 + 0x99, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT 1 + 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT 3 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT VCOM + 0x0a, 0x0a, 0x00, 0x07, 0x01, 0x00, 0x00, // phases for 0 A,B,C,D + 0x03, 0x01, 0x00, 0x01, 0x03, 0x00, 0x00, // phases for 1 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 2-11 not needed + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0, + + 0, // end +}; /* epd29z_init_gray */ + const uint8_t epd29z_init_fast[] PROGMEM = { BUSY_WAIT, @@ -1278,10 +1309,10 @@ const uint8_t epd295_init_sequence_part[] PROGMEM = 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0A, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -1290,6 +1321,34 @@ const uint8_t epd295_init_sequence_part[] PROGMEM = 0x00 // end of table }; +// 4-gray updates +const uint8_t epd295_init_gray[] PROGMEM = +{ + 0x02, 0x11, 0x03, + 0x02, 0x3c, 0x80, // border waveform + 0x03, 0x44, 0x00, 0x0f, + 0x05, 0x45, 0x00, 0x00, 0x27, 0x01, + 0x02, 0x4e, 0x00, + 0x03, 0x4f, 0x00, 0x00, + + 91, 0x32, // LUT + 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT 0 + 0x96, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT 1 + 0x99, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT 2 + 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT 3 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT VCOM + 0x0a, 0x0a, 0x07, 0x02, 0x00, // phases for 0 A,B,C,D + 0x02, 0x02, 0x00, 0x00, 0x00, // phases for 1 A,B + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, // 2-9 not needed + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, + + 0x00 // end of table +}; + const uint8_t epd266_init_sequence_full[] PROGMEM = { 0x01, SSD1608_SW_RESET, @@ -2126,6 +2185,7 @@ const EPD_PANEL panelDefs[] PROGMEM = { {128, 296, 0, epd293_init_sequence_full, epd293_init_sequence_fast, epd293_init_sequence_part, 0, BBEP_CHIP_SSD16xx, u8Colors_2clr}, // EP293_128x296 {128, 296, 0, epd294_init_sequence_full, NULL, NULL, 0, BBEP_CHIP_SSD16xx, u8Colors_2clr}, // EP294_128x296 {128, 296, 0, epd293_init_sequence_full, epd293_init_sequence_fast, epd295_init_sequence_part, 0, BBEP_CHIP_SSD16xx, u8Colors_2clr}, // EP295_128x296 + {128, 296, 0, epd295_init_gray, NULL, NULL, BBEP_4GRAY, BBEP_CHIP_SSD16xx, u8Colors_4gray}, // EP295_128x296_4GRAY {152, 296, 0, epd266_init_sequence_full, NULL, epd266_init_sequence_part, 0, BBEP_CHIP_SSD16xx, u8Colors_2clr}, // EP266_152x296 {80, 128, 0, epd102_init_sequence_full, NULL, epd102_init_sequence_part, 0, BBEP_CHIP_UC81xx, u8Colors_2clr}, // EP102_80x128 {176, 264, 0, epd27_init_sequence_full, NULL, epd27_init_sequence_part, 0, BBEP_CHIP_SSD16xx, u8Colors_2clr}, // EP27B_176x264 @@ -2164,6 +2224,7 @@ const EPD_PANEL panelDefs[] PROGMEM = { {960, 640, 0, ep7_init, NULL, ep7_init_partial, 0, BBEP_CHIP_SSD16xx, u8Colors_2clr}, // EP7_960x640 (ED070EC1) {122, 250, 0, epd213r2_init_sequence_full, epd213r2_init_sequence_fast, NULL, BBEP_RED_SWAPPED | BBEP_3COLOR, BBEP_CHIP_UC81xx, u8Colors_3clr}, // EP213R2_122x250 3 color {128, 296, 0, epd29z_init_full, epd29z_init_fast, epd29z_init_full, 0, BBEP_CHIP_SSD16xx, u8Colors_2clr}, // CrowPanel 2.9 (EP29Z_128x296) + {128, 296, 0, epd29z_init_gray, epd29z_init_gray, epd29z_init_gray, BBEP_4GRAY, BBEP_CHIP_SSD16xx, u8Colors_4gray}, // CrowPanel 2.9 (EP29Z_128x296_4GRAY) {122, 250, 0, epd213z_init_full, epd213z_init_fast, epd213z_init_full, 0, BBEP_CHIP_SSD16xx, u8Colors_2clr}, // CrowPanel 2.13 (EP213Z_122x250) }; // @@ -2418,7 +2479,7 @@ void bbepSleep(BBEPDISP *pBBEP, int bDeep) } } } else { - bbepCMD2(pBBEP, SSD1608_DEEP_SLEEP, 0x01); // deep sleep mode 1 keeps RAM,only uses about 1uA + bbepCMD2(pBBEP, SSD1608_DEEP_SLEEP, (bDeep) ? 0x02 : 0x01); // deep sleep mode 1 keeps RAM,only uses about 1uA } pBBEP->is_awake = 0; } /* bbepSleep() */ diff --git a/src/bb_epaper.cpp b/src/bb_epaper.cpp index 364bfdc..bc75b5b 100644 --- a/src/bb_epaper.cpp +++ b/src/bb_epaper.cpp @@ -92,9 +92,10 @@ int rc = BBEP_ERROR_BAD_PARAMETER; } break; case EPD_CROWPANEL29: // DC:46 CS:45 RST:47 BUSY:48 MOSI:11 SCK:12 + case EPD_CROWPANEL29_4GRAY: pinMode(7, OUTPUT); digitalWrite(7, HIGH); // screen power on - if (setPanelType(EP29Z_128x296) == BBEP_SUCCESS) { + if (setPanelType((iProduct == EPD_CROWPANEL29) ? EP29Z_128x296 : EP29Z_128x296_4GRAY) == BBEP_SUCCESS) { initIO(46, 47, 48, 45, 11, 12, 12000000); setRotation(270); return BBEP_SUCCESS; diff --git a/src/bb_epaper.h b/src/bb_epaper.h index 6844ca8..e279ec9 100644 --- a/src/bb_epaper.h +++ b/src/bb_epaper.h @@ -121,6 +121,7 @@ enum { EPD_LILYGO_S3_MINI, EPD_TRMNL_OG, EPD_CROWPANEL29, + EPD_CROWPANEL29_4GRAY, EPD_CROWPANEL213, EPD_PRODUCT_COUNT }; @@ -135,6 +136,7 @@ enum { EP293_128x296, EP294_128x296, // Waveshare newer 2.9" 1-bit 128x296 EP295_128x296, // harvested from Solum 2.9" BW ESLs + EP295_128x296_4GRAY, EP266_152x296, // GDEY0266T90 EP102_80x128, // GDEW0102T4 EP27B_176x264, // GDEY027T91 @@ -172,6 +174,7 @@ enum { EP7_960x640, // ED070EC1 EP213R2_122x250, // UC8151 3-color EP29Z_128x296, // SSD1680 (CrowPanel 2.9") + EP29Z_128x296_4GRAY, // SSD1680 (CrowPanel 2.9") EP213Z_122x250, // SSD1680 (CrowPanel 2.13") EP_PANEL_COUNT };