GxEPD2_PagedDisplayUsingCallback.ino 58 KB

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