Parcourir la source

version 1.0.4 GxEPD2_GFX base class support

ZinggJM il y a 8 ans
Parent
commit
c4483995e3

+ 6 - 1
README.md

@@ -33,7 +33,12 @@ New Simplified Version of GxEPD for Arduino
 - Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0
 - Good Dispay ePaper for Arduino : https://forum.arduino.cc/index.php?topic=436411.0
 
-### Version 1.0.3
+### Version 1.0.4
+- add GxEPD2_GFX base class support (optional, selectable, uses slightly more code)
+- base class GxEPD2_GFX can be used to pass references or pointers to the display instance as parameter
+- add GxEPD2_GFX_MultiDisplayExample, uses  GxEPD2_GFX reference parameter
+- modify GxEPD2_MultiDisplayExample for ESP8266 (template issue: class expected instead of typename)
+#### Version 1.0.3
 - fix GxEPD2_SD_Example & GxEPD2_SD_AVR_Example
 - add GxEPD2_MultiDisplayExample (preliminary version)
 #### Version 1.0.2

+ 4 - 0
examples/GxEPD2_Example/GxEPD2_Example.ino

@@ -32,6 +32,10 @@
 // mapping suggestion for AVR, UNO, NANO etc.
 // BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11
 
+// base class GxEPD2_GFX can be used to pass references or pointers to the display instance as parameter, uses ~1.2k more code
+// enable or disable GxEPD2_GFX base class
+#define ENABLE_GxEPD2_GFX 0
+
 #include <GxEPD2_BW.h>
 #include <GxEPD2_3C.h>
 #include <Fonts/FreeMonoBold9pt7b.h>

+ 982 - 0
examples/GxEPD2_GFX_MultiDisplayExample/GxEPD2_GFX_MultiDisplayExample.ino

@@ -0,0 +1,982 @@
+// GxEPD2_GFX_MultiDisplayExample : Display Library example for SPI e-paper panels from Dalian Good Display and boards from Waveshare.
+// Requires HW SPI and Adafruit_GFX. Caution: these e-papers require 3.3V supply AND data lines!
+//
+// Display Library based on Demo Example from Good Display: http://www.good-display.com/download_list/downloadcategoryid=34&isMode=false.html
+//
+// Author: Jean-Marc Zingg
+//
+// Version: see library.properties
+//
+// Library: https://github.com/ZinggJM/GxEPD2
+
+// Supporting Arduino Forum Topics:
+// Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0
+// Good Dispay ePaper for Arduino : https://forum.arduino.cc/index.php?topic=436411.0
+
+// mapping suggestion from Waveshare SPI e-Paper to Wemos D1 mini
+// BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V
+
+// mapping suggestion from Waveshare SPI e-Paper to generic ESP8266
+// BUSY -> GPIO4, RST -> GPIO2, DC -> GPIO0, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V
+
+// mapping of Waveshare e-Paper ESP8266 Driver Board
+// BUSY -> GPIO16, RST -> GPIO5, DC -> GPIO4, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V
+
+// mapping suggestion for ESP32, e.g. LOLIN32, see .../variants/.../pins_arduino.h for your board
+// NOTE: there are variants with different pins for SPI ! CHECK SPI PINS OF YOUR BOARD
+// BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V
+
+// new mapping suggestion for STM32F1, e.g. STM32F103C8T6 "BluePill"
+// BUSY -> A1, RST -> A2, DC -> A3, CS-> A4, CLK -> A5, DIN -> A7
+
+// mapping suggestion for AVR, UNO, NANO etc.
+// BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11
+
+// base class GxEPD2_GFX can be used to pass references or pointers to the display instance as parameter
+// enable GxEPD2_GFX base class
+#define ENABLE_GxEPD2_GFX 1 
+
+#include <GxEPD2_BW.h>
+#include <GxEPD2_3C.h>
+#include <Fonts/FreeMonoBold9pt7b.h>
+
+// create display class instances for each display, each instance with different CS line, each instance with RST disabled,
+// (or use separate RST pins for each display),
+// each instance with different BUSY line, or BUSY lines or-ed to one pin
+// disable reset line to disable cross resets by multiple instances
+
+#if defined (ESP8266)
+#define RST_PIN 0 // D3(0)
+#define CS_1 SS // CS = D8(15)
+#define CS_2 16 // CS = D0(16)
+#define CS_3  5 // CS = D1(5)
+// BUSY lines can be or-ed with diodes and pulldown register for displays with BUSY active HIGH
+#define BUSY_H_x 4 // BUSY = D2(4)
+// BUSY lines can be or-ed with diodes and pullup resistor for displays with BUSY active LOW
+//#define BUSY_L_x 4 // BUSY = D2(4)
+// select one and adapt to your mapping, can use full buffer size (full HEIGHT)
+GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display1(GxEPD2_154(/*CS=*/ CS_1, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x));
+GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display2(GxEPD2_213(/*CS=*/ CS_2, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x));
+GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display3(GxEPD2_290(/*CS=*/ CS_3, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x));
+//GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+// can use only half buffer size
+//GxEPD2_BW < GxEPD2_583, GxEPD2_583::HEIGHT / 2 > display(GxEPD2_583(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_BW < GxEPD2_750, GxEPD2_750::HEIGHT / 2 > display(GxEPD2_750(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+// 3-color e-papers
+//GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+// can use only half buffer size
+//GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT / 2> display(GxEPD2_420c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+// can use only quarter buffer size
+//GxEPD2_3C<GxEPD2_583c, GxEPD2_583c::HEIGHT / 4> display(GxEPD2_583c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display3(GxEPD2_750c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+#endif
+
+#if defined(ESP32)
+#define RST_PIN 16
+#define CS_1 SS // CS = 5(SS)
+#define CS_2  0 // CS = 0
+#define CS_3  2 // CS = 2
+#define CS_4 13 // CS = 13
+// BUSY lines can be or-ed with diodes and pulldown register for displays with BUSY active HIGH
+#define BUSY_H_x 4 // BUSY = 4
+// BUSY lines can be or-ed with diodes and pullup resistor for displays with BUSY active LOW
+#define BUSY_L_x 15 // BUSY = 15
+// select one and adapt to your mapping, can use full buffer size (full HEIGHT)
+GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display1(GxEPD2_154(/*CS=*/ CS_1, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x));
+GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display2(GxEPD2_213(/*CS=*/ CS_2, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x));
+GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display3(GxEPD2_290(/*CS=*/ CS_3, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x));
+//GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display4(GxEPD2_420(/*CS=*/ CS_4, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display(GxEPD2_750(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+// 3-color e-papers
+//GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+//GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT> display(GxEPD2_420c(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT> display4(GxEPD2_750c(/*CS=*/ CS_4, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
+#endif
+
+// comment out unused bitmaps to reduce code space used
+#include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
+#include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
+#include "bitmaps/Bitmaps128x296.h" // 2.9"  b/w
+#include "bitmaps/Bitmaps176x264.h" // 2.7"  b/w
+#include "bitmaps/Bitmaps400x300.h" // 4.2"  b/w
+#include "bitmaps/Bitmaps640x384.h" // 7.5"  b/w
+// 3-color
+#include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
+#include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
+#include "bitmaps/Bitmaps3c128x296.h" // 2.9"  b/w/r
+#include "bitmaps/Bitmaps3c176x264.h" // 2.7"  b/w/r
+#include "bitmaps/Bitmaps3c400x300.h" // 4.2"  b/w/r
+
+void setup()
+{
+  Serial.begin(115200);
+  Serial.println();
+  Serial.println("setup");
+
+  // one common reset for all displays
+  digitalWrite(RST_PIN, HIGH);
+  pinMode(RST_PIN, OUTPUT);
+  delay(20);
+  digitalWrite(RST_PIN, LOW);
+  delay(20);
+  digitalWrite(RST_PIN, HIGH);
+  delay(200);
+
+  display1.init(115200); // enable diagnostic output on Serial
+  display2.init(115200); // enable diagnostic output on Serial
+  display3.init(115200); // enable diagnostic output on Serial
+#if defined(ESP32)
+  display4.init(115200); // enable diagnostic output on Serial
+#endif
+  // first update should be full refresh
+  helloWorld(display1);
+  helloWorld(display2);
+  helloWorld(display3);
+#if defined(ESP32)
+  helloWorld(display4);
+#endif
+  delay(1000);
+  // partial refresh mode can be used to full screen,
+  // effective if display panel hasFastPartialUpdate
+  helloFullScreenPartialMode(display1);
+  helloFullScreenPartialMode(display2);
+  helloFullScreenPartialMode(display3);
+#if defined(ESP32)
+  helloFullScreenPartialMode(display4);
+#endif
+  delay(1000);
+  helloArduino(display1);
+  helloArduino(display2);
+  helloArduino(display3);
+#if defined(ESP32)
+  helloArduino(display4);
+#endif
+  delay(1000);
+  helloEpaper(display1);
+  helloEpaper(display2);
+  helloEpaper(display3);
+#if defined(ESP32)
+  helloEpaper(display4);
+#endif
+  delay(1000);
+  showFont(display1, "FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
+  showFont(display2, "FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
+  showFont(display3, "FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
+#if defined(ESP32)
+  showFont(display4, "FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
+#endif
+  delay(1000);
+  drawBitmaps(display1);
+  drawBitmaps(display2);
+  drawBitmaps(display3);
+#if defined(ESP32)
+  drawBitmaps(display4);
+#endif
+//  if (display1.epd2.hasPartialUpdate)
+//  {
+//    showPartialUpdate(display1);
+//    delay(1000);
+//  } // else // on GDEW0154Z04 only full update available, doesn't look nice
+  //drawCornerTest(display1);
+  //showBox(display1, 16, 16, 48, 32, false);
+  //showBox(display1, 16, 56, 48, 32, true);
+  display1.powerOff();
+  display2.powerOff();
+  display3.powerOff();
+  Serial.println("setup done");
+}
+
+void loop()
+{
+}
+
+
+void helloWorld(GxEPD2_GFX& display)
+{
+  //Serial.println("helloWorld");
+  display.setRotation(1);
+  display.setFont(&FreeMonoBold9pt7b);
+  display.setTextColor(GxEPD_BLACK);
+  uint16_t x = (display.width() - 160) / 2;
+  uint16_t y = display.height() / 2;
+  display.setFullWindow();
+  display.firstPage();
+  do
+  {
+    display.fillScreen(GxEPD_WHITE);
+    display.setCursor(x, y);
+    display.println("Hello World!");
+  }
+  while (display.nextPage());
+  //Serial.println("helloWorld done");
+}
+
+
+void helloFullScreenPartialMode(GxEPD2_GFX& display)
+{
+  //Serial.println("helloFullScreenPartialMode");
+  display.setPartialWindow(0, 0, display.width(), display.height());
+  display.setRotation(1);
+  display.setFont(&FreeMonoBold9pt7b);
+  display.setTextColor(GxEPD_BLACK);
+  display.firstPage();
+  do
+  {
+    uint16_t x = (display.width() - 160) / 2;
+    uint16_t y = display.height() / 2;
+    display.fillScreen(GxEPD_WHITE);
+    display.setCursor(x, y);
+    display.println("Hello World!");
+    y = display.height() / 4;
+    display.setCursor(x, y);
+    display.println("full screen");
+    y = display.height() * 3 / 4;
+    if (display.width() <= 200) x = 0;
+    display.setCursor(x, y);
+    if (display.epd2.hasFastPartialUpdate)
+    {
+      display.println("fast partial mode");
+    }
+    else if (display.epd2.hasPartialUpdate)
+    {
+      display.println("slow partial mode");
+    }
+    else
+    {
+      display.println("no partial mode");
+    }
+  }
+  while (display.nextPage());
+  //Serial.println("helloFullScreenPartialMode done");
+}
+
+
+void helloArduino(GxEPD2_GFX& display)
+{
+  //Serial.println("helloArduino");
+  display.setRotation(1);
+  display.setFont(&FreeMonoBold9pt7b);
+  display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
+  uint16_t x = (display.width() - 160) / 2;
+  uint16_t y = display.height() / 4;
+  display.setPartialWindow(0, y - 14, display.width(), 20);
+  display.firstPage();
+  do
+  {
+    display.fillScreen(GxEPD_WHITE);
+    display.setCursor(x, y);
+    display.println("Hello Arduino!");
+  }
+  while (display.nextPage());
+  delay(1000);
+  //Serial.println("helloArduino done");
+}
+
+
+void helloEpaper(GxEPD2_GFX& display)
+{
+  //Serial.println("helloEpaper");
+  display.setRotation(1);
+  display.setFont(&FreeMonoBold9pt7b);
+  display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
+  uint16_t x = (display.width() - 160) / 2;
+  uint16_t y = display.height() * 3 / 4;
+  display.setPartialWindow(0, y - 14, display.width(), 20);
+  display.firstPage();
+  do
+  {
+    display.fillScreen(GxEPD_WHITE);
+    display.setCursor(x, y);
+    display.println("Hello E-Paper!");
+  }
+  while (display.nextPage());
+  //Serial.println("helloEpaper done");
+}
+
+
+void showBox(GxEPD2_GFX& display, uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
+{
+  //Serial.println("showBox");
+  display.setRotation(1);
+  if (partial)
+  {
+    display.setPartialWindow(x, y, w, h);
+  }
+  else
+  {
+    display.setFullWindow();
+  }
+  display.firstPage();
+  do
+  {
+    display.fillScreen(GxEPD_WHITE);
+    display.fillRect(x, y, w, h, GxEPD_BLACK);
+  }
+  while (display.nextPage());
+  //Serial.println("showBox done");
+}
+
+
+void drawCornerTest(GxEPD2_GFX& display)
+{
+  display.setFullWindow();
+  display.setFont(&FreeMonoBold9pt7b);
+  display.setTextColor(GxEPD_BLACK);
+  for (uint16_t r = 0; r <= 4; r++)
+  {
+    display.setRotation(r);
+    display.firstPage();
+    do
+    {
+      display.fillScreen(GxEPD_WHITE);
+      display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
+      display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
+      display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
+      display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
+      display.setCursor(display.width() / 2, display.height() / 2);
+      display.print(display.getRotation());
+    }
+    while (display.nextPage());
+    delay(2000);
+  }
+}
+
+
+void showFont(GxEPD2_GFX& display, const char name[], const GFXfont* f)
+{
+  display.setFullWindow();
+  display.setRotation(0);
+  display.setTextColor(GxEPD_BLACK);
+  display.firstPage();
+  do
+  {
+    drawFont(display, name, f);
+  }
+  while (display.nextPage());
+}
+
+
+//void drawFont(GxEPD2_GFX& display, const char name[], const GFXfont* f);
+
+
+void drawFont(GxEPD2_GFX& display, const char name[], const GFXfont* f)
+{
+  //display.setRotation(0);
+  display.fillScreen(GxEPD_WHITE);
+  display.setTextColor(GxEPD_BLACK);
+  display.setFont(f);
+  display.setCursor(0, 0);
+  display.println();
+  display.println(name);
+  display.println(" !\"#$%&'()*+,-./");
+  display.println("0123456789:;<=>?");
+  display.println("@ABCDEFGHIJKLMNO");
+  display.println("PQRSTUVWXYZ[\\]^_");
+  if (display.epd2.hasColor)
+  {
+    display.setTextColor(GxEPD_RED);
+  }
+  display.println("`abcdefghijklmno");
+  display.println("pqrstuvwxyz{|}~ ");
+}
+
+
+void showPartialUpdate(GxEPD2_GFX& display)
+{
+  // some useful background
+  helloWorld(display);
+  // use asymmetric values for test
+  uint16_t box_x = 10;
+  uint16_t box_y = 15;
+  uint16_t box_w = 70;
+  uint16_t box_h = 20;
+  uint16_t cursor_y = box_y + box_h - 6;
+  float value = 13.95;
+  uint16_t incr = display.epd2.hasFastPartialUpdate ? 1 : 3;
+  display.setFont(&FreeMonoBold9pt7b);
+  display.setTextColor(GxEPD_BLACK);
+  // show where the update box is
+  for (uint16_t r = 0; r < 4; r++)
+  {
+    display.setRotation(r);
+    display.setPartialWindow(box_x, box_y, box_w, box_h);
+    display.firstPage();
+    do
+    {
+      display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
+      //display.fillScreen(GxEPD_BLACK);
+    }
+    while (display.nextPage());
+    delay(2000);
+    display.firstPage();
+    do
+    {
+      display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
+    }
+    while (display.nextPage());
+    delay(1000);
+  }
+  //return;
+  // show updates in the update box
+  for (uint16_t r = 0; r < 4; r++)
+  {
+    display.setRotation(r);
+    display.setPartialWindow(box_x, box_y, box_w, box_h);
+    for (uint16_t i = 1; i <= 10; i += incr)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
+        display.setCursor(box_x, cursor_y);
+        display.print(value * i, 2);
+      }
+      while (display.nextPage());
+      delay(500);
+    }
+    delay(1000);
+    display.firstPage();
+    do
+    {
+      display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
+    }
+    while (display.nextPage());
+    delay(1000);
+  }
+}
+
+
+#ifdef _GxBitmaps200x200_H_
+
+void drawBitmaps200x200(GxEPD2_GFX& display);
+
+void drawBitmaps200x200(GxEPD2_GFX& display)
+{
+#if defined(__AVR)
+  const unsigned char* bitmaps[] =
+  {
+    logo200x200, first200x200 //, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
+  };
+#elif defined(_BOARD_GENERIC_STM32F103C_H_)
+  const unsigned char* bitmaps[] =
+  {
+    logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200 //, sixth200x200, senventh200x200, eighth200x200
+  };
+#else
+  const unsigned char* bitmaps[] =
+  {
+    logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
+  };
+#endif
+  if (display.epd2.panel == GxEPD2::GDEP015OC1)
+  {
+    bool m = display.mirror(true);
+    for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillScreen(GxEPD_WHITE);
+        display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
+      }
+      while (display.nextPage());
+      delay(2000);
+    }
+    display.mirror(m);
+  }
+  //else
+  {
+    bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
+    display.clearScreen(); // use default for white
+    int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
+    int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
+    for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
+    {
+      display.drawImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
+      delay(2000);
+    }
+  }
+  bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
+  for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
+  {
+    int16_t x = -60;
+    int16_t y = -60;
+    for (uint16_t j = 0; j < 10; j++)
+    {
+      display.writeScreenBuffer(); // use default for white
+      display.writeImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
+      display.refresh(true);
+      delay(2000);
+      x += 40;
+      y += 40;
+      if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
+    }
+    if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
+    break; // comment out for full show
+  }
+  display.writeScreenBuffer(); // use default for white
+  display.writeImage(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
+  display.writeImage(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
+  display.refresh(true);
+  delay(2000);
+}
+#endif
+
+#ifdef _GxBitmaps128x250_H_
+
+void drawBitmaps128x250(GxEPD2_GFX& display);
+
+void drawBitmaps128x250(GxEPD2_GFX& display)
+{
+#if !defined(__AVR)
+  const unsigned char* bitmaps[] =
+  {
+    Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
+  };
+#else
+  const unsigned char* bitmaps[] =
+  {
+    Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
+  };
+#endif
+  if (display.epd2.panel == GxEPD2::GDE0213B1)
+  {
+    bool m = display.mirror(true);
+    for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillScreen(GxEPD_WHITE);
+        display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
+      }
+      while (display.nextPage());
+      delay(2000);
+    }
+    display.mirror(m);
+  }
+}
+#endif
+
+#ifdef _GxBitmaps128x296_H_
+
+void drawBitmaps128x296(GxEPD2_GFX& display);
+
+void drawBitmaps128x296(GxEPD2_GFX& display)
+{
+#if !defined(__AVR)
+  const unsigned char* bitmaps[] =
+  {
+    Bitmap128x296_1, logo128x296, first128x296, second128x296, third128x296
+  };
+#else
+  const unsigned char* bitmaps[] =
+  {
+    Bitmap128x296_1, logo128x296 //, first128x296, second128x296, third128x296
+  };
+#endif
+  if (display.epd2.panel == GxEPD2::GDEH029A1)
+  {
+    bool m = display.mirror(true);
+    for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillScreen(GxEPD_WHITE);
+        display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
+      }
+      while (display.nextPage());
+      delay(2000);
+    }
+    display.mirror(m);
+  }
+}
+#endif
+
+#ifdef _GxBitmaps176x264_H_
+
+void drawBitmaps176x264(GxEPD2_GFX& display);
+
+void drawBitmaps176x264(GxEPD2_GFX& display)
+{
+  const unsigned char* bitmaps[] =
+  {
+    Bitmap176x264_1, Bitmap176x264_2
+  };
+  if (display.epd2.panel == GxEPD2::GDEW027W3)
+  {
+    for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillScreen(GxEPD_WHITE);
+        display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
+      }
+      while (display.nextPage());
+      delay(2000);
+    }
+  }
+}
+#endif
+
+#ifdef _GxBitmaps400x300_H_
+
+void drawBitmaps400x300(GxEPD2_GFX& display);
+
+void drawBitmaps400x300(GxEPD2_GFX& display)
+{
+#if !defined(__AVR)
+  const unsigned char* bitmaps[] =
+  {
+    Bitmap400x300_1, Bitmap400x300_2
+  };
+#else
+  const unsigned char* bitmaps[] = {}; // not enough code space
+#endif
+  if (display.epd2.panel == GxEPD2::GDEW042T2)
+  {
+    for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillScreen(GxEPD_WHITE);
+        display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
+      }
+      while (display.nextPage());
+      delay(2000);
+    }
+  }
+}
+#endif
+
+#ifdef _GxBitmaps640x384_H_
+
+void drawBitmaps640x384(GxEPD2_GFX& display);
+
+void drawBitmaps640x384(GxEPD2_GFX& display)
+{
+#if !defined(__AVR)
+  const unsigned char* bitmaps[] =
+  {
+    Bitmap640x384_1, Bitmap640x384_2
+  };
+#else
+  const unsigned char* bitmaps[] = {}; // not enough code space
+#endif
+  if (display.epd2.panel == GxEPD2::GDEW075T8)
+  {
+    for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillScreen(GxEPD_WHITE);
+        display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
+      }
+      while (display.nextPage());
+      delay(2000);
+    }
+  }
+}
+#endif
+
+struct bitmap_pair
+{
+  const unsigned char* black;
+  const unsigned char* red;
+};
+
+#ifdef _GxBitmaps3c200x200_H_
+
+void drawBitmaps3c200x200(GxEPD2_GFX& display);
+
+void drawBitmaps3c200x200(GxEPD2_GFX& display)
+{
+  bitmap_pair bitmap_pairs[] =
+  {
+    //{Bitmap3c200x200_black, Bitmap3c200x200_red},
+    {WS_Bitmap3c200x200_black, WS_Bitmap3c200x200_red}
+  };
+  if (display.epd2.panel == GxEPD2::GDEW0154Z04)
+  {
+    display.firstPage();
+    do
+    {
+      display.fillScreen(GxEPD_WHITE);
+      // Bitmap3c200x200_black has 2 bits per pixel
+      // taken from Adafruit_GFX.cpp, modified
+      int16_t byteWidth = (display.epd2.WIDTH + 7) / 8; // Bitmap scanline pad = whole byte
+      uint8_t byte = 0;
+      for (int16_t j = 0; j < display.epd2.HEIGHT; j++)
+      {
+        for (int16_t i = 0; i < display.epd2.WIDTH; i++)
+        {
+          if (i & 3) byte <<= 2;
+          else
+          {
+#if defined(__AVR) || defined(ESP8266) || defined(ESP32)
+            byte = pgm_read_byte(&Bitmap3c200x200_black[j * byteWidth * 2 + i / 4]);
+#else
+            byte = Bitmap3c200x200_black[j * byteWidth * 2 + i / 4];
+#endif
+          }
+          if (!(byte & 0x80))
+          {
+            display.drawPixel(i, j, GxEPD_BLACK);
+          }
+        }
+      }
+      display.drawInvertedBitmap(0, 0, Bitmap3c200x200_red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
+    }
+    while (display.nextPage());
+    delay(2000);
+    for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillScreen(GxEPD_WHITE);
+        display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
+        display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
+      }
+      while (display.nextPage());
+      delay(2000);
+    }
+  }
+  if (display.epd2.hasColor)
+  {
+    display.clearScreen(); // use default for white
+    int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
+    int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
+    for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
+    {
+      display.drawImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
+      delay(2000);
+    }
+    for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
+    {
+      int16_t x = -60;
+      int16_t y = -60;
+      for (uint16_t j = 0; j < 10; j++)
+      {
+        display.writeScreenBuffer(); // use default for white
+        display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
+        display.refresh();
+        delay(2000);
+        x += 40;
+        y += 40;
+        if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
+      }
+    }
+    display.writeScreenBuffer(); // use default for white
+    display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, 0, 0, 200, 200, false, false, true);
+    display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, int16_t(display.epd2.WIDTH) - 200, int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, false, true);
+    display.refresh();
+    delay(2000);
+  }
+}
+#endif
+
+#ifdef _GxBitmaps3c104x212_H_
+
+void drawBitmaps3c104x212(GxEPD2_GFX& display);
+
+void drawBitmaps3c104x212(GxEPD2_GFX& display)
+{
+#if !defined(__AVR)
+  bitmap_pair bitmap_pairs[] =
+  {
+    {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
+    {Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
+    {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
+  };
+#else
+  bitmap_pair bitmap_pairs[] =
+  {
+    {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
+    //{Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
+    {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
+  };
+#endif
+  if (display.epd2.panel == GxEPD2::GDEW0213Z16)
+  {
+    for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillScreen(GxEPD_WHITE);
+        display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
+        if (bitmap_pairs[i].red == WS_Bitmap3c104x212_red)
+        {
+          display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
+        }
+        else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
+      }
+      while (display.nextPage());
+      delay(2000);
+    }
+  }
+}
+#endif
+
+#ifdef _GxBitmaps3c128x296_H_
+
+void drawBitmaps3c128x296(GxEPD2_GFX& display);
+
+void drawBitmaps3c128x296(GxEPD2_GFX& display)
+{
+#if !defined(__AVR)
+  bitmap_pair bitmap_pairs[] =
+  {
+    {Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
+    {Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
+    {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
+  };
+#else
+  bitmap_pair bitmap_pairs[] =
+  {
+    //{Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
+    //{Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
+    {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
+  };
+#endif
+  if (display.epd2.panel == GxEPD2::GDEW029Z10)
+  {
+    for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillScreen(GxEPD_WHITE);
+        display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
+        if (bitmap_pairs[i].red == WS_Bitmap3c128x296_red)
+        {
+          display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
+        }
+        else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
+      }
+      while (display.nextPage());
+      delay(2000);
+    }
+  }
+}
+#endif
+
+#ifdef _GxBitmaps3c176x264_H_
+
+void drawBitmaps3c176x264(GxEPD2_GFX& display);
+
+void drawBitmaps3c176x264(GxEPD2_GFX& display)
+{
+  bitmap_pair bitmap_pairs[] =
+  {
+    {Bitmap3c176x264_black, Bitmap3c176x264_red}
+  };
+  if (display.epd2.panel == GxEPD2::GDEW027C44)
+  {
+    for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillScreen(GxEPD_WHITE);
+        display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
+        display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
+      }
+      while (display.nextPage());
+      delay(2000);
+    }
+  }
+}
+#endif
+
+#ifdef _GxBitmaps3c400x300_H_
+
+void drawBitmaps3c400x300(GxEPD2_GFX& display);
+
+void drawBitmaps3c400x300(GxEPD2_GFX& display)
+{
+#if !defined(__AVR)
+  bitmap_pair bitmap_pairs[] =
+  {
+    {Bitmap3c400x300_1_black, Bitmap3c400x300_1_red},
+    {Bitmap3c400x300_2_black, Bitmap3c400x300_2_red},
+    {WS_Bitmap3c400x300_black, WS_Bitmap3c400x300_red}
+  };
+#else
+  bitmap_pair bitmap_pairs[] = {}; // not enough code space
+#endif
+  if (display.epd2.panel == GxEPD2::GDEW042Z15)
+  {
+    for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
+    {
+      display.firstPage();
+      do
+      {
+        display.fillScreen(GxEPD_WHITE);
+        display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
+        display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
+      }
+      while (display.nextPage());
+      delay(2000);
+    }
+  }
+}
+#endif
+
+
+void drawBitmaps(GxEPD2_GFX& display)
+{
+  display.setFullWindow();
+  display.setRotation(0);
+#ifdef _GxBitmaps128x250_H_
+  drawBitmaps128x250(display);
+#endif
+#ifdef _GxBitmaps128x296_H_
+  drawBitmaps128x296(display);
+#endif
+#ifdef _GxBitmaps176x264_H_
+  drawBitmaps176x264(display);
+#endif
+#ifdef _GxBitmaps400x300_H_
+  drawBitmaps400x300(display);
+#endif
+#ifdef _GxBitmaps640x384_H_
+  drawBitmaps640x384(display);
+#endif
+  // 3-color
+#ifdef _GxBitmaps3c104x212_H_
+  drawBitmaps3c104x212(display);
+#endif
+#ifdef _GxBitmaps3c128x296_H_
+  drawBitmaps3c128x296(display);
+#endif
+#ifdef _GxBitmaps3c176x264_H_
+  drawBitmaps3c176x264(display);
+#endif
+#ifdef _GxBitmaps3c400x300_H_
+  drawBitmaps3c400x300(display);
+#endif
+  // show these after the specific bitmaps
+#ifdef _GxBitmaps200x200_H_
+  drawBitmaps200x200(display);
+#endif
+  // 3-color
+#ifdef _GxBitmaps3c200x200_H_
+  drawBitmaps3c200x200(display);
+#endif
+}
+
+

+ 42 - 42
examples/GxEPD2_MultiDisplayExample/GxEPD2_MultiDisplayExample.ino

@@ -116,23 +116,23 @@ GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT> display4(GxEPD2_750c(/*CS=*/ CS_4, /
 
 // the compiler needs separate declarations for template functions 
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void helloWorld(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void helloFullScreenPartialMode(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void helloArduino(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void helloEpaper(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void showBox(T<GxEPD2_Type, page_height>& display, uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawCornerTest(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void showFont(T<GxEPD2_Type, page_height>& display, const char name[], const GFXfont* f);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void showPartialUpdate(T<GxEPD2_Type, page_height>& display);
 
 void setup()
@@ -218,7 +218,7 @@ void loop()
 {
 }
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void helloWorld(T<GxEPD2_Type, page_height>& display)
 {
   //Serial.println("helloWorld");
@@ -239,7 +239,7 @@ void helloWorld(T<GxEPD2_Type, page_height>& display)
   //Serial.println("helloWorld done");
 }
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void helloFullScreenPartialMode(T<GxEPD2_Type, page_height>& display)
 {
   //Serial.println("helloFullScreenPartialMode");
@@ -278,7 +278,7 @@ void helloFullScreenPartialMode(T<GxEPD2_Type, page_height>& display)
   //Serial.println("helloFullScreenPartialMode done");
 }
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void helloArduino(T<GxEPD2_Type, page_height>& display)
 {
   //Serial.println("helloArduino");
@@ -300,7 +300,7 @@ void helloArduino(T<GxEPD2_Type, page_height>& display)
   //Serial.println("helloArduino done");
 }
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void helloEpaper(T<GxEPD2_Type, page_height>& display)
 {
   //Serial.println("helloEpaper");
@@ -321,7 +321,7 @@ void helloEpaper(T<GxEPD2_Type, page_height>& display)
   //Serial.println("helloEpaper done");
 }
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void showBox(T<GxEPD2_Type, page_height>& display, uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
 {
   //Serial.println("showBox");
@@ -344,7 +344,7 @@ void showBox(T<GxEPD2_Type, page_height>& display, uint16_t x, uint16_t y, uint1
   //Serial.println("showBox done");
 }
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawCornerTest(T<GxEPD2_Type, page_height>& display)
 {
   display.setFullWindow();
@@ -369,7 +369,7 @@ void drawCornerTest(T<GxEPD2_Type, page_height>& display)
   }
 }
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void showFont(T<GxEPD2_Type, page_height>& display, const char name[], const GFXfont* f)
 {
   display.setFullWindow();
@@ -383,10 +383,10 @@ void showFont(T<GxEPD2_Type, page_height>& display, const char name[], const GFX
   while (display.nextPage());
 }
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawFont(T<GxEPD2_Type, page_height>& display, const char name[], const GFXfont* f);
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawFont(T<GxEPD2_Type, page_height>& display, const char name[], const GFXfont* f)
 {
   //display.setRotation(0);
@@ -408,7 +408,7 @@ void drawFont(T<GxEPD2_Type, page_height>& display, const char name[], const GFX
   display.println("pqrstuvwxyz{|}~ ");
 }
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void showPartialUpdate(T<GxEPD2_Type, page_height>& display)
 {
   // some useful background
@@ -475,9 +475,9 @@ void showPartialUpdate(T<GxEPD2_Type, page_height>& display)
 
 
 #ifdef _GxBitmaps200x200_H_
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps200x200(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps200x200(T<GxEPD2_Type, page_height>& display)
 {
 #if defined(__AVR)
@@ -551,9 +551,9 @@ void drawBitmaps200x200(T<GxEPD2_Type, page_height>& display)
 #endif
 
 #ifdef _GxBitmaps128x250_H_
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps128x250(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps128x250(T<GxEPD2_Type, page_height>& display)
 {
 #if !defined(__AVR)
@@ -587,9 +587,9 @@ void drawBitmaps128x250(T<GxEPD2_Type, page_height>& display)
 #endif
 
 #ifdef _GxBitmaps128x296_H_
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps128x296(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps128x296(T<GxEPD2_Type, page_height>& display)
 {
 #if !defined(__AVR)
@@ -623,9 +623,9 @@ void drawBitmaps128x296(T<GxEPD2_Type, page_height>& display)
 #endif
 
 #ifdef _GxBitmaps176x264_H_
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps176x264(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps176x264(T<GxEPD2_Type, page_height>& display)
 {
   const unsigned char* bitmaps[] =
@@ -650,9 +650,9 @@ void drawBitmaps176x264(T<GxEPD2_Type, page_height>& display)
 #endif
 
 #ifdef _GxBitmaps400x300_H_
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps400x300(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps400x300(T<GxEPD2_Type, page_height>& display)
 {
 #if !defined(__AVR)
@@ -681,9 +681,9 @@ void drawBitmaps400x300(T<GxEPD2_Type, page_height>& display)
 #endif
 
 #ifdef _GxBitmaps640x384_H_
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps640x384(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps640x384(T<GxEPD2_Type, page_height>& display)
 {
 #if !defined(__AVR)
@@ -718,9 +718,9 @@ struct bitmap_pair
 };
 
 #ifdef _GxBitmaps3c200x200_H_
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps3c200x200(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps3c200x200(T<GxEPD2_Type, page_height>& display)
 {
   bitmap_pair bitmap_pairs[] =
@@ -809,9 +809,9 @@ void drawBitmaps3c200x200(T<GxEPD2_Type, page_height>& display)
 #endif
 
 #ifdef _GxBitmaps3c104x212_H_
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps3c104x212(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps3c104x212(T<GxEPD2_Type, page_height>& display)
 {
 #if !defined(__AVR)
@@ -852,9 +852,9 @@ void drawBitmaps3c104x212(T<GxEPD2_Type, page_height>& display)
 #endif
 
 #ifdef _GxBitmaps3c128x296_H_
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps3c128x296(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps3c128x296(T<GxEPD2_Type, page_height>& display)
 {
 #if !defined(__AVR)
@@ -895,9 +895,9 @@ void drawBitmaps3c128x296(T<GxEPD2_Type, page_height>& display)
 #endif
 
 #ifdef _GxBitmaps3c176x264_H_
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps3c176x264(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps3c176x264(T<GxEPD2_Type, page_height>& display)
 {
   bitmap_pair bitmap_pairs[] =
@@ -923,9 +923,9 @@ void drawBitmaps3c176x264(T<GxEPD2_Type, page_height>& display)
 #endif
 
 #ifdef _GxBitmaps3c400x300_H_
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps3c400x300(T<GxEPD2_Type, page_height>& display);
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps3c400x300(T<GxEPD2_Type, page_height>& display)
 {
 #if !defined(__AVR)
@@ -956,7 +956,7 @@ void drawBitmaps3c400x300(T<GxEPD2_Type, page_height>& display)
 }
 #endif
 
-template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> typename T>
+template<typename GxEPD2_Type, const uint16_t page_height, template<typename, const uint16_t> class T>
 void drawBitmaps(T<GxEPD2_Type, page_height>& display)
 {
   display.setFullWindow();

+ 1 - 1
library.properties

@@ -1,5 +1,5 @@
 name=GxEPD2
-version=1.0.3
+version=1.0.4
 author=Jean-Marc Zingg
 maintainer=Jean-Marc Zingg
 sentence=Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare.

+ 17 - 0
src/GxEPD2_3C.h

@@ -22,12 +22,29 @@
 #include "epd3c/GxEPD2_583c.h"
 #include "epd3c/GxEPD2_750c.h"
 
+#ifndef ENABLE_GxEPD2_GFX
+// default is off
+#define ENABLE_GxEPD2_GFX 0 
+#endif
+
+#if ENABLE_GxEPD2_GFX
+#include "GxEPD2_GFX.h"
+#endif
+
 template<typename GxEPD2_Type, const uint16_t page_height>
+#if ENABLE_GxEPD2_GFX
+class GxEPD2_3C : public GxEPD2_GFX
+#else
 class GxEPD2_3C : public Adafruit_GFX
+#endif
 {
   public:
     GxEPD2_Type epd2;
+#if ENABLE_GxEPD2_GFX
+    GxEPD2_3C(GxEPD2_Type epd2_instance) : epd2(epd2_instance), GxEPD2_GFX(epd2, GxEPD2_Type::WIDTH, GxEPD2_Type::HEIGHT)
+#else
     GxEPD2_3C(GxEPD2_Type epd2_instance) : Adafruit_GFX(GxEPD2_Type::WIDTH, GxEPD2_Type::HEIGHT), epd2(epd2_instance)
+#endif
     {
       _page_height = page_height;
       _pages = (HEIGHT / _page_height) + ((HEIGHT % _page_height) > 0);

+ 17 - 0
src/GxEPD2_BW.h

@@ -22,12 +22,29 @@
 #include "epd/GxEPD2_583.h"
 #include "epd/GxEPD2_750.h"
 
+#ifndef ENABLE_GxEPD2_GFX
+// default is off
+#define ENABLE_GxEPD2_GFX 0 
+#endif
+
+#if ENABLE_GxEPD2_GFX
+#include "GxEPD2_GFX.h"
+#endif
+
 template<typename GxEPD2_Type, const uint16_t page_height>
+#if ENABLE_GxEPD2_GFX
+class GxEPD2_BW : public GxEPD2_GFX
+#else
 class GxEPD2_BW : public Adafruit_GFX
+#endif
 {
   public:
     GxEPD2_Type epd2;
+#if ENABLE_GxEPD2_GFX
+    GxEPD2_BW(GxEPD2_Type epd2_instance) : epd2(epd2_instance), GxEPD2_GFX(epd2, GxEPD2_Type::WIDTH, GxEPD2_Type::HEIGHT) 
+#else
     GxEPD2_BW(GxEPD2_Type epd2_instance) : Adafruit_GFX(GxEPD2_Type::WIDTH, GxEPD2_Type::HEIGHT), epd2(epd2_instance)
+#endif
     {
       _page_height = page_height;
       _pages = (HEIGHT / _page_height) + ((HEIGHT % _page_height) > 0);

+ 14 - 12
src/GxEPD2_EPD.cpp

@@ -17,7 +17,9 @@
 #include <avr/pgmspace.h>
 #endif
 
-GxEPD2_EPD::GxEPD2_EPD(int8_t cs, int8_t dc, int8_t rst, int8_t busy, int8_t busy_level, uint32_t busy_timeout) :
+GxEPD2_EPD::GxEPD2_EPD(int8_t cs, int8_t dc, int8_t rst, int8_t busy, int8_t busy_level, uint32_t busy_timeout,
+                       uint16_t w, uint16_t h, GxEPD2::Panel p, bool c, bool pu, bool fpu) :
+  WIDTH(w), HEIGHT(h), panel(p), hasColor(c), hasPartialUpdate(pu), hasFastPartialUpdate(fpu),
   _cs(cs), _dc(dc), _rst(rst), _busy(busy), _busy_level(busy_level), _busy_timeout(busy_timeout), _diag_enabled(false),
   _spi_settings(4000000, MSBFIRST, SPI_MODE0)
 {
@@ -55,17 +57,17 @@ void GxEPD2_EPD::init(uint32_t serial_diag_bitrate)
     pinMode(_busy, INPUT);
   }
   SPI.begin();
-//  SPI.setDataMode(SPI_MODE0);
-//  SPI.setBitOrder(MSBFIRST);
-//#if defined(SPI_HAS_TRANSACTION)
-//  // true also for STM32F1xx Boards
-//  SPISettings settings(4000000, MSBFIRST, SPI_MODE0);
-//  SPI.beginTransaction(settings);
-//  SPI.endTransaction();
-//  //Serial.println("SPI has Transaction");
-//#elif defined(ESP8266) || defined(ESP32)
-//  SPI.setFrequency(4000000);
-//#endif
+  //  SPI.setDataMode(SPI_MODE0);
+  //  SPI.setBitOrder(MSBFIRST);
+  //#if defined(SPI_HAS_TRANSACTION)
+  //  // true also for STM32F1xx Boards
+  //  SPISettings settings(4000000, MSBFIRST, SPI_MODE0);
+  //  SPI.beginTransaction(settings);
+  //  SPI.endTransaction();
+  //  //Serial.println("SPI has Transaction");
+  //#elif defined(ESP8266) || defined(ESP32)
+  //  SPI.setFrequency(4000000);
+  //#endif
 }
 
 void GxEPD2_EPD::_waitWhileBusy(const char* comment, uint16_t busy_time)

+ 10 - 1
src/GxEPD2_EPD.h

@@ -50,7 +50,16 @@ class GxEPD2
 class GxEPD2_EPD
 {
   public:
-    GxEPD2_EPD(int8_t cs, int8_t dc, int8_t rst, int8_t busy, int8_t busy_level, uint32_t busy_timeout);
+    // attributes
+    const uint16_t WIDTH;
+    const uint16_t HEIGHT;
+    const GxEPD2::Panel panel;
+    const bool hasColor;
+    const bool hasPartialUpdate;
+    const bool hasFastPartialUpdate;
+    // constructor
+    GxEPD2_EPD(int8_t cs, int8_t dc, int8_t rst, int8_t busy, int8_t busy_level, uint32_t busy_timeout,
+               uint16_t w, uint16_t h, GxEPD2::Panel p, bool c, bool pu, bool fpu);
     virtual void init(uint32_t serial_diag_bitrate = 0) = 0; // serial_diag_bitrate = 0 : disabled
     //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
     virtual void clearScreen(uint8_t value) = 0; // init controller memory and screen (default white)

+ 47 - 0
src/GxEPD2_GFX.h

@@ -0,0 +1,47 @@
+// Display Library for SPI e-paper panels from Dalian Good Display and boards from Waveshare.
+// Requires HW SPI and Adafruit_GFX. Caution: these e-papers require 3.3V supply AND data lines!
+//
+// based on Demo Example from Good Display: http://www.good-display.com/download_list/downloadcategoryid=34&isMode=false.html
+//
+// Author: Jean-Marc Zingg
+//
+// Version: see library.properties
+//
+// Library: https://github.com/ZinggJM/GxEPD2
+
+#ifndef _GxEPD2_GFX_H_
+#define _GxEPD2_GFX_H_
+
+#include <Adafruit_GFX.h>
+
+class GxEPD2_GFX : public Adafruit_GFX
+{
+  public:
+    GxEPD2_GFX(GxEPD2_EPD& _epd2, int16_t w, int16_t h) : Adafruit_GFX(w, h), epd2(_epd2) {};
+    virtual bool mirror(bool m) = 0;
+    virtual void init(uint32_t serial_diag_bitrate = 0) = 0; // serial_diag_bitrate = 0 : disabled
+    virtual void fillScreen(uint16_t color) = 0; // 0x0 black, >0x0 white, to buffer
+    virtual void display(bool partial_update_mode = false) = 0;
+    virtual void setFullWindow() = 0;
+    virtual void setPartialWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) = 0;
+    virtual void firstPage() = 0;
+    virtual bool nextPage() = 0;
+    virtual void drawPaged(void (*drawCallback)(const void*), const void* pv) = 0;
+    virtual void drawInvertedBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color) = 0;
+    //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
+    virtual void clearScreen(uint8_t value = 0xFF) = 0; // init controller memory and screen (default white)
+    virtual void writeScreenBuffer(uint8_t value = 0xFF) = 0; // init controller memory (default white)
+    // write to controller memory, without screen refresh; x and w should be multiple of 8
+    virtual void writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0;
+    virtual void writeImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0;
+    // write to controller memory, with screen refresh; x and w should be multiple of 8
+    virtual void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0;
+    virtual void drawImage(const uint8_t* black, const uint8_t* color, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) = 0;
+    virtual void refresh(bool partial_update_mode = false) = 0; // screen refresh from controller memory to full screen
+    virtual void refresh(int16_t x, int16_t y, int16_t w, int16_t h) = 0; // screen refresh from controller memory, partial screen
+  public:
+    GxEPD2_EPD& epd2;
+};
+
+#endif
+

+ 2 - 1
src/epd/GxEPD2_154.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_154.h"
 #include "WaveTables.h"
 
-GxEPD2_154::GxEPD2_154(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000)
+GxEPD2_154::GxEPD2_154(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 2 - 1
src/epd/GxEPD2_213.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_213.h"
 #include "WaveTables.h"
 
-GxEPD2_213::GxEPD2_213(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000)
+GxEPD2_213::GxEPD2_213(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 4 - 3
src/epd/GxEPD2_270.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_270.h"
 #include "WaveTables.h"
 
-GxEPD2_270::GxEPD2_270(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000)
+GxEPD2_270::GxEPD2_270(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;
@@ -74,7 +75,7 @@ void GxEPD2_270::writeImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_
   w1 -= dx;
   h1 -= dy;
   if ((w1 <= 0) || (h1 <= 0)) return;
-    if (!_using_partial_mode) _Init_Part();
+  if (!_using_partial_mode) _Init_Part();
   _setPartialRamArea(x1, y1, w1, h1);
   for (int16_t i = 0; i < h1; i++)
   {
@@ -139,7 +140,7 @@ void GxEPD2_270::drawNative(const uint8_t* data1, const uint8_t* data2, int16_t
 void GxEPD2_270::refresh(bool partial_update_mode)
 {
   if (partial_update_mode) refresh(0, 0, WIDTH, HEIGHT);
-  else 
+  else
   {
     if (_using_partial_mode) _Init_Full();
     _Update_Full();

+ 2 - 1
src/epd/GxEPD2_290.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_290.h"
 #include "WaveTables.h"
 
-GxEPD2_290::GxEPD2_290(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000)
+GxEPD2_290::GxEPD2_290(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 2 - 1
src/epd/GxEPD2_420.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_420.h"
 #include "WaveTables.h"
 
-GxEPD2_420::GxEPD2_420(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000)
+GxEPD2_420::GxEPD2_420(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 2 - 1
src/epd/GxEPD2_583.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_583.h"
 #include "WaveTables.h"
 
-GxEPD2_583::GxEPD2_583(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000)
+GxEPD2_583::GxEPD2_583(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 2 - 1
src/epd/GxEPD2_750.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_750.h"
 #include "WaveTables.h"
 
-GxEPD2_750::GxEPD2_750(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000)
+GxEPD2_750::GxEPD2_750(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, LOW, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 2 - 1
src/epd3c/GxEPD2_154c.cpp

@@ -20,7 +20,8 @@ const uint8_t GxEPD2_154c::bw2grey[] =
   0b11110000, 0b11110011, 0b11111100, 0b11111111,
 };
 
-GxEPD2_154c::GxEPD2_154c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000)
+GxEPD2_154c::GxEPD2_154c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 2 - 1
src/epd3c/GxEPD2_213c.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_213c.h"
 #include "WaveTables.h"
 
-GxEPD2_213c::GxEPD2_213c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000)
+GxEPD2_213c::GxEPD2_213c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 2 - 1
src/epd3c/GxEPD2_270c.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_270c.h"
 #include "WaveTables.h"
 
-GxEPD2_270c::GxEPD2_270c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000)
+GxEPD2_270c::GxEPD2_270c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 2 - 1
src/epd3c/GxEPD2_290c.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_290c.h"
 #include "WaveTables.h"
 
-GxEPD2_290c::GxEPD2_290c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000)
+GxEPD2_290c::GxEPD2_290c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 2 - 1
src/epd3c/GxEPD2_420c.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_420c.h"
 #include "WaveTables.h"
 
-GxEPD2_420c::GxEPD2_420c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000)
+GxEPD2_420c::GxEPD2_420c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, LOW, 20000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 2 - 1
src/epd3c/GxEPD2_583c.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_583c.h"
 #include "WaveTables.h"
 
-GxEPD2_583c::GxEPD2_583c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 40000000)
+GxEPD2_583c::GxEPD2_583c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, LOW, 40000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;

+ 2 - 1
src/epd3c/GxEPD2_750c.cpp

@@ -12,7 +12,8 @@
 #include "GxEPD2_750c.h"
 #include "WaveTables.h"
 
-GxEPD2_750c::GxEPD2_750c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) : GxEPD2_EPD(cs, dc, rst, busy, LOW, 40000000)
+GxEPD2_750c::GxEPD2_750c(int8_t cs, int8_t dc, int8_t rst, int8_t busy) :
+  GxEPD2_EPD(cs, dc, rst, busy, LOW, 40000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
 {
   _initial = true;
   _power_is_on = false;