GxEPD2_PagedDisplayUsingCallback.ino 56 KB

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