Skip to content

Commit

Permalink
Version 1.2.11
Browse files Browse the repository at this point in the history
- added support for Waveshare 5.65" 7-color e-paper display 600x448
- the unknown controller of this display doesn't support partial update, as far as known
- 7-color graphics support is available with class GxEPD2_7C
- 7-color graphics support requires paging even on ESP32
- 7-color graphics support causes heavy paging on Arduino UNO, gets very slow
- refresh is quite fast for a color e-paper display: 12 seconds
  • Loading branch information
ZinggJM committed Aug 5, 2020
1 parent bde0026 commit 9cd2833
Show file tree
Hide file tree
Showing 10 changed files with 2,243 additions and 13 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
- GDEW0371W7 3.7" b/w
- GDEW042T2 4.2" b/w
- GDEW042Z15 4.2" b/w/r
- ACeP565 5.65" Waveshare 5.65" 7-color e-paper display 600x448
- GDEW0583T7 5.83" b/w
- GDEW0583T8 5.83" b/w 648x460
- GDEW075T8 7.5" b/w
Expand All @@ -85,7 +86,14 @@
- promotion panels from suppliers are welcome, to add support to GxEPD2
- donation panels from users are welcome, to add support to GxEPD2

### Version 1.2.10
### Version 1.2.11
- added support for Waveshare 5.65" 7-color e-paper display 600x448
- the unknown controller of this display doesn't support partial update, as far as known
- 7-color graphics support is available with class GxEPD2_7C
- 7-color graphics support requires paging even on ESP32
- 7-color graphics support causes heavy paging on Arduino UNO, gets very slow
- refresh is quite fast for a color e-paper display: 12 seconds
#### Version 1.2.10
- added support for GDEH075Z90 7.5" b/w/r 880x528
- the controller of GDEH075Z90 supports partial update, but refesh is full screen
- the controller of GDEH075Z90 doesn't support differential update (not possible on 3-color anyway)
Expand Down
101 changes: 97 additions & 4 deletions examples/GxEPD2_Example/GxEPD2_Example.ino
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

#include <GxEPD2_BW.h>
#include <GxEPD2_3C.h>
#include <GxEPD2_7C.h>
#include <Fonts/FreeMonoBold9pt7b.h>

#if defined (ESP8266)
Expand Down Expand Up @@ -95,6 +96,9 @@
//GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display(GxEPD2_750c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
//GxEPD2_3C < GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT / 4 > display(GxEPD2_750c_Z08(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW075Z08 800x480
//GxEPD2_3C < GxEPD2_750c_Z90, GxEPD2_750c_Z90::HEIGHT / 4 > display(GxEPD2_750c_Z90(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEH075Z90 880x528
// 7-color e-paper
//GxEPD2_3C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 4 > display(GxEPD2_565c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // Waveshare 5.65" 7-color (3C graphics)
//GxEPD2_7C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 4 > display(GxEPD2_565c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // Waveshare 5.65" 7-color
// grey levels parallel IF e-papers on Waveshare e-Paper IT8951 Driver HAT
// HRDY -> 4, RST -> 2, CS -> SS(15), SCK -> SCK(14), MOSI -> MOSI(D7(13)), MISO -> MISO(D6(12)), GND -> GND, 5V -> 5V
// note: 5V supply needs to be exact and strong; 5V pin of USB powered Wemos D1 mini doesn't work!
Expand Down Expand Up @@ -134,6 +138,8 @@
//GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display(GxEPD2_750c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
//GxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT / 4> display(GxEPD2_750c_Z08(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16)); // GDEW075Z08 800x480
//GxEPD2_3C<GxEPD2_750c_Z90, GxEPD2_750c_Z90::HEIGHT / 4> display(GxEPD2_750c_Z90(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16)); // GDEH075Z90 880x528
// 7-color e-paper
//GxEPD2_7C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 4 > display(GxEPD2_565c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16)); // Waveshare 5.65" 7-color
#endif

#if defined(ESP32)
Expand Down Expand Up @@ -167,6 +173,9 @@
//GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT> display(GxEPD2_750c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
//GxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT> display(GxEPD2_750c_Z08(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075Z08 800x480
//GxEPD2_3C<GxEPD2_750c_Z90, GxEPD2_750c_Z90::HEIGHT / 2> display(GxEPD2_750c_Z90(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH075Z90 880x528
// 7-color e-paper
//GxEPD2_3C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 2 > display(GxEPD2_565c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // Waveshare 5.65" 7-color (3C graphics)
//GxEPD2_7C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 2 > display(GxEPD2_565c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // Waveshare 5.65" 7-color

// grey levels parallel IF e-papers on Waveshare e-Paper IT8951 Driver HAT
// HRDY -> 4, RST -> 16, CS -> SS(5), SCK -> SCK(18), MOSI -> MOSI(23), MISO -> MISO(19), GND -> GND, 5V -> 5V
Expand Down Expand Up @@ -215,6 +224,9 @@
//GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
//GxEPD2_3C<GxEPD2_750c_Z08, MAX_HEIGHT_3C(GxEPD2_750c_Z08)> display(GxEPD2_750c_Z08(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075Z08 800x480
//GxEPD2_3C<GxEPD2_750c_Z90, MAX_HEIGHT_3C(GxEPD2_750c_Z90)> display(GxEPD2_750c_Z90(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH075Z90 880x528
// 7-color e-paper
#define MAX_HEIGHT_7C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) // 2 pixel per byte
//GxEPD2_7C<GxEPD2_565c, MAX_HEIGHT_7C(GxEPD2_565c)> display(GxEPD2_565c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // Waveshare 5.65" 7-color
#endif

#if defined(__AVR)
Expand Down Expand Up @@ -255,6 +267,9 @@
//GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
//GxEPD2_3C<GxEPD2_750c_Z08, MAX_HEIGHT_3C(GxEPD2_750c_Z08)> display(GxEPD2_750c_Z08(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW075Z08 800x480
//GxEPD2_3C<GxEPD2_750c_Z90, MAX_HEIGHT_3C(GxEPD2_750c_Z90)> display(GxEPD2_750c_Z90(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEH075Z90 880x528
// 7-color e-paper
#define MAX_HEIGHT_7C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) // 2 pixel per byte
//GxEPD2_7C<GxEPD2_565c, MAX_HEIGHT_7C(GxEPD2_565c)> display(GxEPD2_565c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // Waveshare 5.65" 7-color

// ***** for mapping of Waveshare Universal e-Paper Raw Panel Driver Shield for Arduino / NUCLEO *****
// the RST line is not connected through level converter, but has a pull up resistor and a pull down diode to the Arduino pin; this is safe for 5V Arduino
Expand Down Expand Up @@ -292,6 +307,8 @@
//GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
//GxEPD2_3C<GxEPD2_750c_Z08, MAX_HEIGHT_3C(GxEPD2_750c_Z08)> display(GxEPD2_750c_Z08(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW075Z08 800x480
//GxEPD2_3C<GxEPD2_750c_Z90, MAX_HEIGHT_3C(GxEPD2_750c_Z90)> display(GxEPD2_750c_Z90(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); //GDEH075Z90 880x528
// 7-color e-paper
//GxEPD2_7C<GxEPD2_565c, MAX_HEIGHT_7C(GxEPD2_565c)> display(GxEPD2_565c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // Waveshare 5.65" 7-color

// Waveshare 12.48 b/w SPI display board and frame or Good Display 12.48 b/w panel GDEW1248T3
// general constructor for use with standard SPI pins, default SCK, MISO and MOSI, for UNO on UNO connectors
Expand Down Expand Up @@ -331,6 +348,7 @@
#include "bitmaps/Bitmaps3c800x480.h" // 7.5" b/w/r
#include "bitmaps/Bitmaps3c880x528.h" // 7.5" b/w/r
#include "bitmaps/WS_Bitmaps800x600.h" // 6.0" grey
#include "bitmaps/WS_Bitmaps7c192x143.h" // 5.65" 7-color
#endif
#if defined(ESP32)
#include "bitmaps/Bitmaps1304x984.h" // 12.48" b/w
Expand Down Expand Up @@ -378,6 +396,15 @@ void setup()
showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
delay(1000);
drawBitmaps();
#if !defined(__AVR) // takes too long!
if (display.epd2.panel == GxEPD2::ACeP565)
{
//draw7colorlines();
//delay(2000);
draw7colors();
delay(4000);
}
#endif
if (display.epd2.hasPartialUpdate)
{
showPartialUpdate();
Expand Down Expand Up @@ -924,6 +951,9 @@ void drawBitmaps()
#endif
#ifdef _GxBitmaps3c880x528_H_
drawBitmaps3c880x528();
#endif
#if defined(_WS_Bitmaps7c192x143_H_)
drawBitmaps7c192x143();
#endif
if ((display.epd2.WIDTH >= 200) && (display.epd2.HEIGHT >= 200))
{
Expand Down Expand Up @@ -1038,8 +1068,8 @@ void drawBitmaps200x200()
display.epd2.writeImageAgain(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
}
delay(2000);
x += 40;
y += 40;
x += display.epd2.WIDTH / 4;
y += display.epd2.HEIGHT / 4;
if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
}
if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
Expand Down Expand Up @@ -1476,8 +1506,8 @@ void drawBitmaps3c200x200()
display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
display.refresh();
delay(1000);
x += 40;
y += 40;
x += display.epd2.WIDTH / 4;
y += display.epd2.HEIGHT / 4;
if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
}
}
Expand Down Expand Up @@ -1685,3 +1715,66 @@ void drawBitmaps3c880x528()
}
}
#endif

#if defined(_WS_Bitmaps7c192x143_H_)
void drawBitmaps7c192x143()
{
if (display.epd2.panel == GxEPD2::ACeP565)
{
display.drawNative(WS_Bitmap7c192x143, 0, (display.epd2.WIDTH - 192) / 2, (display.epd2.HEIGHT - 143) / 2, 192, 143, false, false, true);
delay(5000);
}
}
#endif

void draw7colors()
{
display.setRotation(0);
uint16_t h = display.height() / 7;
display.firstPage();
do
{
display.fillRect(0, 0, display.width(), h, GxEPD_BLACK);
display.fillRect(0, h, display.width(), h, GxEPD_WHITE);
display.fillRect(0, 2 * h, display.width(), h, GxEPD_GREEN);
display.fillRect(0, 3 * h, display.width(), h, GxEPD_BLUE);
display.fillRect(0, 4 * h, display.width(), h, GxEPD_RED);
display.fillRect(0, 5 * h, display.width(), h, GxEPD_YELLOW);
display.fillRect(0, 6 * h, display.width(), h, GxEPD_ORANGE);
}
while (display.nextPage());
}

void draw7colorlines()
{
display.setRotation(0);
uint16_t h = 2;
display.firstPage();
do
{
uint16_t y = 0;
do
{
display.fillRect(0, y, display.width(), h, GxEPD_BLACK); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_GREEN); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_BLUE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_RED); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_YELLOW); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_ORANGE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
}
while ((y + 12 * h) < display.height());
//display.drawPixel(0, y, GxEPD_BLACK); display.drawPixel(10, y, GxEPD_GREEN);
//display.drawPixel(20, y, GxEPD_BLUE); display.drawPixel(30, y, GxEPD_RED);
//display.drawPixel(40, y, GxEPD_YELLOW); display.drawPixel(50, y, GxEPD_ORANGE);
display.fillRect(0, y, 2, 2, GxEPD_BLACK); display.fillRect(10, y, 2, 2, GxEPD_GREEN);
display.fillRect(20, y, 2, 2, GxEPD_BLUE); display.fillRect(30, y, 2, 2, GxEPD_RED);
display.fillRect(40, y, 2, 2, GxEPD_YELLOW); display.fillRect(50, y, 2, 2, GxEPD_ORANGE);
}
while (display.nextPage());
}
10 changes: 10 additions & 0 deletions examples/GxEPD2_Example/GxEPD2_boards_added.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
//GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
//GxEPD2_3C<GxEPD2_750c_Z08, MAX_HEIGHT_3C(GxEPD2_750c_Z08)> display(GxEPD2_750c_Z08(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW075Z08 800x480
//GxEPD2_3C<GxEPD2_750c_Z90, MAX_HEIGHT_3C(GxEPD2_750c_Z90)> display(GxEPD2_750c_Z90(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEH075Z90 880x528
// 7-color e-paper
#define MAX_HEIGHT_7C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) // 2 pixel per byte
//GxEPD2_7C<GxEPD2_565c, MAX_HEIGHT_7C(GxEPD2_565c)> display(GxEPD2_565c(/*CS=77*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // Waveshare 5.65" 7-color
#endif

// Arduino MKR1000 or MKRZERO
Expand Down Expand Up @@ -94,6 +97,9 @@
//GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5));
//GxEPD2_3C<GxEPD2_750c_Z08, MAX_HEIGHT_3C(GxEPD2_750c_Z08)> display(GxEPD2_750c_Z08(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5)); // GDEW075Z08 800x480
//GxEPD2_3C<GxEPD2_750c_Z90, MAX_HEIGHT_3C(GxEPD2_750c_Z90)> display(GxEPD2_750c_Z90(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5)); // GDEH075Z90 880x528
// 7-color e-paper
#define MAX_HEIGHT_7C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) // 2 pixel per byte
GxEPD2_7C<GxEPD2_565c, MAX_HEIGHT_7C(GxEPD2_565c)> display(GxEPD2_565c(/*CS=4*/ 4, /*DC=*/ 7, /*RST=*/ 6, /*BUSY=*/ 5)); // Waveshare 5.65" 7-color
#endif

// mapping suggestion for ESP32, e.g. LOLIN32 D32 PRO
Expand Down Expand Up @@ -131,6 +137,8 @@
//GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT> display(GxEPD2_750c(/*CS=5*/ 5, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15));
//GxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT> display(GxEPD2_750c_Z08(/*CS=5*/ 5, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15)); // GDEW075Z08 800x480
//GxEPD2_3C<GxEPD2_750c_Z90, GxEPD2_750c_Z90::HEIGHT> display(GxEPD2_750c_Z90(/*CS=5*/ 5, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15)); // GDEH075Z90 880x528
// 7-color e-paper
//GxEPD2_7C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 2 > display(GxEPD2_565c(/*CS=5*/ 5, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 15)); // Waveshare 5.65" 7-color
// grey levels parallel IF e-papers on Waveshare e-Paper IT8951 Driver HAT
// HRDY -> 4, RST -> 16, CS -> 5, SCK -> SCK(18), MOSI -> MOSI(23), MISO -> MISO(19), GND -> GND, 5V -> 5V
// note: 5V supply needs to be exact and strong; 5V over diode from USB (e.g. Wemos D1 mini) doesn't work!
Expand Down Expand Up @@ -172,6 +180,8 @@
//GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT> display(GxEPD2_750c(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4));
//GxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT> display(GxEPD2_750c_Z08(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // GDEW075Z08 800x480
//GxEPD2_3C<GxEPD2_750c_Z90, GxEPD2_750c_Z90::HEIGHT> display(GxEPD2_750c_Z90(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // GDEH075Z90 880x528
// 7-color e-paper
//GxEPD2_7C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 2 > display(GxEPD2_565c(/*CS=5*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4)); // Waveshare 5.65" 7-color
// grey levels parallel IF e-papers on Waveshare e-Paper IT8951 Driver HAT
// HRDY -> 4, RST -> 16, CS -> SS(5), SCK -> SCK(18), MOSI -> MOSI(23), MISO -> MISO(19), GND -> GND, 5V -> 5V
// note: 5V supply needs to be exact and strong; 5V over diode from USB (e.g. Wemos D1 mini) doesn't work!
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=GxEPD2
version=1.2.10
version=1.2.11
author=Jean-Marc Zingg
maintainer=Jean-Marc Zingg
sentence=Arduino Display Library for SPI E-Paper displays from Dalian Good Display and Waveshare.
Expand Down
17 changes: 12 additions & 5 deletions src/GxEPD2.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@
#include <Arduino.h>
#include <SPI.h>

// color definitions for GxEPD and GxEPD2, values correspond to RGB565 values for TFTs
#define GxEPD_BLACK 0x0000
#define GxEPD_DARKGREY 0x7BEF /* 128, 128, 128 */
#define GxEPD_LIGHTGREY 0xC618 /* 192, 192, 192 */
#define GxEPD_WHITE 0xFFFF
#define GxEPD_RED 0xF800 /* 255, 0, 0 */

#define GxEPD_YELLOW GxEPD_RED
// some controllers for b/w EPDs support grey levels
#define GxEPD_DARKGREY 0x7BEF // 128, 128, 128
#define GxEPD_LIGHTGREY 0xC618 // 192, 192, 192
// values for 3-color or 7-color EPDs
#define GxEPD_RED 0xF800 // 255, 0, 0
#define GxEPD_YELLOW 0xFFE0 // 255, 255, 0 !!no longer same as GxEPD_RED!!
#define GxEPD_COLORED GxEPD_RED
// values for 7-color EPDs only
#define GxEPD_BLUE 0x001F // 0, 0, 255
#define GxEPD_GREEN 0x07E0 // 0, 255, 0
#define GxEPD_ORANGE 0xFD20 // 255, 165, 0

class GxEPD2
{
Expand Down Expand Up @@ -57,6 +63,7 @@ class GxEPD2
GDEW027C44, Waveshare_2_7_bwr = GDEW027C44,
GDEW042Z15, Waveshare_4_2_bwr = GDEW042Z15,
GDEW0583Z21, Waveshare_5_83_bwr = GDEW0583Z21,
ACeP565, Waveshare_5_65_7c = ACeP565,
GDEW075Z09, Waveshare_7_5_bwr = GDEW075Z09,
GDEW075Z08, Waveshare_7_5_bwr_Z08 = GDEW075Z08,
GDEH075Z90, Waveshare_7_5_bwr_Z90 = GDEH075Z90
Expand Down
5 changes: 3 additions & 2 deletions src/GxEPD2_3C.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "epd3c/GxEPD2_270c.h"
#include "epd3c/GxEPD2_420c.h"
#include "epd3c/GxEPD2_583c.h"
#include "epd3c/GxEPD2_565c.h"
#include "epd3c/GxEPD2_750c.h"
#include "epd3c/GxEPD2_750c_Z08.h"
#include "epd3c/GxEPD2_750c_Z90.h"
Expand Down Expand Up @@ -108,7 +109,7 @@ class GxEPD2_3C : public GxEPD2_GFX_BASE_CLASS
_color_buffer[i] = (_color_buffer[i] | (1 << (7 - x % 8)));
if (color == GxEPD_WHITE) return;
else if (color == GxEPD_BLACK) _black_buffer[i] = (_black_buffer[i] & (0xFF ^ (1 << (7 - x % 8))));
else if (color == GxEPD_RED) _color_buffer[i] = (_color_buffer[i] & (0xFF ^ (1 << (7 - x % 8))));
else if ((color == GxEPD_RED) || (color == GxEPD_YELLOW)) _color_buffer[i] = (_color_buffer[i] & (0xFF ^ (1 << (7 - x % 8))));
}

void init(uint32_t serial_diag_bitrate = 0) // = 0 : disabled
Expand Down Expand Up @@ -138,7 +139,7 @@ class GxEPD2_3C : public GxEPD2_GFX_BASE_CLASS
uint8_t red = 0xFF;
if (color == GxEPD_WHITE);
else if (color == GxEPD_BLACK) black = 0x00;
else if (color == GxEPD_RED) red = 0x00;
else if ((color == GxEPD_RED) || (color == GxEPD_YELLOW)) red = 0x00;
for (uint16_t x = 0; x < sizeof(_black_buffer); x++)
{
_black_buffer[x] = black;
Expand Down
Loading

1 comment on commit 9cd2833

@ilachEU
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, these e-papers can display colors up to 8.
https://youtu.be/YawP9RjPcJA (2:27)

Please sign in to comment.