GxEPD2_PagedDisplayUsingCallback.ino 55 KB

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