GxEPD2_PagedDisplayUsingCallback.ino 44 KB

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