GxEPD2_Example.ino 76 KB

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