GxEPD2_Example.ino 61 KB

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