GxEPD2_Example.ino 32 KB

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