GxEPD2_Example.ino 60 KB

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