GxEPD2_Example.ino 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. // Display Library example for SPI e-paper panels from Dalian Good Display and boards from Waveshare.
  2. // Requires HW SPI and Adafruit_GFX. Caution: these e-papers require 3.3V supply AND data lines!
  3. //
  4. // Display Library based on Demo Example from Good Display: http://www.good-display.com/download_list/downloadcategoryid=34&isMode=false.html
  5. //
  6. // Author: Jean-Marc Zingg
  7. //
  8. // Version: see library.properties
  9. //
  10. // Library: https://github.com/ZinggJM/GxEPD2
  11. // Supporting Arduino Forum Topics:
  12. // Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0
  13. // Good Dispay ePaper for Arduino : https://forum.arduino.cc/index.php?topic=436411.0
  14. // mapping suggestion from Waveshare SPI e-Paper to Wemos D1 mini
  15. // BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V
  16. // mapping suggestion from Waveshare SPI e-Paper to generic ESP8266
  17. // BUSY -> GPIO4, RST -> GPIO2, DC -> GPIO0, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V
  18. // mapping of Waveshare e-Paper ESP8266 Driver Board
  19. // BUSY -> GPIO16, RST -> GPIO5, DC -> GPIO4, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V
  20. // mapping suggestion for ESP32, e.g. LOLIN32, see .../variants/.../pins_arduino.h for your board
  21. // NOTE: there are variants with different pins for SPI ! CHECK SPI PINS OF YOUR BOARD
  22. // BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V
  23. // new mapping suggestion for STM32F1, e.g. STM32F103C8T6 "BluePill"
  24. // BUSY -> A1, RST -> A2, DC -> A3, CS-> A4, CLK -> A5, DIN -> A7
  25. // mapping suggestion for AVR, UNO, NANO etc.
  26. // BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11
  27. #include <GxEPD2_BW.h>
  28. #include <GxEPD2_3C.h>
  29. #include <Fonts/FreeMonoBold9pt7b.h>
  30. #if defined (ESP8266)
  31. // select one and adapt to your mapping, can use full buffer size (full HEIGHT)
  32. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  33. //GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display(GxEPD2_213(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  34. //GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  35. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  36. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  37. // can use only half buffer size
  38. //GxEPD2_BW < GxEPD2_583, GxEPD2_583::HEIGHT / 2 > display(GxEPD2_583(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  39. //GxEPD2_BW < GxEPD2_750, GxEPD2_750::HEIGHT / 2 > display(GxEPD2_750(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  40. // 3-color e-papers
  41. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  42. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  43. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  44. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  45. // can use only half buffer size
  46. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT / 2> display(GxEPD2_420c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  47. // can use only quarter buffer size
  48. //GxEPD2_3C<GxEPD2_583c, GxEPD2_583c::HEIGHT / 4> display(GxEPD2_583c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  49. //GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display(GxEPD2_750c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  50. // ***** for mapping of Waveshare e-Paper ESP8266 Driver Board *****
  51. // select one , can use full buffer size (full HEIGHT)
  52. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  53. //GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display(GxEPD2_213(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  54. //GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  55. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  56. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  57. // can use only half buffer size
  58. //GxEPD2_BW < GxEPD2_583, GxEPD2_583::HEIGHT / 2 > display(GxEPD2_583(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  59. //GxEPD2_BW < GxEPD2_750, GxEPD2_750::HEIGHT / 2 > display(GxEPD2_750(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  60. // 3-color e-papers
  61. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  62. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  63. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  64. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  65. // can use only half buffer size
  66. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT / 2> display(GxEPD2_420c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  67. // can use only quarter buffer size
  68. //GxEPD2_3C<GxEPD2_583c, GxEPD2_583c::HEIGHT / 4> display(GxEPD2_583c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  69. //GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display(GxEPD2_750c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));
  70. #endif
  71. #if defined(ESP32)
  72. // select one and adapt to your mapping, can use full buffer size (full HEIGHT)
  73. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  74. //GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display(GxEPD2_213(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  75. //GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  76. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  77. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  78. //GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display(GxEPD2_750(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  79. // 3-color e-papers
  80. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  81. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  82. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  83. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  84. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT> display(GxEPD2_420c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  85. //GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT> display(GxEPD2_750c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  86. #endif
  87. #if defined(_BOARD_GENERIC_STM32F103C_H_)
  88. #define MAX_DISPAY_BUFFER_SIZE (400 * 300) // ~5k is a good compromise
  89. #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPAY_BUFFER_SIZE / 8 / EPD::WIDTH ? EPD::HEIGHT : MAX_DISPAY_BUFFER_SIZE / 8 / EPD::WIDTH)
  90. // select one and adapt to your mapping
  91. //GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  92. //GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  93. //GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  94. //GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  95. //GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  96. //GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  97. // 3-color e-papers
  98. //GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT(GxEPD2_154c)> display(GxEPD2_154c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  99. //GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT(GxEPD2_213c)> display(GxEPD2_213c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  100. //GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT(GxEPD2_290c)> display(GxEPD2_290c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  101. //GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT(GxEPD2_270c)> display(GxEPD2_270c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  102. //GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT(GxEPD2_420c)> display(GxEPD2_420c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  103. //GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT(GxEPD2_750c)> display(GxEPD2_750c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  104. #endif
  105. #if defined(__AVR)
  106. #define MAX_DISPAY_BUFFER_SIZE 1000 // half of available RAM as a compromise
  107. #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPAY_BUFFER_SIZE / 8 / EPD::WIDTH ? EPD::HEIGHT : MAX_DISPAY_BUFFER_SIZE / 8 / EPD::WIDTH)
  108. // select one and adapt to your mapping
  109. //GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  110. //GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  111. //GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  112. //GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  113. //GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  114. //GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  115. // 3-color e-papers
  116. //GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT(GxEPD2_154c)> display(GxEPD2_154c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  117. //GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT(GxEPD2_213c)> display(GxEPD2_213c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  118. //GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT(GxEPD2_290c)> display(GxEPD2_290c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  119. //GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT(GxEPD2_270c)> display(GxEPD2_270c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  120. //GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT(GxEPD2_420c)> display(GxEPD2_420c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  121. //GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT(GxEPD2_750c)> display(GxEPD2_750c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  122. #endif
  123. void setup()
  124. {
  125. Serial.begin(115200);
  126. Serial.println();
  127. Serial.println("setup");
  128. display.init();
  129. // first update should be full refresh
  130. helloWorld();
  131. delay(1000);
  132. // partial refresh mode can be used to full screen,
  133. // effective if display panel hasFastPartialUpdate
  134. helloFullScreenPartialMode();
  135. delay(1000);
  136. helloArduino();
  137. delay(1000);
  138. helloEpaper();
  139. delay(1000);
  140. showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  141. delay(1000);
  142. drawBitmaps();
  143. if (display.epd2.hasPartialUpdate)
  144. {
  145. showPartialUpdate();
  146. delay(1000);
  147. } // else // on GDEW0154Z04 only full update available, doesn't look nice
  148. //drawCornerTest();
  149. //showBox(16, 16, 48, 32, false);
  150. //showBox(16, 56, 48, 32, true);
  151. display.powerOff();
  152. Serial.println("setup done");
  153. }
  154. void loop()
  155. {
  156. }
  157. void helloWorld()
  158. {
  159. //Serial.println("helloWorld");
  160. display.setRotation(1);
  161. display.setFont(&FreeMonoBold9pt7b);
  162. display.setTextColor(GxEPD_BLACK);
  163. uint16_t x = (display.width() - 160) / 2;
  164. uint16_t y = display.height() / 2;
  165. display.firstPage();
  166. do
  167. {
  168. display.fillScreen(GxEPD_WHITE);
  169. display.setCursor(x, y);
  170. display.println("Hello World!");
  171. }
  172. while (display.nextPage());
  173. //Serial.println("helloWorld done");
  174. }
  175. void helloFullScreenPartialMode()
  176. {
  177. //Serial.println("helloFullScreenPartialMode");
  178. display.setPartialWindow(0, 0, display.width(), display.height());
  179. display.setRotation(1);
  180. display.setFont(&FreeMonoBold9pt7b);
  181. display.setTextColor(GxEPD_BLACK);
  182. display.firstPage();
  183. do
  184. {
  185. uint16_t x = (display.width() - 160) / 2;
  186. uint16_t y = display.height() / 2;
  187. display.fillScreen(GxEPD_WHITE);
  188. display.setCursor(x, y);
  189. display.println("Hello World!");
  190. y = display.height() / 4;
  191. display.setCursor(x, y);
  192. display.println("full screen");
  193. y = display.height() * 3 / 4;
  194. if (display.width() <= 200) x = 0;
  195. display.setCursor(x, y);
  196. if (display.epd2.hasFastPartialUpdate)
  197. {
  198. display.println("fast partial mode");
  199. }
  200. else if (display.epd2.hasPartialUpdate)
  201. {
  202. display.println("slow partial mode");
  203. }
  204. else
  205. {
  206. display.println("no partial mode");
  207. }
  208. }
  209. while (display.nextPage());
  210. //Serial.println("helloFullScreenPartialMode done");
  211. }
  212. void helloArduino()
  213. {
  214. //Serial.println("helloArduino");
  215. display.setRotation(1);
  216. display.setFont(&FreeMonoBold9pt7b);
  217. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  218. uint16_t x = (display.width() - 160) / 2;
  219. uint16_t y = display.height() / 4;
  220. display.setPartialWindow(0, y - 14, display.width(), 20);
  221. display.firstPage();
  222. do
  223. {
  224. display.fillScreen(GxEPD_WHITE);
  225. display.setCursor(x, y);
  226. display.println("Hello Arduino!");
  227. }
  228. while (display.nextPage());
  229. delay(1000);
  230. //Serial.println("helloArduino done");
  231. }
  232. void helloEpaper()
  233. {
  234. //Serial.println("helloEpaper");
  235. display.setRotation(1);
  236. display.setFont(&FreeMonoBold9pt7b);
  237. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  238. uint16_t x = (display.width() - 160) / 2;
  239. uint16_t y = display.height() * 3 / 4;
  240. display.setPartialWindow(0, y - 14, display.width(), 20);
  241. display.firstPage();
  242. do
  243. {
  244. display.fillScreen(GxEPD_WHITE);
  245. display.setCursor(x, y);
  246. display.println("Hello E-Paper!");
  247. }
  248. while (display.nextPage());
  249. //Serial.println("helloEpaper done");
  250. }
  251. void showBox(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
  252. {
  253. //Serial.println("showBox");
  254. display.setRotation(1);
  255. if (partial)
  256. {
  257. display.setPartialWindow(x, y, w, h);
  258. }
  259. else
  260. {
  261. display.setFullWindow();
  262. }
  263. display.firstPage();
  264. do
  265. {
  266. display.fillScreen(GxEPD_WHITE);
  267. display.fillRect(x, y, w, h, GxEPD_BLACK);
  268. }
  269. while (display.nextPage());
  270. //Serial.println("showBox done");
  271. }
  272. void drawCornerTest()
  273. {
  274. display.setFullWindow();
  275. display.setFont(&FreeMonoBold9pt7b);
  276. display.setTextColor(GxEPD_BLACK);
  277. for (uint16_t r = 0; r <= 4; r++)
  278. {
  279. display.setRotation(r);
  280. display.firstPage();
  281. do
  282. {
  283. display.fillScreen(GxEPD_WHITE);
  284. display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
  285. display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
  286. display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
  287. display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
  288. display.setCursor(display.width() / 2, display.height() / 2);
  289. display.print(display.getRotation());
  290. }
  291. while (display.nextPage());
  292. delay(2000);
  293. }
  294. }
  295. void showFont(const char name[], const GFXfont* f)
  296. {
  297. display.setFullWindow();
  298. display.setRotation(0);
  299. display.setTextColor(GxEPD_BLACK);
  300. display.firstPage();
  301. do
  302. {
  303. drawFont(name, f);
  304. }
  305. while (display.nextPage());
  306. }
  307. void drawFont(const char name[], const GFXfont* f)
  308. {
  309. //display.setRotation(0);
  310. display.fillScreen(GxEPD_WHITE);
  311. display.setTextColor(GxEPD_BLACK);
  312. display.setFont(f);
  313. display.setCursor(0, 0);
  314. display.println();
  315. display.println(name);
  316. display.println(" !\"#$%&'()*+,-./");
  317. display.println("0123456789:;<=>?");
  318. display.println("@ABCDEFGHIJKLMNO");
  319. display.println("PQRSTUVWXYZ[\\]^_");
  320. if (display.epd2.hasColor)
  321. {
  322. display.setTextColor(GxEPD_RED);
  323. }
  324. display.println("`abcdefghijklmno");
  325. display.println("pqrstuvwxyz{|}~ ");
  326. }
  327. void showPartialUpdate()
  328. {
  329. // some useful background
  330. helloWorld();
  331. // use asymmetric values for test
  332. uint16_t box_x = 10;
  333. uint16_t box_y = 15;
  334. uint16_t box_w = 70;
  335. uint16_t box_h = 20;
  336. uint16_t cursor_y = box_y + box_h - 6;
  337. float value = 13.95;
  338. uint16_t incr = display.epd2.hasFastPartialUpdate ? 1 : 3;
  339. display.setFont(&FreeMonoBold9pt7b);
  340. display.setTextColor(GxEPD_BLACK);
  341. // show where the update box is
  342. for (uint16_t r = 0; r < 4; r++)
  343. {
  344. display.setRotation(r);
  345. display.setPartialWindow(box_x, box_y, box_w, box_h);
  346. display.firstPage();
  347. do
  348. {
  349. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  350. //display.fillScreen(GxEPD_BLACK);
  351. }
  352. while (display.nextPage());
  353. delay(2000);
  354. display.firstPage();
  355. do
  356. {
  357. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  358. }
  359. while (display.nextPage());
  360. delay(1000);
  361. }
  362. //return;
  363. // show updates in the update box
  364. for (uint16_t r = 0; r < 4; r++)
  365. {
  366. display.setRotation(r);
  367. display.setPartialWindow(box_x, box_y, box_w, box_h);
  368. for (uint16_t i = 1; i <= 10; i += incr)
  369. {
  370. display.firstPage();
  371. do
  372. {
  373. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  374. display.setCursor(box_x, cursor_y);
  375. display.print(value * i, 2);
  376. }
  377. while (display.nextPage());
  378. delay(500);
  379. }
  380. delay(1000);
  381. display.firstPage();
  382. do
  383. {
  384. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  385. }
  386. while (display.nextPage());
  387. delay(1000);
  388. }
  389. }
  390. // comment out unused bitmaps to reduce code space used
  391. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  392. #include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  393. #include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  394. #include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  395. #include "bitmaps/Bitmaps400x300.h" // 4.2" b/w
  396. #include "bitmaps/Bitmaps640x384.h" // 7.5" b/w
  397. // 3-color
  398. #include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  399. #include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  400. #include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  401. #include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  402. #include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r
  403. void drawBitmaps()
  404. {
  405. display.setFullWindow();
  406. #ifdef _GxBitmaps128x250_H_
  407. drawBitmaps128x250();
  408. #endif
  409. #ifdef _GxBitmaps128x296_H_
  410. drawBitmaps128x296();
  411. #endif
  412. #ifdef _GxBitmaps176x264_H_
  413. drawBitmaps176x264();
  414. #endif
  415. #ifdef _GxBitmaps400x300_H_
  416. drawBitmaps400x300();
  417. #endif
  418. #ifdef _GxBitmaps640x384_H_
  419. drawBitmaps640x384();
  420. #endif
  421. // 3-color
  422. #ifdef _GxBitmaps3c104x212_H_
  423. drawBitmaps3c104x212();
  424. #endif
  425. #ifdef _GxBitmaps3c128x296_H_
  426. drawBitmaps3c128x296();
  427. #endif
  428. #ifdef _GxBitmaps3c176x264_H_
  429. drawBitmaps3c176x264();
  430. #endif
  431. #ifdef _GxBitmaps3c400x300_H_
  432. drawBitmaps3c400x300();
  433. #endif
  434. // show these after the specific bitmaps
  435. #ifdef _GxBitmaps200x200_H_
  436. drawBitmaps200x200();
  437. #endif
  438. // 3-color
  439. #ifdef _GxBitmaps3c200x200_H_
  440. drawBitmaps3c200x200();
  441. #endif
  442. }
  443. #ifdef _GxBitmaps200x200_H_
  444. void drawBitmaps200x200()
  445. {
  446. const unsigned char* bitmaps[] =
  447. {
  448. logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  449. };
  450. if (display.epd2.panel == GxEPD2::GDEP015OC1)
  451. {
  452. bool m = display.mirror(true);
  453. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  454. {
  455. display.firstPage();
  456. do
  457. {
  458. display.fillScreen(GxEPD_WHITE);
  459. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  460. }
  461. while (display.nextPage());
  462. delay(2000);
  463. }
  464. display.mirror(m);
  465. }
  466. //else
  467. {
  468. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  469. display.clearScreen(); // use default for white
  470. uint16_t x = (display.epd2.WIDTH - 200) / 2;
  471. uint16_t y = (display.epd2.HEIGHT - 200) / 2;
  472. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  473. {
  474. display.drawImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  475. delay(2000);
  476. }
  477. }
  478. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  479. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  480. {
  481. int16_t x = -60;
  482. int16_t y = -60;
  483. for (uint16_t j = 0; j < 10; j++)
  484. {
  485. display.writeScreenBuffer(); // use default for white
  486. display.writeImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  487. display.refresh(true);
  488. delay(2000);
  489. x += 40;
  490. y += 40;
  491. if ((x >= display.epd2.WIDTH) || (y >= display.epd2.HEIGHT)) break;
  492. }
  493. if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
  494. break; // comment out for full show
  495. }
  496. display.writeScreenBuffer(); // use default for white
  497. display.writeImage(bitmaps[0], 0, 0, 200, 200, false, mirror_y, true);
  498. display.writeImage(bitmaps[0], display.epd2.WIDTH - 200, display.epd2.HEIGHT - 200, 200, 200, false, mirror_y, true);
  499. display.refresh(true);
  500. delay(2000);
  501. }
  502. #endif
  503. #ifdef _GxBitmaps128x250_H_
  504. void drawBitmaps128x250()
  505. {
  506. const unsigned char* bitmaps[] =
  507. {
  508. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  509. };
  510. if (display.epd2.panel == GxEPD2::GDE0213B1)
  511. {
  512. bool m = display.mirror(true);
  513. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  514. {
  515. display.firstPage();
  516. do
  517. {
  518. display.fillScreen(GxEPD_WHITE);
  519. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  520. }
  521. while (display.nextPage());
  522. delay(2000);
  523. }
  524. display.mirror(m);
  525. }
  526. }
  527. #endif
  528. #ifdef _GxBitmaps128x296_H_
  529. void drawBitmaps128x296()
  530. {
  531. const unsigned char* bitmaps[] =
  532. {
  533. Bitmap128x296_1, logo128x296, first128x296, second128x296, third128x296
  534. };
  535. if (display.epd2.panel == GxEPD2::GDEH029A1)
  536. {
  537. bool m = display.mirror(true);
  538. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  539. {
  540. display.firstPage();
  541. do
  542. {
  543. display.fillScreen(GxEPD_WHITE);
  544. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  545. }
  546. while (display.nextPage());
  547. delay(2000);
  548. }
  549. display.mirror(m);
  550. }
  551. }
  552. #endif
  553. #ifdef _GxBitmaps176x264_H_
  554. void drawBitmaps176x264()
  555. {
  556. const unsigned char* bitmaps[] =
  557. {
  558. Bitmap176x264_1, Bitmap176x264_2
  559. };
  560. if (display.epd2.panel == GxEPD2::GDEW027W3)
  561. {
  562. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  563. {
  564. display.firstPage();
  565. do
  566. {
  567. display.fillScreen(GxEPD_WHITE);
  568. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  569. }
  570. while (display.nextPage());
  571. delay(2000);
  572. }
  573. }
  574. }
  575. #endif
  576. #ifdef _GxBitmaps400x300_H_
  577. void drawBitmaps400x300()
  578. {
  579. const unsigned char* bitmaps[] =
  580. {
  581. Bitmap400x300_1, Bitmap400x300_2
  582. };
  583. if (display.epd2.panel == GxEPD2::GDEW042T2)
  584. {
  585. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  586. {
  587. display.firstPage();
  588. do
  589. {
  590. display.fillScreen(GxEPD_WHITE);
  591. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  592. }
  593. while (display.nextPage());
  594. delay(2000);
  595. }
  596. }
  597. }
  598. #endif
  599. #ifdef _GxBitmaps640x384_H_
  600. void drawBitmaps640x384()
  601. {
  602. const unsigned char* bitmaps[] =
  603. {
  604. Bitmap640x384_1, Bitmap640x384_2
  605. };
  606. if (display.epd2.panel == GxEPD2::GDEW075T8)
  607. {
  608. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  609. {
  610. display.firstPage();
  611. do
  612. {
  613. display.fillScreen(GxEPD_WHITE);
  614. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  615. }
  616. while (display.nextPage());
  617. delay(2000);
  618. }
  619. }
  620. }
  621. #endif
  622. struct bitmap_pair
  623. {
  624. const unsigned char* black;
  625. const unsigned char* red;
  626. };
  627. #ifdef _GxBitmaps3c200x200_H_
  628. void drawBitmaps3c200x200()
  629. {
  630. bitmap_pair bitmap_pairs[] =
  631. {
  632. //{Bitmap3c200x200_black, Bitmap3c200x200_red},
  633. {WS_Bitmap3c200x200_black, WS_Bitmap3c200x200_red}
  634. };
  635. if (display.epd2.panel == GxEPD2::GDEW0154Z04)
  636. {
  637. display.firstPage();
  638. do
  639. {
  640. display.fillScreen(GxEPD_WHITE);
  641. // Bitmap3c200x200_black has 2 bits per pixel
  642. // taken from Adafruit_GFX.cpp, modified
  643. int16_t byteWidth = (display.epd2.WIDTH + 7) / 8; // Bitmap scanline pad = whole byte
  644. uint8_t byte = 0;
  645. for (int16_t j = 0; j < display.epd2.HEIGHT; j++)
  646. {
  647. for (int16_t i = 0; i < display.epd2.WIDTH; i++)
  648. {
  649. if (i & 3) byte <<= 2;
  650. else
  651. {
  652. #if defined(__AVR) || defined(ESP8266) || defined(ESP32)
  653. byte = pgm_read_byte(&Bitmap3c200x200_black[j * byteWidth * 2 + i / 4]);
  654. #else
  655. byte = Bitmap3c200x200_black[j * byteWidth * 2 + i / 4];
  656. #endif
  657. }
  658. if (!(byte & 0x80))
  659. {
  660. display.drawPixel(i, j, GxEPD_BLACK);
  661. }
  662. }
  663. }
  664. display.drawInvertedBitmap(0, 0, Bitmap3c200x200_red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  665. }
  666. while (display.nextPage());
  667. delay(2000);
  668. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  669. {
  670. display.firstPage();
  671. do
  672. {
  673. display.fillScreen(GxEPD_WHITE);
  674. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  675. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  676. }
  677. while (display.nextPage());
  678. delay(2000);
  679. }
  680. }
  681. if (display.epd2.hasColor)
  682. {
  683. display.clearScreen(); // use default for white
  684. uint16_t x = (display.epd2.WIDTH - 200) / 2;
  685. uint16_t y = (display.epd2.HEIGHT - 200) / 2;
  686. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  687. {
  688. display.drawImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  689. delay(2000);
  690. }
  691. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  692. {
  693. int16_t x = -60;
  694. int16_t y = -60;
  695. for (uint16_t j = 0; j < 10; j++)
  696. {
  697. display.writeScreenBuffer(); // use default for white
  698. display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  699. display.refresh();
  700. delay(2000);
  701. x += 40;
  702. y += 40;
  703. if ((x >= display.epd2.WIDTH) || (y >= display.epd2.HEIGHT)) break;
  704. }
  705. }
  706. display.writeScreenBuffer(); // use default for white
  707. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, 0, 0, 200, 200, false, false, true);
  708. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, display.epd2.WIDTH - 200, display.epd2.HEIGHT - 200, 200, 200, false, false, true);
  709. display.refresh();
  710. delay(2000);
  711. }
  712. }
  713. #endif
  714. #ifdef _GxBitmaps3c104x212_H_
  715. void drawBitmaps3c104x212()
  716. {
  717. bitmap_pair bitmap_pairs[] =
  718. {
  719. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  720. {Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  721. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  722. };
  723. if (display.epd2.panel == GxEPD2::GDEW0213Z16)
  724. {
  725. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  726. {
  727. display.firstPage();
  728. do
  729. {
  730. display.fillScreen(GxEPD_WHITE);
  731. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  732. if (bitmap_pairs[i].red == WS_Bitmap3c104x212_red)
  733. {
  734. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  735. }
  736. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  737. }
  738. while (display.nextPage());
  739. delay(2000);
  740. }
  741. }
  742. }
  743. #endif
  744. #ifdef _GxBitmaps3c128x296_H_
  745. void drawBitmaps3c128x296()
  746. {
  747. bitmap_pair bitmap_pairs[] =
  748. {
  749. {Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  750. {Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  751. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  752. };
  753. if (display.epd2.panel == GxEPD2::GDEW029Z10)
  754. {
  755. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  756. {
  757. display.firstPage();
  758. do
  759. {
  760. display.fillScreen(GxEPD_WHITE);
  761. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  762. if (bitmap_pairs[i].red == WS_Bitmap3c128x296_red)
  763. {
  764. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  765. }
  766. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  767. }
  768. while (display.nextPage());
  769. delay(2000);
  770. }
  771. }
  772. }
  773. #endif
  774. #ifdef _GxBitmaps3c176x264_H_
  775. void drawBitmaps3c176x264()
  776. {
  777. bitmap_pair bitmap_pairs[] =
  778. {
  779. {Bitmap3c176x264_black, Bitmap3c176x264_red}
  780. };
  781. if (display.epd2.panel == GxEPD2::GDEW027C44)
  782. {
  783. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  784. {
  785. display.firstPage();
  786. do
  787. {
  788. display.fillScreen(GxEPD_WHITE);
  789. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  790. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  791. }
  792. while (display.nextPage());
  793. delay(2000);
  794. }
  795. }
  796. }
  797. #endif
  798. #ifdef _GxBitmaps3c400x300_H_
  799. void drawBitmaps3c400x300()
  800. {
  801. bitmap_pair bitmap_pairs[] =
  802. {
  803. {Bitmap3c400x300_1_black, Bitmap3c400x300_1_red},
  804. {Bitmap3c400x300_2_black, Bitmap3c400x300_2_red},
  805. {WS_Bitmap3c400x300_black, WS_Bitmap3c400x300_red}
  806. };
  807. if (display.epd2.panel == GxEPD2::GDEW042Z15)
  808. {
  809. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  810. {
  811. display.firstPage();
  812. do
  813. {
  814. display.fillScreen(GxEPD_WHITE);
  815. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  816. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  817. }
  818. while (display.nextPage());
  819. delay(2000);
  820. }
  821. }
  822. }
  823. #endif