GxEPD2_Example.ino 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781
  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 4.7k 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));
  76. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  77. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  78. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  79. // can use only half buffer size
  80. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT / 2> display(GxEPD2_420c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  81. // can use only quarter buffer size
  82. //GxEPD2_3C < GxEPD2_583c, GxEPD2_583c::HEIGHT / 4 > display(GxEPD2_583c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  83. //GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display(GxEPD2_750c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  84. //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
  85. //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
  86. // 7-color e-paper
  87. //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)
  88. //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
  89. // grey levels parallel IF e-papers on Waveshare e-Paper IT8951 Driver HAT
  90. // HRDY -> 4, RST -> 2, CS -> SS(15), SCK -> SCK(14), MOSI -> MOSI(D7(13)), MISO -> MISO(D6(12)), GND -> GND, 5V -> 5V
  91. // note: 5V supply needs to be exact and strong; 5V pin of USB powered Wemos D1 mini doesn't work!
  92. //GxEPD2_BW<GxEPD2_it60, GxEPD2_it60::HEIGHT / 8> display(GxEPD2_it60(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 4));
  93. // ***** for mapping of Waveshare e-Paper ESP8266 Driver Board *****
  94. // select one , can use full buffer size (full HEIGHT)
  95. //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
  96. //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
  97. //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
  98. //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
  99. //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
  100. //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
  101. //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
  102. //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
  103. //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
  104. //GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  105. //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
  106. //GxEPD2_BW<GxEPD2_260, GxEPD2_260::HEIGHT> display(GxEPD2_260(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  107. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  108. //GxEPD2_BW<GxEPD2_371, GxEPD2_371::HEIGHT> display(GxEPD2_371(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  109. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  110. // can use only half buffer size
  111. //GxEPD2_BW < GxEPD2_583, GxEPD2_583::HEIGHT / 2 > display(GxEPD2_583(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  112. //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));
  113. //GxEPD2_BW < GxEPD2_750, GxEPD2_750::HEIGHT / 2 > display(GxEPD2_750(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  114. //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
  115. // 3-color e-papers
  116. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  117. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  118. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  119. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  120. // can use only half buffer size
  121. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT / 2> display(GxEPD2_420c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  122. // can use only quarter buffer size
  123. //GxEPD2_3C<GxEPD2_583c, GxEPD2_583c::HEIGHT / 4> display(GxEPD2_583c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  124. //GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display(GxEPD2_750c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  125. //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
  126. //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
  127. // 7-color e-paper
  128. //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
  129. #endif
  130. #if defined(ESP32)
  131. // select one and adapt to your mapping, can use full buffer size (full HEIGHT)
  132. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEP015OC1 no longer available
  133. //GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display(GxEPD2_154_D67(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0154D67
  134. //GxEPD2_BW<GxEPD2_154_T8, GxEPD2_154_T8::HEIGHT> display(GxEPD2_154_T8(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0154T8 152x152
  135. //GxEPD2_BW<GxEPD2_154_M09, GxEPD2_154_M09::HEIGHT> display(GxEPD2_154_M09(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0154M09 200x200
  136. //GxEPD2_BW<GxEPD2_154_M10, GxEPD2_154_M10::HEIGHT> display(GxEPD2_154_M10(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0154M10 152x152
  137. //GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display(GxEPD2_213(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDE0213B1, phased out
  138. //GxEPD2_BW<GxEPD2_213_B72, GxEPD2_213_B72::HEIGHT> display(GxEPD2_213_B72(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213B72
  139. //GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213B73
  140. //GxEPD2_BW<GxEPD2_213_flex, GxEPD2_213_flex::HEIGHT> display(GxEPD2_213_flex(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0213I5F
  141. //GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  142. //GxEPD2_BW<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW029T5
  143. //GxEPD2_BW<GxEPD2_260, GxEPD2_260::HEIGHT> display(GxEPD2_260(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  144. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  145. //GxEPD2_BW<GxEPD2_371, GxEPD2_371::HEIGHT> display(GxEPD2_371(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  146. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  147. //GxEPD2_BW<GxEPD2_583, GxEPD2_583::HEIGHT> display(GxEPD2_583(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  148. //GxEPD2_BW<GxEPD2_583_T8, GxEPD2_583_T8::HEIGHT> display(GxEPD2_583_T8(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  149. //GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display(GxEPD2_750(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  150. //GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075T7 800x480
  151. // 3-color e-papers
  152. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  153. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  154. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  155. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  156. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT> display(GxEPD2_420c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  157. //GxEPD2_3C<GxEPD2_583c, GxEPD2_583c::HEIGHT> display(GxEPD2_583c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  158. //GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT> display(GxEPD2_750c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  159. //GxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT> display(GxEPD2_750c_Z08(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075Z08 800x480
  160. //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
  161. // 7-color e-paper
  162. //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)
  163. //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
  164. // grey levels parallel IF e-papers on Waveshare e-Paper IT8951 Driver HAT
  165. // HRDY -> 4, RST -> 16, CS -> SS(5), SCK -> SCK(18), MOSI -> MOSI(23), MISO -> MISO(19), GND -> GND, 5V -> 5V
  166. // note: 5V supply needs to be exact and strong; 5V over diode from USB (e.g. Wemos D1 mini) doesn't work!
  167. //GxEPD2_BW<GxEPD2_it60, GxEPD2_it60::HEIGHT> display(GxEPD2_it60(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  168. // Waveshare 12.48 b/w SPI display board and frame or Good Display 12.48 b/w panel GDEW1248T3
  169. // general constructor for use with all parameters, e.g. for Waveshare ESP32 driver board mounted on connection board
  170. //GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 >
  171. //display(GxEPD2_1248(/*sck=*/ 13, /*miso=*/ 12, /*mosi=*/ 14, /*cs_m1=*/ 23, /*cs_s1=*/ 22, /*cs_m2=*/ 16, /*cs_s2=*/ 19,
  172. // /*dc1=*/ 25, /*dc2=*/ 17, /*rst1=*/ 33, /*rst2=*/ 5, /*busy_m1=*/ 32, /*busy_s1=*/ 26, /*busy_m2=*/ 18, /*busy_s2=*/ 4));
  173. #endif
  174. // can't use package "STMF1 Boards (STM32Duino.com)" (Roger Clark) anymore with Adafruit_GFX, use "STM32 Boards (selected from submenu)" (STMicroelectronics)
  175. #if defined(ARDUINO_ARCH_STM32)
  176. #define MAX_DISPLAY_BUFFER_SIZE 15000ul // ~15k is a good compromise
  177. #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))
  178. // select one and adapt to your mapping
  179. //GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEP015OC1 no longer available
  180. //GxEPD2_BW<GxEPD2_154_D67, MAX_HEIGHT(GxEPD2_154_D67)> display(GxEPD2_154_D67(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0154D67
  181. //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
  182. //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
  183. //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
  184. //GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDE0213B1, phased out
  185. //GxEPD2_BW<GxEPD2_213_B72, MAX_HEIGHT(GxEPD2_213_B72)> display(GxEPD2_213_B72(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B72
  186. //GxEPD2_BW<GxEPD2_213_B73, MAX_HEIGHT(GxEPD2_213_B73)> display(GxEPD2_213_B73(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B73
  187. //GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213I5F
  188. //GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  189. //GxEPD2_BW<GxEPD2_290_T5, MAX_HEIGHT(GxEPD2_290_T5)> display(GxEPD2_290_T5(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029T5
  190. //GxEPD2_BW<GxEPD2_260, MAX_HEIGHT(GxEPD2_260)> display(GxEPD2_260(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  191. //GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  192. //GxEPD2_BW<GxEPD2_371, MAX_HEIGHT(GxEPD2_371)> display(GxEPD2_371(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  193. //GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  194. //GxEPD2_BW<GxEPD2_583, MAX_HEIGHT(GxEPD2_583)> display(GxEPD2_583(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  195. //GxEPD2_BW <GxEPD2_583_T8, MAX_HEIGHT(GxEPD2_583_T8)> display(GxEPD2_583_T8(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  196. //GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  197. //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
  198. // 3-color e-papers
  199. #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))
  200. //GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT_3C(GxEPD2_154c)> display(GxEPD2_154c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  201. //GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  202. //GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  203. //GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT_3C(GxEPD2_270c)> display(GxEPD2_270c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  204. //GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT_3C(GxEPD2_420c)> display(GxEPD2_420c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  205. //GxEPD2_3C<GxEPD2_583c, MAX_HEIGHT_3C(GxEPD2_583c)> display(GxEPD2_583c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  206. //GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  207. //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
  208. //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
  209. // 7-color e-paper
  210. #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
  211. //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
  212. #endif
  213. #if defined(__AVR)
  214. #if defined (ARDUINO_AVR_MEGA2560)
  215. #define MAX_DISPLAY_BUFFER_SIZE 5000 // e.g. full height for 200x200
  216. #else
  217. #define MAX_DISPLAY_BUFFER_SIZE 800 //
  218. #endif
  219. #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))
  220. // select one and adapt to your mapping
  221. //GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEP015OC1 no longer available
  222. //GxEPD2_BW<GxEPD2_154_D67, MAX_HEIGHT(GxEPD2_154_D67)> display(GxEPD2_154_D67(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEH0154D67
  223. //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
  224. //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
  225. //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
  226. //GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDE0213B1, phased out
  227. //GxEPD2_BW<GxEPD2_213_B72, MAX_HEIGHT(GxEPD2_213_B72)> display(GxEPD2_213_B72(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEH0213B72
  228. //GxEPD2_BW<GxEPD2_213_B73, MAX_HEIGHT(GxEPD2_213_B73)> display(GxEPD2_213_B73(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEH0213B73
  229. //GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW0213I5F
  230. //GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  231. //GxEPD2_BW<GxEPD2_290_T5, MAX_HEIGHT(GxEPD2_290_T5)> display(GxEPD2_290_T5(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW029T5
  232. //GxEPD2_BW<GxEPD2_260, MAX_HEIGHT(GxEPD2_260)> display(GxEPD2_260(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  233. //GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  234. //GxEPD2_BW<GxEPD2_371, MAX_HEIGHT(GxEPD2_371)> display(GxEPD2_371(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  235. //GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  236. //GxEPD2_BW<GxEPD2_583, MAX_HEIGHT(GxEPD2_583)> display(GxEPD2_583(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  237. //GxEPD2_BW <GxEPD2_583_T8, MAX_HEIGHT(GxEPD2_583_T8)> display(GxEPD2_583_T8(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  238. //GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  239. //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
  240. // 3-color e-papers
  241. #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))
  242. //GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT_3C(GxEPD2_154c)> display(GxEPD2_154c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  243. //GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  244. //GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  245. //GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT_3C(GxEPD2_270c)> display(GxEPD2_270c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  246. //GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT_3C(GxEPD2_420c)> display(GxEPD2_420c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  247. //GxEPD2_3C<GxEPD2_583c, MAX_HEIGHT_3C(GxEPD2_583c)> display(GxEPD2_583c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  248. //GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  249. //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
  250. //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
  251. // 7-color e-paper
  252. #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
  253. //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
  254. // ***** for mapping of Waveshare Universal e-Paper Raw Panel Driver Shield for Arduino / NUCLEO *****
  255. // 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
  256. // 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
  257. // 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
  258. // 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?)
  259. // select one and adapt to your mapping
  260. //GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEP015OC1 no longer available
  261. //GxEPD2_BW<GxEPD2_154_D67, MAX_HEIGHT(GxEPD2_154_D67)> display(GxEPD2_154_D67(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEH0154D67
  262. //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
  263. //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
  264. //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
  265. //GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDE0213B1, phased out
  266. //GxEPD2_BW<GxEPD2_213_B72, MAX_HEIGHT(GxEPD2_213_B72)> display(GxEPD2_213_B72(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEH0213B72
  267. //GxEPD2_BW<GxEPD2_213_B73, MAX_HEIGHT(GxEPD2_213_B73)> display(GxEPD2_213_B73(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEH0213B73
  268. //GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW0213I5F
  269. //GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  270. //GxEPD2_BW<GxEPD2_290_T5, MAX_HEIGHT(GxEPD2_290_T5)> display(GxEPD2_290_T5(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW029T5
  271. //GxEPD2_BW<GxEPD2_260, MAX_HEIGHT(GxEPD2_260)> display(GxEPD2_260(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  272. //GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  273. //GxEPD2_BW<GxEPD2_371, MAX_HEIGHT(GxEPD2_371)> display(GxEPD2_371(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  274. //GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  275. //GxEPD2_BW<GxEPD2_583, MAX_HEIGHT(GxEPD2_583)> display(GxEPD2_583(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  276. //GxEPD2_BW <GxEPD2_583_T8, MAX_HEIGHT(GxEPD2_583_T8)> display(GxEPD2_583_T8(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  277. //GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  278. //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
  279. // 3-color e-papers
  280. #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))
  281. //GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT_3C(GxEPD2_154c)> display(GxEPD2_154c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  282. //GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  283. //GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  284. //GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT_3C(GxEPD2_270c)> display(GxEPD2_270c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  285. //GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT_3C(GxEPD2_420c)> display(GxEPD2_420c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  286. //GxEPD2_3C<GxEPD2_583c, MAX_HEIGHT_3C(GxEPD2_583c)> display(GxEPD2_583c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  287. //GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  288. //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
  289. //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
  290. // 7-color e-paper
  291. //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
  292. // Waveshare 12.48 b/w SPI display board and frame or Good Display 12.48 b/w panel GDEW1248T3
  293. // general constructor for use with standard SPI pins, default SCK, MISO and MOSI, for UNO on UNO connectors
  294. //GxEPD2_BW < GxEPD2_1248, MAX_HEIGHT(GxEPD2_1248)>
  295. //display(GxEPD2_1248(/*cs_m1=*/ 2, /*cs_s1=*/ 3, /*cs_m2=*/ A4, /*cs_s2=*/ A0, /*dc1=*/ 6, /*dc2=*/ A3, /*rst1=*/ 5, /*rst2=*/ A2,
  296. // /*busy_m1=*/ 4, /*busy_s1=*/ 7, /*busy_m2=*/ A1, /*busy_s2=*/ A5));
  297. #endif
  298. #include "GxEPD2_boards_added.h"
  299. //#include "GxEPD2_more_boards_added.h" // private
  300. #if !defined(__AVR) && !defined(_BOARD_GENERIC_STM32F103C_H_)
  301. // note 16.11.2019: the compiler may exclude code based on constant if statements (display.epd2.panel == constant),
  302. // therefore bitmaps may get optimized out by the linker
  303. // comment out unused bitmaps to reduce code space used
  304. #include "bitmaps/Bitmaps152x152.h" // 1.54" b/w
  305. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  306. #include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  307. #include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  308. #include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  309. #include "bitmaps/Bitmaps152x296.h" // 2.6" b/w
  310. #include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  311. #include "bitmaps/Bitmaps240x416.h" // 3.71" b/w
  312. #include "bitmaps/Bitmaps400x300.h" // 4.2" b/w
  313. #include "bitmaps/Bitmaps648x480.h" // 5.38" b/w
  314. #include "bitmaps/Bitmaps640x384.h" // 7.5" b/w
  315. #include "bitmaps/Bitmaps800x480.h" // 7.5" b/w
  316. // 3-color
  317. #include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  318. #include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  319. #include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  320. #include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  321. #include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r
  322. #if defined(ESP8266) || defined(ESP32)
  323. #include "bitmaps/Bitmaps3c800x480.h" // 7.5" b/w/r
  324. #include "bitmaps/Bitmaps3c880x528.h" // 7.5" b/w/r
  325. #include "bitmaps/WS_Bitmaps800x600.h" // 6.0" grey
  326. #include "bitmaps/WS_Bitmaps7c192x143.h" // 5.65" 7-color
  327. #endif
  328. #if defined(ESP32)
  329. #include "bitmaps/Bitmaps1304x984.h" // 12.48" b/w
  330. #endif
  331. #else
  332. // select only one to fit in code space
  333. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  334. //#include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  335. //#include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  336. //#include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  337. //#include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  338. ////#include "bitmaps/Bitmaps400x300.h" // 4.2" b/w // not enough code space
  339. ////#include "bitmaps/Bitmaps640x384.h" // 7.5" b/w // not enough code space
  340. // 3-color
  341. //#include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  342. //#include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  343. //#include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  344. //#include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  345. ////#include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r // not enough code space
  346. #endif
  347. void setup()
  348. {
  349. Serial.begin(115200);
  350. Serial.println();
  351. Serial.println("setup");
  352. delay(100);
  353. display.init(115200);
  354. // first update should be full refresh
  355. helloWorld();
  356. delay(1000);
  357. // partial refresh mode can be used to full screen,
  358. // effective if display panel hasFastPartialUpdate
  359. helloFullScreenPartialMode();
  360. delay(1000);
  361. helloArduino();
  362. delay(1000);
  363. helloEpaper();
  364. delay(1000);
  365. //helloValue(123.9, 1);
  366. //delay(1000);
  367. showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  368. delay(1000);
  369. drawBitmaps();
  370. #if !defined(__AVR) // takes too long!
  371. if (display.epd2.panel == GxEPD2::ACeP565)
  372. {
  373. //draw7colorlines();
  374. //delay(2000);
  375. draw7colors();
  376. delay(4000);
  377. }
  378. #endif
  379. if (display.epd2.hasPartialUpdate)
  380. {
  381. showPartialUpdate();
  382. delay(1000);
  383. } // else // on GDEW0154Z04 only full update available, doesn't look nice
  384. //drawCornerTest();
  385. //showBox(16, 16, 48, 32, false);
  386. //showBox(16, 56, 48, 32, true);
  387. display.powerOff();
  388. deepSleepTest();
  389. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  390. drawBitmaps1304x984();
  391. display.powerOff();
  392. #endif
  393. Serial.println("setup done");
  394. }
  395. void loop()
  396. {
  397. }
  398. // note for partial update window and setPartialWindow() method:
  399. // partial update window size and position is on byte boundary in physical x direction
  400. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  401. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  402. const char HelloWorld[] = "Hello World!";
  403. const char HelloArduino[] = "Hello Arduino!";
  404. const char HelloEpaper[] = "Hello E-Paper!";
  405. void helloWorld()
  406. {
  407. //Serial.println("helloWorld");
  408. display.setRotation(1);
  409. display.setFont(&FreeMonoBold9pt7b);
  410. display.setTextColor(GxEPD_BLACK);
  411. int16_t tbx, tby; uint16_t tbw, tbh;
  412. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  413. // center bounding box by transposition of origin:
  414. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  415. uint16_t y = ((display.height() - tbh) / 2) - tby;
  416. display.setFullWindow();
  417. display.firstPage();
  418. do
  419. {
  420. display.fillScreen(GxEPD_WHITE);
  421. display.setCursor(x, y);
  422. display.print(HelloWorld);
  423. }
  424. while (display.nextPage());
  425. //Serial.println("helloWorld done");
  426. }
  427. void helloWorldForDummies()
  428. {
  429. //Serial.println("helloWorld");
  430. const char text[] = "Hello World!";
  431. // most e-papers have width < height (portrait) as native orientation, especially the small ones
  432. // in GxEPD2 rotation 0 is used for native orientation (most TFT libraries use 0 fix for portrait orientation)
  433. // set rotation to 1 (rotate right 90 degrees) to have enough space on small displays (landscape)
  434. display.setRotation(1);
  435. // select a suitable font in Adafruit_GFX
  436. display.setFont(&FreeMonoBold9pt7b);
  437. // on e-papers black on white is more pleasant to read
  438. display.setTextColor(GxEPD_BLACK);
  439. // Adafruit_GFX has a handy method getTextBounds() to determine the boundary box for a text for the actual font
  440. int16_t tbx, tby; uint16_t tbw, tbh; // boundary box window
  441. display.getTextBounds(text, 0, 0, &tbx, &tby, &tbw, &tbh); // it works for origin 0, 0, fortunately (negative tby!)
  442. // center bounding box by transposition of origin:
  443. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  444. uint16_t y = ((display.height() - tbh) / 2) - tby;
  445. // full window mode is the initial mode, set it anyway
  446. display.setFullWindow();
  447. // here we use paged drawing, even if the processor has enough RAM for full buffer
  448. // so this can be used with any supported processor board.
  449. // the cost in code overhead and execution time penalty is marginal
  450. // tell the graphics class to use paged drawing mode
  451. display.firstPage();
  452. do
  453. {
  454. // this part of code is executed multiple times, as many as needed,
  455. // in case of full buffer it is executed once
  456. // IMPORTANT: each iteration needs to draw the same, to avoid strange effects
  457. // use a copy of values that might change, don't read e.g. from analog or pins in the loop!
  458. display.fillScreen(GxEPD_WHITE); // set the background to white (fill the buffer with value for white)
  459. display.setCursor(x, y); // set the postition to start printing text
  460. display.print(text); // print some text
  461. // end of part executed multiple times
  462. }
  463. // tell the graphics class to transfer the buffer content (page) to the controller buffer
  464. // the graphics class will command the controller to refresh to the screen when the last page has been transferred
  465. // returns true if more pages need be drawn and transferred
  466. // returns false if the last page has been transferred and the screen refreshed for panels without fast partial update
  467. // returns false for panels with fast partial update when the controller buffer has been written once more, to make the differential buffers equal
  468. // (for full buffered with fast partial update the (full) buffer is just transferred again, and false returned)
  469. while (display.nextPage());
  470. //Serial.println("helloWorld done");
  471. }
  472. void helloFullScreenPartialMode()
  473. {
  474. //Serial.println("helloFullScreenPartialMode");
  475. const char fullscreen[] = "full screen update";
  476. const char fpm[] = "fast partial mode";
  477. const char spm[] = "slow partial mode";
  478. const char npm[] = "no partial mode";
  479. display.setPartialWindow(0, 0, display.width(), display.height());
  480. display.setRotation(1);
  481. display.setFont(&FreeMonoBold9pt7b);
  482. display.setTextColor(GxEPD_BLACK);
  483. const char* updatemode;
  484. if (display.epd2.hasFastPartialUpdate)
  485. {
  486. updatemode = fpm;
  487. }
  488. else if (display.epd2.hasPartialUpdate)
  489. {
  490. updatemode = spm;
  491. }
  492. else
  493. {
  494. updatemode = npm;
  495. }
  496. // do this outside of the loop
  497. int16_t tbx, tby; uint16_t tbw, tbh;
  498. // center update text
  499. display.getTextBounds(fullscreen, 0, 0, &tbx, &tby, &tbw, &tbh);
  500. uint16_t utx = ((display.width() - tbw) / 2) - tbx;
  501. uint16_t uty = ((display.height() / 4) - tbh / 2) - tby;
  502. // center update mode
  503. display.getTextBounds(updatemode, 0, 0, &tbx, &tby, &tbw, &tbh);
  504. uint16_t umx = ((display.width() - tbw) / 2) - tbx;
  505. uint16_t umy = ((display.height() * 3 / 4) - tbh / 2) - tby;
  506. // center HelloWorld
  507. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  508. uint16_t hwx = ((display.width() - tbw) / 2) - tbx;
  509. uint16_t hwy = ((display.height() - tbh) / 2) - tby;
  510. display.firstPage();
  511. do
  512. {
  513. display.fillScreen(GxEPD_WHITE);
  514. display.setCursor(hwx, hwy);
  515. display.print(HelloWorld);
  516. display.setCursor(utx, uty);
  517. display.print(fullscreen);
  518. display.setCursor(umx, umy);
  519. display.print(updatemode);
  520. }
  521. while (display.nextPage());
  522. //Serial.println("helloFullScreenPartialMode done");
  523. }
  524. void helloArduino()
  525. {
  526. //Serial.println("helloArduino");
  527. display.setRotation(1);
  528. display.setFont(&FreeMonoBold9pt7b);
  529. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  530. int16_t tbx, tby; uint16_t tbw, tbh;
  531. // align with centered HelloWorld
  532. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  533. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  534. // height might be different
  535. display.getTextBounds(HelloArduino, 0, 0, &tbx, &tby, &tbw, &tbh);
  536. uint16_t y = ((display.height() / 4) - tbh / 2) - tby; // y is base line!
  537. // make the window big enough to cover (overwrite) descenders of previous text
  538. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  539. uint16_t wy = (display.height() / 4) - wh / 2;
  540. display.setPartialWindow(0, wy, display.width(), wh);
  541. display.firstPage();
  542. do
  543. {
  544. display.fillScreen(GxEPD_WHITE);
  545. //display.drawRect(x, y - tbh, tbw, tbh, GxEPD_BLACK);
  546. display.setCursor(x, y);
  547. display.print(HelloArduino);
  548. }
  549. while (display.nextPage());
  550. delay(1000);
  551. //Serial.println("helloArduino done");
  552. }
  553. void helloEpaper()
  554. {
  555. //Serial.println("helloEpaper");
  556. display.setRotation(1);
  557. display.setFont(&FreeMonoBold9pt7b);
  558. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  559. int16_t tbx, tby; uint16_t tbw, tbh;
  560. // align with centered HelloWorld
  561. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  562. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  563. // height might be different
  564. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  565. uint16_t y = (display.height() * 3 / 4) + tbh / 2; // y is base line!
  566. // make the window big enough to cover (overwrite) descenders of previous text
  567. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  568. uint16_t wy = (display.height() * 3 / 4) - wh / 2;
  569. display.setPartialWindow(0, wy, display.width(), wh);
  570. display.firstPage();
  571. do
  572. {
  573. display.fillScreen(GxEPD_WHITE);
  574. display.setCursor(x, y);
  575. display.print(HelloEpaper);
  576. }
  577. while (display.nextPage());
  578. //Serial.println("helloEpaper done");
  579. }
  580. #if defined(ESP8266) || defined(ESP32)
  581. #include <StreamString.h>
  582. #define PrintString StreamString
  583. #else
  584. class PrintString : public Print, public String
  585. {
  586. public:
  587. size_t write(uint8_t data) override
  588. {
  589. return concat(char(data));
  590. };
  591. };
  592. #endif
  593. void helloValue(double v, int digits)
  594. {
  595. //Serial.println("helloValue");
  596. display.setRotation(1);
  597. display.setFont(&FreeMonoBold9pt7b);
  598. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  599. PrintString valueString;
  600. valueString.print(v, digits);
  601. int16_t tbx, tby; uint16_t tbw, tbh;
  602. display.getTextBounds(valueString, 0, 0, &tbx, &tby, &tbw, &tbh);
  603. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  604. uint16_t y = (display.height() * 3 / 4) + tbh / 2; // y is base line!
  605. // show what happens, if we use the bounding box for partial window
  606. uint16_t wx = (display.width() - tbw) / 2;
  607. uint16_t wy = (display.height() * 3 / 4) - tbh / 2;
  608. display.setPartialWindow(wx, wy, tbw, tbh);
  609. display.firstPage();
  610. do
  611. {
  612. display.fillScreen(GxEPD_WHITE);
  613. display.setCursor(x, y);
  614. display.print(valueString);
  615. }
  616. while (display.nextPage());
  617. delay(2000);
  618. // make the partial window big enough to cover the previous text
  619. uint16_t ww = tbw; // remember window width
  620. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  621. // adjust, because HelloEpaper was aligned, not centered (could calculate this to be precise)
  622. ww = max(ww, uint16_t(tbw + 12)); // 12 seems ok
  623. wx = (display.width() - tbw) / 2;
  624. // make the window big enough to cover (overwrite) descenders of previous text
  625. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  626. wy = (display.height() * 3 / 4) - wh / 2;
  627. display.setPartialWindow(wx, wy, ww, wh);
  628. // alternately use the whole width for partial window
  629. //display.setPartialWindow(0, wy, display.width(), wh);
  630. display.firstPage();
  631. do
  632. {
  633. display.fillScreen(GxEPD_WHITE);
  634. display.setCursor(x, y);
  635. display.print(valueString);
  636. }
  637. while (display.nextPage());
  638. //Serial.println("helloValue done");
  639. }
  640. void deepSleepTest()
  641. {
  642. //Serial.println("deepSleepTest");
  643. const char hibernating[] = "hibernating ...";
  644. const char wokeup[] = "woke up";
  645. const char from[] = "from deep sleep";
  646. const char again[] = "again";
  647. display.setRotation(1);
  648. display.setFont(&FreeMonoBold9pt7b);
  649. display.setTextColor(GxEPD_BLACK);
  650. int16_t tbx, tby; uint16_t tbw, tbh;
  651. // center text
  652. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  653. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  654. uint16_t y = ((display.height() - tbh) / 2) - tby;
  655. display.setFullWindow();
  656. display.firstPage();
  657. do
  658. {
  659. display.fillScreen(GxEPD_WHITE);
  660. display.setCursor(x, y);
  661. display.print(hibernating);
  662. }
  663. while (display.nextPage());
  664. display.hibernate();
  665. delay(5000);
  666. display.getTextBounds(wokeup, 0, 0, &tbx, &tby, &tbw, &tbh);
  667. uint16_t wx = (display.width() - tbw) / 2;
  668. uint16_t wy = (display.height() / 3) + tbh / 2; // y is base line!
  669. display.getTextBounds(from, 0, 0, &tbx, &tby, &tbw, &tbh);
  670. uint16_t fx = (display.width() - tbw) / 2;
  671. uint16_t fy = (display.height() * 2 / 3) + tbh / 2; // y is base line!
  672. display.firstPage();
  673. do
  674. {
  675. display.fillScreen(GxEPD_WHITE);
  676. display.setCursor(wx, wy);
  677. display.print(wokeup);
  678. display.setCursor(fx, fy);
  679. display.print(from);
  680. }
  681. while (display.nextPage());
  682. delay(5000);
  683. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  684. uint16_t hx = (display.width() - tbw) / 2;
  685. uint16_t hy = (display.height() / 3) + tbh / 2; // y is base line!
  686. display.getTextBounds(again, 0, 0, &tbx, &tby, &tbw, &tbh);
  687. uint16_t ax = (display.width() - tbw) / 2;
  688. uint16_t ay = (display.height() * 2 / 3) + tbh / 2; // y is base line!
  689. display.firstPage();
  690. do
  691. {
  692. display.fillScreen(GxEPD_WHITE);
  693. display.setCursor(hx, hy);
  694. display.print(hibernating);
  695. display.setCursor(ax, ay);
  696. display.print(again);
  697. }
  698. while (display.nextPage());
  699. display.hibernate();
  700. //Serial.println("deepSleepTest done");
  701. }
  702. void showBox(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
  703. {
  704. //Serial.println("showBox");
  705. display.setRotation(1);
  706. if (partial)
  707. {
  708. display.setPartialWindow(x, y, w, h);
  709. }
  710. else
  711. {
  712. display.setFullWindow();
  713. }
  714. display.firstPage();
  715. do
  716. {
  717. display.fillScreen(GxEPD_WHITE);
  718. display.fillRect(x, y, w, h, GxEPD_BLACK);
  719. }
  720. while (display.nextPage());
  721. //Serial.println("showBox done");
  722. }
  723. void drawCornerTest()
  724. {
  725. display.setFullWindow();
  726. display.setFont(&FreeMonoBold9pt7b);
  727. display.setTextColor(GxEPD_BLACK);
  728. for (uint16_t r = 0; r <= 4; r++)
  729. {
  730. display.setRotation(r);
  731. display.firstPage();
  732. do
  733. {
  734. display.fillScreen(GxEPD_WHITE);
  735. display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
  736. display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
  737. display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
  738. display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
  739. display.setCursor(display.width() / 2, display.height() / 2);
  740. display.print(display.getRotation());
  741. }
  742. while (display.nextPage());
  743. delay(2000);
  744. }
  745. }
  746. void showFont(const char name[], const GFXfont* f)
  747. {
  748. display.setFullWindow();
  749. display.setRotation(0);
  750. display.setTextColor(GxEPD_BLACK);
  751. display.firstPage();
  752. do
  753. {
  754. drawFont(name, f);
  755. }
  756. while (display.nextPage());
  757. }
  758. void drawFont(const char name[], const GFXfont* f)
  759. {
  760. //display.setRotation(0);
  761. display.fillScreen(GxEPD_WHITE);
  762. display.setTextColor(GxEPD_BLACK);
  763. display.setFont(f);
  764. display.setCursor(0, 0);
  765. display.println();
  766. display.println(name);
  767. display.println(" !\"#$%&'()*+,-./");
  768. display.println("0123456789:;<=>?");
  769. display.println("@ABCDEFGHIJKLMNO");
  770. display.println("PQRSTUVWXYZ[\\]^_");
  771. if (display.epd2.hasColor)
  772. {
  773. display.setTextColor(GxEPD_RED);
  774. }
  775. display.println("`abcdefghijklmno");
  776. display.println("pqrstuvwxyz{|}~ ");
  777. }
  778. // note for partial update window and setPartialWindow() method:
  779. // partial update window size and position is on byte boundary in physical x direction
  780. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  781. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  782. // showPartialUpdate() purposely uses values that are not multiples of 8 to test this
  783. void showPartialUpdate()
  784. {
  785. // some useful background
  786. helloWorld();
  787. // use asymmetric values for test
  788. uint16_t box_x = 10;
  789. uint16_t box_y = 15;
  790. uint16_t box_w = 70;
  791. uint16_t box_h = 20;
  792. uint16_t cursor_y = box_y + box_h - 6;
  793. float value = 13.95;
  794. uint16_t incr = display.epd2.hasFastPartialUpdate ? 1 : 3;
  795. display.setFont(&FreeMonoBold9pt7b);
  796. display.setTextColor(GxEPD_BLACK);
  797. // show where the update box is
  798. for (uint16_t r = 0; r < 4; r++)
  799. {
  800. display.setRotation(r);
  801. display.setPartialWindow(box_x, box_y, box_w, box_h);
  802. display.firstPage();
  803. do
  804. {
  805. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  806. //display.fillScreen(GxEPD_BLACK);
  807. }
  808. while (display.nextPage());
  809. delay(2000);
  810. display.firstPage();
  811. do
  812. {
  813. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  814. }
  815. while (display.nextPage());
  816. delay(1000);
  817. }
  818. //return;
  819. // show updates in the update box
  820. for (uint16_t r = 0; r < 4; r++)
  821. {
  822. display.setRotation(r);
  823. display.setPartialWindow(box_x, box_y, box_w, box_h);
  824. for (uint16_t i = 1; i <= 10; i += incr)
  825. {
  826. display.firstPage();
  827. do
  828. {
  829. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  830. display.setCursor(box_x, cursor_y);
  831. display.print(value * i, 2);
  832. }
  833. while (display.nextPage());
  834. delay(500);
  835. }
  836. delay(1000);
  837. display.firstPage();
  838. do
  839. {
  840. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  841. }
  842. while (display.nextPage());
  843. delay(1000);
  844. }
  845. }
  846. void drawBitmaps()
  847. {
  848. display.setFullWindow();
  849. #ifdef _GxBitmaps152x152_H_
  850. drawBitmaps152x152();
  851. #endif
  852. #ifdef _GxBitmaps104x212_H_
  853. drawBitmaps104x212();
  854. #endif
  855. #ifdef _GxBitmaps128x250_H_
  856. drawBitmaps128x250();
  857. #endif
  858. #ifdef _GxBitmaps128x296_H_
  859. drawBitmaps128x296();
  860. #endif
  861. #ifdef _GxBitmaps176x264_H_
  862. drawBitmaps176x264();
  863. #endif
  864. #ifdef _GxBitmaps400x300_H_
  865. drawBitmaps400x300();
  866. #endif
  867. #ifdef _GxBitmaps640x384_H_
  868. drawBitmaps640x384();
  869. #endif
  870. #ifdef _GxBitmaps648x480_H_
  871. drawBitmaps648x480();
  872. #endif
  873. #ifdef _GxBitmaps800x480_H_
  874. drawBitmaps800x480();
  875. #endif
  876. #ifdef _WS_Bitmaps800x600_H_
  877. drawBitmaps800x600();
  878. #endif
  879. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  880. drawBitmaps1304x984();
  881. #endif
  882. // 3-color
  883. #ifdef _GxBitmaps3c104x212_H_
  884. drawBitmaps3c104x212();
  885. #endif
  886. #ifdef _GxBitmaps3c128x296_H_
  887. drawBitmaps3c128x296();
  888. #endif
  889. #ifdef _GxBitmaps152x296_H_
  890. drawBitmaps152x296();
  891. #endif
  892. #ifdef _GxBitmaps3c176x264_H_
  893. drawBitmaps3c176x264();
  894. #endif
  895. #ifdef _GxBitmaps240x416_H_
  896. drawBitmaps240x416();
  897. #endif
  898. #ifdef _GxBitmaps3c400x300_H_
  899. drawBitmaps3c400x300();
  900. #endif
  901. #ifdef _GxBitmaps3c800x480_H_
  902. drawBitmaps3c800x480();
  903. #endif
  904. #ifdef _GxBitmaps3c880x528_H_
  905. drawBitmaps3c880x528();
  906. #endif
  907. #if defined(_WS_Bitmaps7c192x143_H_)
  908. drawBitmaps7c192x143();
  909. #endif
  910. if ((display.epd2.WIDTH >= 200) && (display.epd2.HEIGHT >= 200))
  911. {
  912. // show these after the specific bitmaps
  913. #ifdef _GxBitmaps200x200_H_
  914. drawBitmaps200x200();
  915. #endif
  916. // 3-color
  917. #ifdef _GxBitmaps3c200x200_H_
  918. drawBitmaps3c200x200();
  919. #endif
  920. }
  921. }
  922. #ifdef _GxBitmaps152x152_H_
  923. void drawBitmaps152x152()
  924. {
  925. #if !defined(__AVR)
  926. const unsigned char* bitmaps[] =
  927. {
  928. Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
  929. };
  930. #else
  931. const unsigned char* bitmaps[] =
  932. {
  933. Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
  934. };
  935. #endif
  936. if ((display.epd2.WIDTH == 152) && (display.epd2.HEIGHT == 152))
  937. {
  938. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  939. {
  940. display.firstPage();
  941. do
  942. {
  943. display.fillScreen(GxEPD_WHITE);
  944. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  945. }
  946. while (display.nextPage());
  947. delay(2000);
  948. }
  949. }
  950. }
  951. #endif
  952. #ifdef _GxBitmaps200x200_H_
  953. void drawBitmaps200x200()
  954. {
  955. #if defined(ARDUINO_AVR_PRO)
  956. const unsigned char* bitmaps[] =
  957. {
  958. logo200x200
  959. };
  960. #elif defined(__AVR)
  961. const unsigned char* bitmaps[] =
  962. {
  963. logo200x200, //first200x200
  964. };
  965. #elif defined(_BOARD_GENERIC_STM32F103C_H_) || defined(STM32F1xx)
  966. const unsigned char* bitmaps[] =
  967. {
  968. logo200x200, first200x200, second200x200, third200x200, //fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  969. };
  970. #else
  971. const unsigned char* bitmaps[] =
  972. {
  973. logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  974. };
  975. #endif
  976. if ((display.epd2.WIDTH == 200) && (display.epd2.HEIGHT == 200) && !display.epd2.hasColor)
  977. {
  978. bool m = display.mirror(true);
  979. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  980. {
  981. display.firstPage();
  982. do
  983. {
  984. display.fillScreen(GxEPD_WHITE);
  985. display.drawInvertedBitmap(0, 0, bitmaps[i], 200, 200, GxEPD_BLACK);
  986. }
  987. while (display.nextPage());
  988. delay(2000);
  989. }
  990. display.mirror(m);
  991. }
  992. //else
  993. {
  994. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  995. display.clearScreen(); // use default for white
  996. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  997. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  998. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  999. {
  1000. display.drawImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1001. delay(2000);
  1002. }
  1003. }
  1004. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  1005. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1006. {
  1007. int16_t x = -60;
  1008. int16_t y = -60;
  1009. for (uint16_t j = 0; j < 10; j++)
  1010. {
  1011. display.writeScreenBuffer(); // use default for white
  1012. display.writeImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1013. display.refresh(true);
  1014. if (display.epd2.hasFastPartialUpdate)
  1015. {
  1016. // for differential update: set previous buffer equal to current buffer in controller
  1017. display.epd2.writeScreenBufferAgain(); // use default for white
  1018. display.epd2.writeImageAgain(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1019. }
  1020. delay(2000);
  1021. x += display.epd2.WIDTH / 4;
  1022. y += display.epd2.HEIGHT / 4;
  1023. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  1024. }
  1025. if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
  1026. break; // comment out for full show
  1027. }
  1028. display.writeScreenBuffer(); // use default for white
  1029. display.writeImage(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  1030. display.writeImage(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
  1031. display.refresh(true);
  1032. // for differential update: set previous buffer equal to current buffer in controller
  1033. display.epd2.writeScreenBufferAgain(); // use default for white
  1034. display.epd2.writeImageAgain(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  1035. display.epd2.writeImageAgain(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
  1036. delay(2000);
  1037. }
  1038. #endif
  1039. #ifdef _GxBitmaps104x212_H_
  1040. void drawBitmaps104x212()
  1041. {
  1042. #if !defined(__AVR)
  1043. const unsigned char* bitmaps[] =
  1044. {
  1045. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  1046. };
  1047. #else
  1048. const unsigned char* bitmaps[] =
  1049. {
  1050. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  1051. };
  1052. #endif
  1053. if (display.epd2.panel == GxEPD2::GDEW0213I5F)
  1054. {
  1055. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1056. {
  1057. display.firstPage();
  1058. do
  1059. {
  1060. display.fillScreen(GxEPD_WHITE);
  1061. display.drawBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1062. }
  1063. while (display.nextPage());
  1064. delay(2000);
  1065. }
  1066. }
  1067. }
  1068. #endif
  1069. #ifdef _GxBitmaps128x250_H_
  1070. void drawBitmaps128x250()
  1071. {
  1072. #if !defined(__AVR)
  1073. const unsigned char* bitmaps[] =
  1074. {
  1075. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  1076. };
  1077. #else
  1078. const unsigned char* bitmaps[] =
  1079. {
  1080. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  1081. };
  1082. #endif
  1083. if ((display.epd2.panel == GxEPD2::GDE0213B1) || (display.epd2.panel == GxEPD2::GDEH0213B72))
  1084. {
  1085. bool m = display.mirror(true);
  1086. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1087. {
  1088. display.firstPage();
  1089. do
  1090. {
  1091. display.fillScreen(GxEPD_WHITE);
  1092. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1093. }
  1094. while (display.nextPage());
  1095. delay(2000);
  1096. }
  1097. display.mirror(m);
  1098. }
  1099. }
  1100. #endif
  1101. #ifdef _GxBitmaps128x296_H_
  1102. void drawBitmaps128x296()
  1103. {
  1104. #if !defined(__AVR)
  1105. const unsigned char* bitmaps[] =
  1106. {
  1107. Bitmap128x296_1, logo128x296, first128x296, second128x296, third128x296
  1108. };
  1109. #else
  1110. const unsigned char* bitmaps[] =
  1111. {
  1112. Bitmap128x296_1, logo128x296 //, first128x296, second128x296, third128x296
  1113. };
  1114. #endif
  1115. if (display.epd2.panel == GxEPD2::GDEH029A1)
  1116. {
  1117. bool m = display.mirror(true);
  1118. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1119. {
  1120. display.firstPage();
  1121. do
  1122. {
  1123. display.fillScreen(GxEPD_WHITE);
  1124. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1125. }
  1126. while (display.nextPage());
  1127. delay(2000);
  1128. }
  1129. display.mirror(m);
  1130. }
  1131. }
  1132. #endif
  1133. #ifdef _GxBitmaps152x296_H_
  1134. void drawBitmaps152x296()
  1135. {
  1136. #if !defined(__AVR)
  1137. const unsigned char* bitmaps[] =
  1138. {
  1139. Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
  1140. };
  1141. #else
  1142. const unsigned char* bitmaps[] =
  1143. {
  1144. Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
  1145. };
  1146. #endif
  1147. if (display.epd2.panel == GxEPD2::GDEW026T0)
  1148. {
  1149. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1150. {
  1151. display.firstPage();
  1152. do
  1153. {
  1154. display.fillScreen(GxEPD_WHITE);
  1155. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1156. }
  1157. while (display.nextPage());
  1158. delay(2000);
  1159. }
  1160. }
  1161. }
  1162. #endif
  1163. #ifdef _GxBitmaps176x264_H_
  1164. void drawBitmaps176x264()
  1165. {
  1166. #if !defined(__AVR)
  1167. const unsigned char* bitmaps[] =
  1168. {
  1169. Bitmap176x264_1, Bitmap176x264_2, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  1170. };
  1171. #else
  1172. const unsigned char* bitmaps[] =
  1173. {
  1174. Bitmap176x264_1, Bitmap176x264_2 //, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  1175. };
  1176. #endif
  1177. if (display.epd2.panel == GxEPD2::GDEW027W3)
  1178. {
  1179. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1180. {
  1181. display.firstPage();
  1182. do
  1183. {
  1184. display.fillScreen(GxEPD_WHITE);
  1185. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1186. }
  1187. while (display.nextPage());
  1188. delay(2000);
  1189. }
  1190. }
  1191. }
  1192. #endif
  1193. #ifdef _GxBitmaps240x416_H_
  1194. void drawBitmaps240x416()
  1195. {
  1196. #if !defined(__AVR)
  1197. const unsigned char* bitmaps[] =
  1198. {
  1199. Bitmap240x416_1, Bitmap240x416_2, Bitmap240x416_3
  1200. };
  1201. #else
  1202. const unsigned char* bitmaps[] =
  1203. {
  1204. Bitmap240x460_1, Bitmap240x460_2, Bitmap240x460_3
  1205. };
  1206. #endif
  1207. if (display.epd2.panel == GxEPD2::GDEW0371W7)
  1208. {
  1209. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1210. {
  1211. display.firstPage();
  1212. do
  1213. {
  1214. display.fillScreen(GxEPD_WHITE);
  1215. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1216. }
  1217. while (display.nextPage());
  1218. delay(2000);
  1219. }
  1220. }
  1221. }
  1222. #endif
  1223. #ifdef _GxBitmaps400x300_H_
  1224. void drawBitmaps400x300()
  1225. {
  1226. #if !defined(__AVR)
  1227. const unsigned char* bitmaps[] =
  1228. {
  1229. Bitmap400x300_1, Bitmap400x300_2
  1230. };
  1231. #else
  1232. const unsigned char* bitmaps[] = {}; // not enough code space
  1233. #endif
  1234. if (display.epd2.panel == GxEPD2::GDEW042T2)
  1235. {
  1236. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1237. {
  1238. display.firstPage();
  1239. do
  1240. {
  1241. display.fillScreen(GxEPD_WHITE);
  1242. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1243. }
  1244. while (display.nextPage());
  1245. delay(2000);
  1246. }
  1247. }
  1248. }
  1249. #endif
  1250. #ifdef _GxBitmaps640x384_H_
  1251. void drawBitmaps640x384()
  1252. {
  1253. #if !defined(__AVR)
  1254. const unsigned char* bitmaps[] =
  1255. {
  1256. Bitmap640x384_1, Bitmap640x384_2
  1257. };
  1258. #else
  1259. const unsigned char* bitmaps[] = {}; // not enough code space
  1260. #endif
  1261. if ((display.epd2.panel == GxEPD2::GDEW075T8) || (display.epd2.panel == GxEPD2::GDEW075Z09))
  1262. {
  1263. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1264. {
  1265. display.firstPage();
  1266. do
  1267. {
  1268. display.fillScreen(GxEPD_WHITE);
  1269. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1270. }
  1271. while (display.nextPage());
  1272. delay(2000);
  1273. }
  1274. }
  1275. }
  1276. #endif
  1277. #ifdef _GxBitmaps648x480_H_
  1278. void drawBitmaps648x480()
  1279. {
  1280. #if !defined(__AVR)
  1281. const unsigned char* bitmaps[] =
  1282. {
  1283. Bitmap648x480_1, Bitmap648x480_2, Bitmap648x480_3
  1284. };
  1285. #else
  1286. const unsigned char* bitmaps[] = {}; // not enough code space
  1287. #endif
  1288. if (display.epd2.panel == GxEPD2::GDEW0583T8)
  1289. {
  1290. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1291. {
  1292. display.firstPage();
  1293. do
  1294. {
  1295. display.fillScreen(GxEPD_WHITE);
  1296. display.drawBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1297. }
  1298. while (display.nextPage());
  1299. delay(2000);
  1300. }
  1301. }
  1302. }
  1303. #endif
  1304. #ifdef _GxBitmaps800x480_H_
  1305. void drawBitmaps800x480()
  1306. {
  1307. #if !defined(__AVR)
  1308. const unsigned char* bitmaps[] =
  1309. {
  1310. Bitmap800x480_1, Bitmap800x480_2, Bitmap800x480_3, Bitmap800x480_4
  1311. };
  1312. #else
  1313. const unsigned char* bitmaps[] = {}; // not enough code space
  1314. #endif
  1315. if ((display.epd2.panel == GxEPD2::GDEW075T7) || (display.epd2.panel == GxEPD2::GDEW075Z08))
  1316. {
  1317. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1318. {
  1319. display.firstPage();
  1320. do
  1321. {
  1322. display.fillScreen(GxEPD_WHITE);
  1323. //display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1324. display.drawBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1325. }
  1326. while (display.nextPage());
  1327. delay(2000);
  1328. }
  1329. if (display.epd2.panel == GxEPD2::GDEW075T7)
  1330. {
  1331. // avoid ghosting caused by OTP waveform
  1332. display.clearScreen();
  1333. display.refresh(false); // full update
  1334. }
  1335. }
  1336. }
  1337. #endif
  1338. #ifdef _WS_Bitmaps800x600_H_
  1339. void drawBitmaps800x600()
  1340. {
  1341. #if defined(ESP8266) || defined(ESP32)
  1342. if (display.epd2.panel == GxEPD2::ED060SCT)
  1343. {
  1344. // Serial.print("sizeof(WS_zoo_800x600) is "); Serial.println(sizeof(WS_zoo_800x600));
  1345. display.drawNative(WS_zoo_800x600, 0, 0, 0, 800, 600, false, false, true);
  1346. delay(2000);
  1347. // Serial.print("sizeof(WS_pic_1200x825) is "); Serial.println(sizeof(WS_pic_1200x825));
  1348. // display.drawNative((const uint8_t*)WS_pic_1200x825, 0, 0, 0, 1200, 825, false, false, true);
  1349. // delay(2000);
  1350. // Serial.print("sizeof(WS_acaa_1024x731) is "); Serial.println(sizeof(WS_acaa_1024x731));
  1351. // display.drawNative(WS_acaa_1024x731, 0, 0, 0, 1024, 731, false, false, true);
  1352. // delay(2000);
  1353. }
  1354. #endif
  1355. }
  1356. #endif
  1357. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  1358. void drawBitmaps1304x984()
  1359. {
  1360. if (display.epd2.panel == GxEPD2::GDEW1248T3)
  1361. {
  1362. display.drawImage(Bitmap1304x984, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1363. }
  1364. }
  1365. #endif
  1366. struct bitmap_pair
  1367. {
  1368. const unsigned char* black;
  1369. const unsigned char* red;
  1370. };
  1371. #ifdef _GxBitmaps3c200x200_H_
  1372. void drawBitmaps3c200x200()
  1373. {
  1374. bitmap_pair bitmap_pairs[] =
  1375. {
  1376. //{Bitmap3c200x200_black, Bitmap3c200x200_red},
  1377. {WS_Bitmap3c200x200_black, WS_Bitmap3c200x200_red}
  1378. };
  1379. if (display.epd2.panel == GxEPD2::GDEW0154Z04)
  1380. {
  1381. display.firstPage();
  1382. do
  1383. {
  1384. display.fillScreen(GxEPD_WHITE);
  1385. // Bitmap3c200x200_black has 2 bits per pixel
  1386. // taken from Adafruit_GFX.cpp, modified
  1387. int16_t byteWidth = (display.epd2.WIDTH + 7) / 8; // Bitmap scanline pad = whole byte
  1388. uint8_t byte = 0;
  1389. for (int16_t j = 0; j < display.epd2.HEIGHT; j++)
  1390. {
  1391. for (int16_t i = 0; i < display.epd2.WIDTH; i++)
  1392. {
  1393. if (i & 3) byte <<= 2;
  1394. else
  1395. {
  1396. #if defined(__AVR) || defined(ESP8266) || defined(ESP32)
  1397. byte = pgm_read_byte(&Bitmap3c200x200_black[j * byteWidth * 2 + i / 4]);
  1398. #else
  1399. byte = Bitmap3c200x200_black[j * byteWidth * 2 + i / 4];
  1400. #endif
  1401. }
  1402. if (!(byte & 0x80))
  1403. {
  1404. display.drawPixel(i, j, GxEPD_BLACK);
  1405. }
  1406. }
  1407. }
  1408. display.drawInvertedBitmap(0, 0, Bitmap3c200x200_red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1409. }
  1410. while (display.nextPage());
  1411. delay(2000);
  1412. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1413. {
  1414. display.firstPage();
  1415. do
  1416. {
  1417. display.fillScreen(GxEPD_WHITE);
  1418. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1419. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1420. }
  1421. while (display.nextPage());
  1422. delay(2000);
  1423. }
  1424. }
  1425. if (display.epd2.hasColor)
  1426. {
  1427. display.clearScreen(); // use default for white
  1428. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  1429. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  1430. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1431. {
  1432. display.drawImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1433. delay(2000);
  1434. }
  1435. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1436. {
  1437. int16_t x = -60;
  1438. int16_t y = -60;
  1439. for (uint16_t j = 0; j < 10; j++)
  1440. {
  1441. display.writeScreenBuffer(); // use default for white
  1442. display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1443. display.refresh();
  1444. delay(1000);
  1445. x += display.epd2.WIDTH / 4;
  1446. y += display.epd2.HEIGHT / 4;
  1447. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  1448. }
  1449. }
  1450. display.writeScreenBuffer(); // use default for white
  1451. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, 0, 0, 200, 200, false, false, true);
  1452. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, int16_t(display.epd2.WIDTH) - 200, int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, false, true);
  1453. display.refresh();
  1454. delay(2000);
  1455. }
  1456. }
  1457. #endif
  1458. #ifdef _GxBitmaps3c104x212_H_
  1459. void drawBitmaps3c104x212()
  1460. {
  1461. #if !defined(__AVR)
  1462. bitmap_pair bitmap_pairs[] =
  1463. {
  1464. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1465. {Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1466. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1467. };
  1468. #else
  1469. bitmap_pair bitmap_pairs[] =
  1470. {
  1471. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1472. //{Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1473. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1474. };
  1475. #endif
  1476. if (display.epd2.panel == GxEPD2::GDEW0213Z16)
  1477. {
  1478. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1479. {
  1480. display.firstPage();
  1481. do
  1482. {
  1483. display.fillScreen(GxEPD_WHITE);
  1484. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1485. if (bitmap_pairs[i].red == WS_Bitmap3c104x212_red)
  1486. {
  1487. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1488. }
  1489. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1490. }
  1491. while (display.nextPage());
  1492. delay(2000);
  1493. }
  1494. }
  1495. }
  1496. #endif
  1497. #ifdef _GxBitmaps3c128x296_H_
  1498. void drawBitmaps3c128x296()
  1499. {
  1500. #if !defined(__AVR)
  1501. bitmap_pair bitmap_pairs[] =
  1502. {
  1503. {Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1504. {Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1505. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1506. };
  1507. #else
  1508. bitmap_pair bitmap_pairs[] =
  1509. {
  1510. //{Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1511. //{Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1512. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1513. };
  1514. #endif
  1515. if (display.epd2.panel == GxEPD2::GDEW029Z10)
  1516. {
  1517. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1518. {
  1519. display.firstPage();
  1520. do
  1521. {
  1522. display.fillScreen(GxEPD_WHITE);
  1523. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1524. if (bitmap_pairs[i].red == WS_Bitmap3c128x296_red)
  1525. {
  1526. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1527. }
  1528. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1529. }
  1530. while (display.nextPage());
  1531. delay(2000);
  1532. }
  1533. }
  1534. }
  1535. #endif
  1536. #ifdef _GxBitmaps3c176x264_H_
  1537. void drawBitmaps3c176x264()
  1538. {
  1539. bitmap_pair bitmap_pairs[] =
  1540. {
  1541. {Bitmap3c176x264_black, Bitmap3c176x264_red}
  1542. };
  1543. if (display.epd2.panel == GxEPD2::GDEW027C44)
  1544. {
  1545. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1546. {
  1547. display.firstPage();
  1548. do
  1549. {
  1550. display.fillScreen(GxEPD_WHITE);
  1551. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1552. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1553. }
  1554. while (display.nextPage());
  1555. delay(2000);
  1556. }
  1557. }
  1558. }
  1559. #endif
  1560. #ifdef _GxBitmaps3c400x300_H_
  1561. void drawBitmaps3c400x300()
  1562. {
  1563. #if !defined(__AVR)
  1564. bitmap_pair bitmap_pairs[] =
  1565. {
  1566. {Bitmap3c400x300_1_black, Bitmap3c400x300_1_red},
  1567. {Bitmap3c400x300_2_black, Bitmap3c400x300_2_red},
  1568. {WS_Bitmap3c400x300_black, WS_Bitmap3c400x300_red}
  1569. };
  1570. #else
  1571. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1572. #endif
  1573. if (display.epd2.panel == GxEPD2::GDEW042Z15)
  1574. {
  1575. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1576. {
  1577. display.firstPage();
  1578. do
  1579. {
  1580. display.fillScreen(GxEPD_WHITE);
  1581. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1582. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1583. }
  1584. while (display.nextPage());
  1585. delay(2000);
  1586. }
  1587. }
  1588. }
  1589. #endif
  1590. #ifdef _GxBitmaps3c800x480_H_
  1591. void drawBitmaps3c800x480()
  1592. {
  1593. #if !defined(__AVR)
  1594. bitmap_pair bitmap_pairs[] =
  1595. {
  1596. {Bitmap3c800x480_1_black, Bitmap3c800x480_1_red}
  1597. };
  1598. #else
  1599. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1600. #endif
  1601. if (display.epd2.panel == GxEPD2::GDEW075Z08)
  1602. {
  1603. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1604. {
  1605. display.firstPage();
  1606. do
  1607. {
  1608. display.fillScreen(GxEPD_WHITE);
  1609. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1610. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1611. }
  1612. while (display.nextPage());
  1613. delay(2000);
  1614. }
  1615. }
  1616. }
  1617. #endif
  1618. #ifdef _GxBitmaps3c880x528_H_
  1619. void drawBitmaps3c880x528()
  1620. {
  1621. #if !defined(__AVR)
  1622. bitmap_pair bitmap_pairs[] =
  1623. {
  1624. {Bitmap3c880x528_black, Bitmap3c880x528_red}
  1625. };
  1626. #else
  1627. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1628. #endif
  1629. if (display.epd2.panel == GxEPD2::GDEH075Z90)
  1630. {
  1631. bool m = display.mirror(true);
  1632. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1633. {
  1634. display.firstPage();
  1635. do
  1636. {
  1637. display.fillScreen(GxEPD_WHITE);
  1638. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, 880, 528, GxEPD_BLACK);
  1639. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, 880, 528, GxEPD_RED);
  1640. }
  1641. while (display.nextPage());
  1642. delay(2000);
  1643. }
  1644. display.mirror(m);
  1645. }
  1646. }
  1647. #endif
  1648. #if defined(_WS_Bitmaps7c192x143_H_)
  1649. void drawBitmaps7c192x143()
  1650. {
  1651. if (display.epd2.panel == GxEPD2::ACeP565)
  1652. {
  1653. display.drawNative(WS_Bitmap7c192x143, 0, (display.epd2.WIDTH - 192) / 2, (display.epd2.HEIGHT - 143) / 2, 192, 143, false, false, true);
  1654. delay(5000);
  1655. }
  1656. }
  1657. #endif
  1658. void draw7colors()
  1659. {
  1660. display.setRotation(0);
  1661. uint16_t h = display.height() / 7;
  1662. display.firstPage();
  1663. do
  1664. {
  1665. display.fillRect(0, 0, display.width(), h, GxEPD_BLACK);
  1666. display.fillRect(0, h, display.width(), h, GxEPD_WHITE);
  1667. display.fillRect(0, 2 * h, display.width(), h, GxEPD_GREEN);
  1668. display.fillRect(0, 3 * h, display.width(), h, GxEPD_BLUE);
  1669. display.fillRect(0, 4 * h, display.width(), h, GxEPD_RED);
  1670. display.fillRect(0, 5 * h, display.width(), h, GxEPD_YELLOW);
  1671. display.fillRect(0, 6 * h, display.width(), h, GxEPD_ORANGE);
  1672. }
  1673. while (display.nextPage());
  1674. }
  1675. void draw7colorlines()
  1676. {
  1677. display.setRotation(0);
  1678. uint16_t h = 2;
  1679. display.firstPage();
  1680. do
  1681. {
  1682. uint16_t y = 0;
  1683. do
  1684. {
  1685. display.fillRect(0, y, display.width(), h, GxEPD_BLACK); y += h;
  1686. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1687. display.fillRect(0, y, display.width(), h, GxEPD_GREEN); y += h;
  1688. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1689. display.fillRect(0, y, display.width(), h, GxEPD_BLUE); y += h;
  1690. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1691. display.fillRect(0, y, display.width(), h, GxEPD_RED); y += h;
  1692. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1693. display.fillRect(0, y, display.width(), h, GxEPD_YELLOW); y += h;
  1694. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1695. display.fillRect(0, y, display.width(), h, GxEPD_ORANGE); y += h;
  1696. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1697. }
  1698. while ((y + 12 * h) < display.height());
  1699. //display.drawPixel(0, y, GxEPD_BLACK); display.drawPixel(10, y, GxEPD_GREEN);
  1700. //display.drawPixel(20, y, GxEPD_BLUE); display.drawPixel(30, y, GxEPD_RED);
  1701. //display.drawPixel(40, y, GxEPD_YELLOW); display.drawPixel(50, y, GxEPD_ORANGE);
  1702. display.fillRect(0, y, 2, 2, GxEPD_BLACK); display.fillRect(10, y, 2, 2, GxEPD_GREEN);
  1703. display.fillRect(20, y, 2, 2, GxEPD_BLUE); display.fillRect(30, y, 2, 2, GxEPD_RED);
  1704. display.fillRect(40, y, 2, 2, GxEPD_YELLOW); display.fillRect(50, y, 2, 2, GxEPD_ORANGE);
  1705. }
  1706. while (display.nextPage());
  1707. }