GxEPD2_Example.ino 60 KB

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