GxEPD2_Example.ino 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  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) // ~15k is a good compromise
  89. #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPAY_BUFFER_SIZE / (EPD::WIDTH / 8))
  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. #define MAX_HEIGHT_3C(EPD) (EPD::HEIGHT <= (MAX_DISPAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8) ? EPD::HEIGHT : (MAX_DISPAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8))
  99. //GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT_3C(GxEPD2_154c)> display(GxEPD2_154c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  100. //GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  101. //GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  102. //GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT_3C(GxEPD2_270c)> display(GxEPD2_270c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  103. //GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT_3C(GxEPD2_420c)> display(GxEPD2_420c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  104. //GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  105. #endif
  106. #if defined(__AVR)
  107. #define MAX_DISPAY_BUFFER_SIZE 800 //
  108. #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPAY_BUFFER_SIZE / (EPD::WIDTH / 8))
  109. // select one and adapt to your mapping
  110. //GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  111. //GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  112. //GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  113. //GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  114. //GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  115. //GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  116. // 3-color e-papers
  117. #define MAX_HEIGHT_3C(EPD) (EPD::HEIGHT <= (MAX_DISPAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8) ? EPD::HEIGHT : (MAX_DISPAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8))
  118. ////GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT_3C(GxEPD2_154c)> display(GxEPD2_154c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // not available
  119. // in this version GxEPD2_154c can only be used with full size buffer (or with no buffer base display class)
  120. //GxEPD2_3C<GxEPD2_154c, (GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  121. //GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  122. //GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  123. //GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT_3C(GxEPD2_270c)> display(GxEPD2_270c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  124. //GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT_3C(GxEPD2_420c)> display(GxEPD2_420c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  125. //GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  126. #endif
  127. #if !defined(__AVR)
  128. // comment out unused bitmaps to reduce code space used
  129. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  130. #include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  131. #include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  132. #include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  133. #include "bitmaps/Bitmaps400x300.h" // 4.2" b/w
  134. #include "bitmaps/Bitmaps640x384.h" // 7.5" b/w
  135. // 3-color
  136. #include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  137. #include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  138. #include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  139. #include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  140. #include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r
  141. #else
  142. // select only one to fit in code space
  143. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  144. //#include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  145. //#include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  146. //#include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  147. ////#include "bitmaps/Bitmaps400x300.h" // 4.2" b/w // not enough code space
  148. ////#include "bitmaps/Bitmaps640x384.h" // 7.5" b/w // not enough code space
  149. // 3-color
  150. //#include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  151. //#include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  152. //#include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  153. //#include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  154. ////#include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r // not enough code space
  155. #endif
  156. void setup()
  157. {
  158. Serial.begin(115200);
  159. Serial.println();
  160. Serial.println("setup");
  161. display.init(115200);
  162. // first update should be full refresh
  163. helloWorld();
  164. delay(1000);
  165. // partial refresh mode can be used to full screen,
  166. // effective if display panel hasFastPartialUpdate
  167. helloFullScreenPartialMode();
  168. delay(1000);
  169. helloArduino();
  170. delay(1000);
  171. helloEpaper();
  172. delay(1000);
  173. showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  174. delay(1000);
  175. drawBitmaps();
  176. if (display.epd2.hasPartialUpdate)
  177. {
  178. showPartialUpdate();
  179. delay(1000);
  180. } // else // on GDEW0154Z04 only full update available, doesn't look nice
  181. //drawCornerTest();
  182. //showBox(16, 16, 48, 32, false);
  183. //showBox(16, 56, 48, 32, true);
  184. display.powerOff();
  185. Serial.println("setup done");
  186. }
  187. void loop()
  188. {
  189. }
  190. void helloWorld()
  191. {
  192. //Serial.println("helloWorld");
  193. display.setRotation(1);
  194. display.setFont(&FreeMonoBold9pt7b);
  195. display.setTextColor(GxEPD_BLACK);
  196. uint16_t x = (display.width() - 160) / 2;
  197. uint16_t y = display.height() / 2;
  198. display.setFullWindow();
  199. display.firstPage();
  200. do
  201. {
  202. display.fillScreen(GxEPD_WHITE);
  203. display.setCursor(x, y);
  204. display.println("Hello World!");
  205. }
  206. while (display.nextPage());
  207. //Serial.println("helloWorld done");
  208. }
  209. void helloFullScreenPartialMode()
  210. {
  211. //Serial.println("helloFullScreenPartialMode");
  212. display.setPartialWindow(0, 0, display.width(), display.height());
  213. display.setRotation(1);
  214. display.setFont(&FreeMonoBold9pt7b);
  215. display.setTextColor(GxEPD_BLACK);
  216. display.firstPage();
  217. do
  218. {
  219. uint16_t x = (display.width() - 160) / 2;
  220. uint16_t y = display.height() / 2;
  221. display.fillScreen(GxEPD_WHITE);
  222. display.setCursor(x, y);
  223. display.println("Hello World!");
  224. y = display.height() / 4;
  225. display.setCursor(x, y);
  226. display.println("full screen");
  227. y = display.height() * 3 / 4;
  228. if (display.width() <= 200) x = 0;
  229. display.setCursor(x, y);
  230. if (display.epd2.hasFastPartialUpdate)
  231. {
  232. display.println("fast partial mode");
  233. }
  234. else if (display.epd2.hasPartialUpdate)
  235. {
  236. display.println("slow partial mode");
  237. }
  238. else
  239. {
  240. display.println("no partial mode");
  241. }
  242. }
  243. while (display.nextPage());
  244. //Serial.println("helloFullScreenPartialMode done");
  245. }
  246. void helloArduino()
  247. {
  248. //Serial.println("helloArduino");
  249. display.setRotation(1);
  250. display.setFont(&FreeMonoBold9pt7b);
  251. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  252. uint16_t x = (display.width() - 160) / 2;
  253. uint16_t y = display.height() / 4;
  254. display.setPartialWindow(0, y - 14, display.width(), 20);
  255. display.firstPage();
  256. do
  257. {
  258. display.fillScreen(GxEPD_WHITE);
  259. display.setCursor(x, y);
  260. display.println("Hello Arduino!");
  261. }
  262. while (display.nextPage());
  263. delay(1000);
  264. //Serial.println("helloArduino done");
  265. }
  266. void helloEpaper()
  267. {
  268. //Serial.println("helloEpaper");
  269. display.setRotation(1);
  270. display.setFont(&FreeMonoBold9pt7b);
  271. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  272. uint16_t x = (display.width() - 160) / 2;
  273. uint16_t y = display.height() * 3 / 4;
  274. display.setPartialWindow(0, y - 14, display.width(), 20);
  275. display.firstPage();
  276. do
  277. {
  278. display.fillScreen(GxEPD_WHITE);
  279. display.setCursor(x, y);
  280. display.println("Hello E-Paper!");
  281. }
  282. while (display.nextPage());
  283. //Serial.println("helloEpaper done");
  284. }
  285. void showBox(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
  286. {
  287. //Serial.println("showBox");
  288. display.setRotation(1);
  289. if (partial)
  290. {
  291. display.setPartialWindow(x, y, w, h);
  292. }
  293. else
  294. {
  295. display.setFullWindow();
  296. }
  297. display.firstPage();
  298. do
  299. {
  300. display.fillScreen(GxEPD_WHITE);
  301. display.fillRect(x, y, w, h, GxEPD_BLACK);
  302. }
  303. while (display.nextPage());
  304. //Serial.println("showBox done");
  305. }
  306. void drawCornerTest()
  307. {
  308. display.setFullWindow();
  309. display.setFont(&FreeMonoBold9pt7b);
  310. display.setTextColor(GxEPD_BLACK);
  311. for (uint16_t r = 0; r <= 4; r++)
  312. {
  313. display.setRotation(r);
  314. display.firstPage();
  315. do
  316. {
  317. display.fillScreen(GxEPD_WHITE);
  318. display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
  319. display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
  320. display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
  321. display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
  322. display.setCursor(display.width() / 2, display.height() / 2);
  323. display.print(display.getRotation());
  324. }
  325. while (display.nextPage());
  326. delay(2000);
  327. }
  328. }
  329. void showFont(const char name[], const GFXfont* f)
  330. {
  331. display.setFullWindow();
  332. display.setRotation(0);
  333. display.setTextColor(GxEPD_BLACK);
  334. display.firstPage();
  335. do
  336. {
  337. drawFont(name, f);
  338. }
  339. while (display.nextPage());
  340. }
  341. void drawFont(const char name[], const GFXfont* f)
  342. {
  343. //display.setRotation(0);
  344. display.fillScreen(GxEPD_WHITE);
  345. display.setTextColor(GxEPD_BLACK);
  346. display.setFont(f);
  347. display.setCursor(0, 0);
  348. display.println();
  349. display.println(name);
  350. display.println(" !\"#$%&'()*+,-./");
  351. display.println("0123456789:;<=>?");
  352. display.println("@ABCDEFGHIJKLMNO");
  353. display.println("PQRSTUVWXYZ[\\]^_");
  354. if (display.epd2.hasColor)
  355. {
  356. display.setTextColor(GxEPD_RED);
  357. }
  358. display.println("`abcdefghijklmno");
  359. display.println("pqrstuvwxyz{|}~ ");
  360. }
  361. void showPartialUpdate()
  362. {
  363. // some useful background
  364. helloWorld();
  365. // use asymmetric values for test
  366. uint16_t box_x = 10;
  367. uint16_t box_y = 15;
  368. uint16_t box_w = 70;
  369. uint16_t box_h = 20;
  370. uint16_t cursor_y = box_y + box_h - 6;
  371. float value = 13.95;
  372. uint16_t incr = display.epd2.hasFastPartialUpdate ? 1 : 3;
  373. display.setFont(&FreeMonoBold9pt7b);
  374. display.setTextColor(GxEPD_BLACK);
  375. // show where the update box is
  376. for (uint16_t r = 0; r < 4; r++)
  377. {
  378. display.setRotation(r);
  379. display.setPartialWindow(box_x, box_y, box_w, box_h);
  380. display.firstPage();
  381. do
  382. {
  383. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  384. //display.fillScreen(GxEPD_BLACK);
  385. }
  386. while (display.nextPage());
  387. delay(2000);
  388. display.firstPage();
  389. do
  390. {
  391. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  392. }
  393. while (display.nextPage());
  394. delay(1000);
  395. }
  396. //return;
  397. // show updates in the update box
  398. for (uint16_t r = 0; r < 4; r++)
  399. {
  400. display.setRotation(r);
  401. display.setPartialWindow(box_x, box_y, box_w, box_h);
  402. for (uint16_t i = 1; i <= 10; i += incr)
  403. {
  404. display.firstPage();
  405. do
  406. {
  407. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  408. display.setCursor(box_x, cursor_y);
  409. display.print(value * i, 2);
  410. }
  411. while (display.nextPage());
  412. delay(500);
  413. }
  414. delay(1000);
  415. display.firstPage();
  416. do
  417. {
  418. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  419. }
  420. while (display.nextPage());
  421. delay(1000);
  422. }
  423. }
  424. void drawBitmaps()
  425. {
  426. display.setFullWindow();
  427. #ifdef _GxBitmaps128x250_H_
  428. drawBitmaps128x250();
  429. #endif
  430. #ifdef _GxBitmaps128x296_H_
  431. drawBitmaps128x296();
  432. #endif
  433. #ifdef _GxBitmaps176x264_H_
  434. drawBitmaps176x264();
  435. #endif
  436. #ifdef _GxBitmaps400x300_H_
  437. drawBitmaps400x300();
  438. #endif
  439. #ifdef _GxBitmaps640x384_H_
  440. drawBitmaps640x384();
  441. #endif
  442. // 3-color
  443. #ifdef _GxBitmaps3c104x212_H_
  444. drawBitmaps3c104x212();
  445. #endif
  446. #ifdef _GxBitmaps3c128x296_H_
  447. drawBitmaps3c128x296();
  448. #endif
  449. #ifdef _GxBitmaps3c176x264_H_
  450. drawBitmaps3c176x264();
  451. #endif
  452. #ifdef _GxBitmaps3c400x300_H_
  453. drawBitmaps3c400x300();
  454. #endif
  455. // show these after the specific bitmaps
  456. #ifdef _GxBitmaps200x200_H_
  457. drawBitmaps200x200();
  458. #endif
  459. // 3-color
  460. #ifdef _GxBitmaps3c200x200_H_
  461. drawBitmaps3c200x200();
  462. #endif
  463. }
  464. #ifdef _GxBitmaps200x200_H_
  465. void drawBitmaps200x200()
  466. {
  467. #if !defined(__AVR)
  468. const unsigned char* bitmaps[] =
  469. {
  470. logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  471. };
  472. #else
  473. const unsigned char* bitmaps[] =
  474. {
  475. logo200x200, first200x200 //, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  476. };
  477. #endif
  478. if (display.epd2.panel == GxEPD2::GDEP015OC1)
  479. {
  480. bool m = display.mirror(true);
  481. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  482. {
  483. display.firstPage();
  484. do
  485. {
  486. display.fillScreen(GxEPD_WHITE);
  487. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  488. }
  489. while (display.nextPage());
  490. delay(2000);
  491. }
  492. display.mirror(m);
  493. }
  494. //else
  495. {
  496. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  497. display.clearScreen(); // use default for white
  498. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  499. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  500. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  501. {
  502. display.drawImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  503. delay(2000);
  504. }
  505. }
  506. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  507. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  508. {
  509. int16_t x = -60;
  510. int16_t y = -60;
  511. for (uint16_t j = 0; j < 10; j++)
  512. {
  513. display.writeScreenBuffer(); // use default for white
  514. display.writeImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  515. display.refresh(true);
  516. delay(2000);
  517. x += 40;
  518. y += 40;
  519. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  520. }
  521. if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
  522. break; // comment out for full show
  523. }
  524. display.writeScreenBuffer(); // use default for white
  525. display.writeImage(bitmaps[0], 0, 0, 200, 200, false, mirror_y, true);
  526. display.writeImage(bitmaps[0], int16_t(display.epd2.WIDTH) - 200, int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
  527. display.refresh(true);
  528. delay(2000);
  529. }
  530. #endif
  531. #ifdef _GxBitmaps128x250_H_
  532. void drawBitmaps128x250()
  533. {
  534. #if !defined(__AVR)
  535. const unsigned char* bitmaps[] =
  536. {
  537. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  538. };
  539. #else
  540. const unsigned char* bitmaps[] =
  541. {
  542. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  543. };
  544. #endif
  545. if (display.epd2.panel == GxEPD2::GDE0213B1)
  546. {
  547. bool m = display.mirror(true);
  548. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  549. {
  550. display.firstPage();
  551. do
  552. {
  553. display.fillScreen(GxEPD_WHITE);
  554. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  555. }
  556. while (display.nextPage());
  557. delay(2000);
  558. }
  559. display.mirror(m);
  560. }
  561. }
  562. #endif
  563. #ifdef _GxBitmaps128x296_H_
  564. void drawBitmaps128x296()
  565. {
  566. #if !defined(__AVR)
  567. const unsigned char* bitmaps[] =
  568. {
  569. Bitmap128x296_1, logo128x296, first128x296, second128x296, third128x296
  570. };
  571. #else
  572. const unsigned char* bitmaps[] =
  573. {
  574. Bitmap128x296_1, logo128x296 //, first128x296, second128x296, third128x296
  575. };
  576. #endif
  577. if (display.epd2.panel == GxEPD2::GDEH029A1)
  578. {
  579. bool m = display.mirror(true);
  580. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  581. {
  582. display.firstPage();
  583. do
  584. {
  585. display.fillScreen(GxEPD_WHITE);
  586. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  587. }
  588. while (display.nextPage());
  589. delay(2000);
  590. }
  591. display.mirror(m);
  592. }
  593. }
  594. #endif
  595. #ifdef _GxBitmaps176x264_H_
  596. void drawBitmaps176x264()
  597. {
  598. const unsigned char* bitmaps[] =
  599. {
  600. Bitmap176x264_1, Bitmap176x264_2
  601. };
  602. if (display.epd2.panel == GxEPD2::GDEW027W3)
  603. {
  604. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  605. {
  606. display.firstPage();
  607. do
  608. {
  609. display.fillScreen(GxEPD_WHITE);
  610. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  611. }
  612. while (display.nextPage());
  613. delay(2000);
  614. }
  615. }
  616. }
  617. #endif
  618. #ifdef _GxBitmaps400x300_H_
  619. void drawBitmaps400x300()
  620. {
  621. #if !defined(__AVR)
  622. const unsigned char* bitmaps[] =
  623. {
  624. Bitmap400x300_1, Bitmap400x300_2
  625. };
  626. #else
  627. const unsigned char* bitmaps[] = {}; // not enough code space
  628. #endif
  629. if (display.epd2.panel == GxEPD2::GDEW042T2)
  630. {
  631. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  632. {
  633. display.firstPage();
  634. do
  635. {
  636. display.fillScreen(GxEPD_WHITE);
  637. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  638. }
  639. while (display.nextPage());
  640. delay(2000);
  641. }
  642. }
  643. }
  644. #endif
  645. #ifdef _GxBitmaps640x384_H_
  646. void drawBitmaps640x384()
  647. {
  648. #if !defined(__AVR)
  649. const unsigned char* bitmaps[] =
  650. {
  651. Bitmap640x384_1, Bitmap640x384_2
  652. };
  653. #else
  654. const unsigned char* bitmaps[] = {}; // not enough code space
  655. #endif
  656. if (display.epd2.panel == GxEPD2::GDEW075T8)
  657. {
  658. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  659. {
  660. display.firstPage();
  661. do
  662. {
  663. display.fillScreen(GxEPD_WHITE);
  664. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  665. }
  666. while (display.nextPage());
  667. delay(2000);
  668. }
  669. }
  670. }
  671. #endif
  672. struct bitmap_pair
  673. {
  674. const unsigned char* black;
  675. const unsigned char* red;
  676. };
  677. #ifdef _GxBitmaps3c200x200_H_
  678. void drawBitmaps3c200x200()
  679. {
  680. bitmap_pair bitmap_pairs[] =
  681. {
  682. //{Bitmap3c200x200_black, Bitmap3c200x200_red},
  683. {WS_Bitmap3c200x200_black, WS_Bitmap3c200x200_red}
  684. };
  685. if (display.epd2.panel == GxEPD2::GDEW0154Z04)
  686. {
  687. display.firstPage();
  688. do
  689. {
  690. display.fillScreen(GxEPD_WHITE);
  691. // Bitmap3c200x200_black has 2 bits per pixel
  692. // taken from Adafruit_GFX.cpp, modified
  693. int16_t byteWidth = (display.epd2.WIDTH + 7) / 8; // Bitmap scanline pad = whole byte
  694. uint8_t byte = 0;
  695. for (int16_t j = 0; j < display.epd2.HEIGHT; j++)
  696. {
  697. for (int16_t i = 0; i < display.epd2.WIDTH; i++)
  698. {
  699. if (i & 3) byte <<= 2;
  700. else
  701. {
  702. #if defined(__AVR) || defined(ESP8266) || defined(ESP32)
  703. byte = pgm_read_byte(&Bitmap3c200x200_black[j * byteWidth * 2 + i / 4]);
  704. #else
  705. byte = Bitmap3c200x200_black[j * byteWidth * 2 + i / 4];
  706. #endif
  707. }
  708. if (!(byte & 0x80))
  709. {
  710. display.drawPixel(i, j, GxEPD_BLACK);
  711. }
  712. }
  713. }
  714. display.drawInvertedBitmap(0, 0, Bitmap3c200x200_red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  715. }
  716. while (display.nextPage());
  717. delay(2000);
  718. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  719. {
  720. display.firstPage();
  721. do
  722. {
  723. display.fillScreen(GxEPD_WHITE);
  724. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  725. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  726. }
  727. while (display.nextPage());
  728. delay(2000);
  729. }
  730. }
  731. if (display.epd2.hasColor)
  732. {
  733. display.clearScreen(); // use default for white
  734. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  735. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  736. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  737. {
  738. display.drawImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  739. delay(2000);
  740. }
  741. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  742. {
  743. int16_t x = -60;
  744. int16_t y = -60;
  745. for (uint16_t j = 0; j < 10; j++)
  746. {
  747. display.writeScreenBuffer(); // use default for white
  748. display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  749. display.refresh();
  750. delay(2000);
  751. x += 40;
  752. y += 40;
  753. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  754. }
  755. }
  756. display.writeScreenBuffer(); // use default for white
  757. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, 0, 0, 200, 200, false, false, true);
  758. 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);
  759. display.refresh();
  760. delay(2000);
  761. }
  762. }
  763. #endif
  764. #ifdef _GxBitmaps3c104x212_H_
  765. void drawBitmaps3c104x212()
  766. {
  767. #if !defined(__AVR)
  768. bitmap_pair bitmap_pairs[] =
  769. {
  770. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  771. {Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  772. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  773. };
  774. #else
  775. bitmap_pair bitmap_pairs[] =
  776. {
  777. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  778. //{Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  779. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  780. };
  781. #endif
  782. if (display.epd2.panel == GxEPD2::GDEW0213Z16)
  783. {
  784. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  785. {
  786. display.firstPage();
  787. do
  788. {
  789. display.fillScreen(GxEPD_WHITE);
  790. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  791. if (bitmap_pairs[i].red == WS_Bitmap3c104x212_red)
  792. {
  793. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  794. }
  795. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  796. }
  797. while (display.nextPage());
  798. delay(2000);
  799. }
  800. }
  801. }
  802. #endif
  803. #ifdef _GxBitmaps3c128x296_H_
  804. void drawBitmaps3c128x296()
  805. {
  806. #if !defined(__AVR)
  807. bitmap_pair bitmap_pairs[] =
  808. {
  809. {Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  810. {Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  811. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  812. };
  813. #else
  814. bitmap_pair bitmap_pairs[] =
  815. {
  816. //{Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  817. //{Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  818. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  819. };
  820. #endif
  821. if (display.epd2.panel == GxEPD2::GDEW029Z10)
  822. {
  823. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  824. {
  825. display.firstPage();
  826. do
  827. {
  828. display.fillScreen(GxEPD_WHITE);
  829. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  830. if (bitmap_pairs[i].red == WS_Bitmap3c128x296_red)
  831. {
  832. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  833. }
  834. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  835. }
  836. while (display.nextPage());
  837. delay(2000);
  838. }
  839. }
  840. }
  841. #endif
  842. #ifdef _GxBitmaps3c176x264_H_
  843. void drawBitmaps3c176x264()
  844. {
  845. bitmap_pair bitmap_pairs[] =
  846. {
  847. {Bitmap3c176x264_black, Bitmap3c176x264_red}
  848. };
  849. if (display.epd2.panel == GxEPD2::GDEW027C44)
  850. {
  851. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  852. {
  853. display.firstPage();
  854. do
  855. {
  856. display.fillScreen(GxEPD_WHITE);
  857. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  858. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  859. }
  860. while (display.nextPage());
  861. delay(2000);
  862. }
  863. }
  864. }
  865. #endif
  866. #ifdef _GxBitmaps3c400x300_H_
  867. void drawBitmaps3c400x300()
  868. {
  869. #if !defined(__AVR)
  870. bitmap_pair bitmap_pairs[] =
  871. {
  872. {Bitmap3c400x300_1_black, Bitmap3c400x300_1_red},
  873. {Bitmap3c400x300_2_black, Bitmap3c400x300_2_red},
  874. {WS_Bitmap3c400x300_black, WS_Bitmap3c400x300_red}
  875. };
  876. #else
  877. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  878. #endif
  879. if (display.epd2.panel == GxEPD2::GDEW042Z15)
  880. {
  881. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  882. {
  883. display.firstPage();
  884. do
  885. {
  886. display.fillScreen(GxEPD_WHITE);
  887. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  888. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  889. }
  890. while (display.nextPage());
  891. delay(2000);
  892. }
  893. }
  894. }
  895. #endif