GxEPD2_NotPagedExample.ino 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248
  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. // see GxEPD2_wiring_examples.h for wiring suggestions and examples
  15. // base class GxEPD2_GFX can be used to pass references or pointers to the display instance as parameter, uses ~1.2k more code
  16. // enable or disable GxEPD2_GFX base class
  17. #define ENABLE_GxEPD2_GFX 0
  18. // uncomment next line to use class GFX of library GFX_Root instead of Adafruit_GFX
  19. //#include <GFX.h>
  20. // Note: if you use this with ENABLE_GxEPD2_GFX 1:
  21. // uncomment it in GxEPD2_GFX.h too, or add #include <GFX.h> before any #include <GxEPD2_GFX.h>
  22. #include <GxEPD2_BW.h>
  23. #include <GxEPD2_3C.h>
  24. #include <GxEPD2_7C.h>
  25. #include <Fonts/FreeMonoBold9pt7b.h>
  26. // select the display class and display driver class in the following file (new style):
  27. // note that many of these selections would require paged display to fit in ram
  28. #include "GxEPD2_display_selection_new_style.h"
  29. // or select the display constructor line below (old style), double commented out selections don't fit in ram:
  30. // note: this list may not get updated with new panels
  31. #if defined (ESP8266)
  32. // select one and adapt to your mapping, can use full buffer size (full HEIGHT)
  33. //GxEPD2_BW<GxEPD2_102, GxEPD2_102::HEIGHT> display(GxEPD2_102(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0102T4 80x128, UC8175
  34. //GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT> display(GxEPD2_150_BN(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // DEPG0150BN 200x200, SSD1681, TTGO T5 V2.4.1
  35. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEP015OC1 200x200, IL3829, no longer available
  36. //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 200x200, SSD1681
  37. //GxEPD2_BW<GxEPD2_154_T8, GxEPD2_154_T8::HEIGHT> display(GxEPD2_154_T8(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0154T8 152x152, UC8151 (IL0373)
  38. //GxEPD2_BW<GxEPD2_154_M09, GxEPD2_154_M09::HEIGHT> display(GxEPD2_154_M09(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0154M09 200x200, JD79653A
  39. //GxEPD2_BW<GxEPD2_154_M10, GxEPD2_154_M10::HEIGHT> display(GxEPD2_154_M10(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0154M10 152x152, UC8151D
  40. //GxEPD2_BW<GxEPD2_154_GDEY0154D67, GxEPD2_154_GDEY0154D67::HEIGHT> display(GxEPD2_154_GDEY0154D67(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEY0154D67 200x200, SSD1681, (FPC-B001 20.05.21)
  41. //GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display(GxEPD2_213(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDE0213B1 128x250, IL3895, phased out
  42. //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 128x250, SSD1675A (IL3897)
  43. //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 128x250, SSD1675B
  44. //GxEPD2_BW<GxEPD2_213_B74, GxEPD2_213_B74::HEIGHT> display(GxEPD2_213_B74(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEM0213B74 128x250, SSD1680
  45. //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 104x212, UC8151 (IL0373)
  46. //GxEPD2_BW<GxEPD2_213_M21, GxEPD2_213_M21::HEIGHT> display(GxEPD2_213_M21(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0213M21 104x212, UC8151 (IL0373)
  47. //GxEPD2_BW<GxEPD2_213_T5D, GxEPD2_213_T5D::HEIGHT> display(GxEPD2_213_T5D(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0213T5D 104x212, UC8151D
  48. //GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // DEPG0213BN 128x250, SSD1680, TTGO T5 V2.4.1, V2.3.1
  49. //GxEPD2_BW<GxEPD2_213_GDEY0213B74, GxEPD2_213_GDEY0213B74::HEIGHT> display(GxEPD2_213_GDEY0213B74(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEY0213B74 128x250, SSD1680, (FPC-A002 20.04.08)
  50. //GxEPD2_BW<GxEPD2_260, GxEPD2_260::HEIGHT> display(GxEPD2_260(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW026T0 152x296, UC8151 (IL0373)
  51. //GxEPD2_BW<GxEPD2_260_M01, GxEPD2_260_M01::HEIGHT> display(GxEPD2_260_M01(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW026M01 152x296, UC8151 (IL0373)
  52. //GxEPD2_BW<GxEPD2_266_BN, GxEPD2_266_BN::HEIGHT> display(GxEPD2_266_BN(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // DEPG0266BN 152x296, SSD1680, TTGO T5 V2.66 / T92_V1.0
  53. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW027W3 176x264, EK79652 (IL91874)
  54. //GxEPD2_BW<GxEPD2_270_GDEY027T91, GxEPD2_270_GDEY027T91::HEIGHT> display(GxEPD2_270_GDEY027T91(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEY027T91 176x264, SSD1680
  55. //GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEH029A1 128x296, SSD1608 (IL3820)
  56. //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 128x296, UC8151 (IL0373)
  57. //GxEPD2_BW<GxEPD2_290_T5D, GxEPD2_290_T5D::HEIGHT> display(GxEPD2_290_T5D(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW029T5D 128x296, UC8151D
  58. //GxEPD2_BW<GxEPD2_290_I6FD, GxEPD2_290_I6FD::HEIGHT> display(GxEPD2_290_I6FD(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW029I6FD 128x296, UC8151D
  59. //GxEPD2_BW<GxEPD2_290_T94, GxEPD2_290_T94::HEIGHT> display(GxEPD2_290_T94(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEM029T94 128x296, SSD1680
  60. //GxEPD2_BW<GxEPD2_290_T94_V2, GxEPD2_290_T94_V2::HEIGHT> display(GxEPD2_290_T94_V2(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEM029T94 128x296, SSD1680, Waveshare 2.9" V2 variant
  61. //GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // DEPG0290BS 128x296, SSD1680
  62. //GxEPD2_BW<GxEPD2_290_M06, GxEPD2_290_M06::HEIGHT> display(GxEPD2_290_M06(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW029M06 128x296, UC8151D
  63. //GxEPD2_BW<GxEPD2_290_GDEY029T94, GxEPD2_290_GDEY029T94::HEIGHT> display(GxEPD2_290_GDEY029T94(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEY029T94 128x296, SSD1680, (FPC-A005 20.06.15)
  64. //GxEPD2_BW<GxEPD2_371, GxEPD2_371::HEIGHT> display(GxEPD2_371(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0371W7 240x416, UC8171 (IL0324)
  65. //GxEPD2_BW<GxEPD2_370_TC1, GxEPD2_370_TC1::HEIGHT> display(GxEPD2_370_TC1(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // ED037TC1 280x480, SSD1677, Waveshare 3.7"
  66. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW042T2 400x300, UC8176 (IL0398)
  67. //GxEPD2_BW<GxEPD2_420_M01, GxEPD2_420_M01::HEIGHT> display(GxEPD2_420_M01(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW042M01 400x300, UC8176 (IL0398)
  68. //GxEPD2_BW<GxEPD2_420_GDEY042T91, GxEPD2_420_GDEY042T91::HEIGHT> display(GxEPD2_420_GDEY042T91(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); GDEY042T91, 400x300, SSD1683 (no inking)
  69. // can use only half buffer size
  70. ////GxEPD2_BW < GxEPD2_583, GxEPD2_583::HEIGHT / 2 > display(GxEPD2_583(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  71. ////GxEPD2_BW < GxEPD2_583_T8, GxEPD2_583_T8::HEIGHT / 2 > display(GxEPD2_583_T8(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  72. ////GxEPD2_BW < GxEPD2_750, GxEPD2_750::HEIGHT / 2 > display(GxEPD2_750(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  73. ////GxEPD2_BW < GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT / 2 > display(GxEPD2_750_T7(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW075T7 800x480
  74. // 3-color e-papers
  75. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0154Z04 no longer available
  76. //GxEPD2_3C<GxEPD2_154_Z90c, GxEPD2_154_Z90c::HEIGHT> display(GxEPD2_154_Z90c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEH0154Z90
  77. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  78. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  79. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  80. // can use only half buffer size
  81. ////GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT / 2> display(GxEPD2_420c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  82. // can use only quarter buffer size
  83. ////GxEPD2_3C < GxEPD2_583c, GxEPD2_583c::HEIGHT / 4 > display(GxEPD2_583c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  84. ////GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display(GxEPD2_750c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  85. ////GxEPD2_3C < GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT / 4 > display(GxEPD2_750c_Z08(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW075Z08 800x480
  86. // grey levels parallel IF e-papers on Waveshare e-Paper IT8951 Driver HAT
  87. // HRDY -> 4, RST -> 2, CS -> SS(15), SCK -> SCK(14), MOSI -> MOSI(D7(13)), MISO -> MISO(D6(12)), GND -> GND, 5V -> 5V
  88. // note: 5V supply needs to be exact and strong; 5V pin of USB powered Wemos D1 mini doesn't work!
  89. ////GxEPD2_BW<GxEPD2_it60, GxEPD2_it60::HEIGHT / 8> display(GxEPD2_it60(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 4));
  90. ////GxEPD2_BW < GxEPD2_it60_1448x1072, GxEPD2_it60_1448x1072::HEIGHT / 32 > display(GxEPD2_it60_1448x1072(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 4));
  91. // ***** for mapping of Waveshare e-Paper ESP8266 Driver Board *****
  92. // select one , can use full buffer size (full HEIGHT)
  93. //GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT> display(GxEPD2_150_BN(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // DEPG0150BN 200x200, SSD1681, TTGO T5 V2.4.1
  94. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEP015OC1 200x200, IL3829, no longer available
  95. //GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display(GxEPD2_154_D67(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEH0154D67 200x200, SSD1681
  96. //GxEPD2_BW<GxEPD2_154_T8, GxEPD2_154_T8::HEIGHT> display(GxEPD2_154_T8(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0154T8 152x152, UC8151 (IL0373)
  97. //GxEPD2_BW<GxEPD2_154_M09, GxEPD2_154_M09::HEIGHT> display(GxEPD2_154_M09(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0154M09 200x200, JD79653A
  98. //GxEPD2_BW<GxEPD2_154_M10, GxEPD2_154_M10::HEIGHT> display(GxEPD2_154_M10(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0154M10 152x152, UC8151D
  99. //GxEPD2_BW<GxEPD2_154_GDEY0154D67, GxEPD2_154_GDEY0154D67::HEIGHT> display(GxEPD2_154_GDEY0154D67(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEY0154D67 200x200, SSD1681, (FPC-B001 20.05.21)
  100. //GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display(GxEPD2_213(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDE0213B1 128x250, IL3895, phased out
  101. //GxEPD2_BW<GxEPD2_213_B72, GxEPD2_213_B72::HEIGHT> display(GxEPD2_213_B72(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEH0213B72 128x250, SSD1675A (IL3897)
  102. //GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEH0213B73 128x250, SSD1675B
  103. //GxEPD2_BW<GxEPD2_213_B74, GxEPD2_213_B74::HEIGHT> display(GxEPD2_213_B74(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEM0213B74 128x250, SSD1680
  104. //GxEPD2_BW<GxEPD2_213_flex, GxEPD2_213_flex::HEIGHT> display(GxEPD2_213_flex(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0213I5F 104x212, UC8151 (IL0373)
  105. //GxEPD2_BW<GxEPD2_213_M21, GxEPD2_213_M21::HEIGHT> display(GxEPD2_213_M21(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0213M21 104x212, UC8151 (IL0373)
  106. //GxEPD2_BW<GxEPD2_213_T5D, GxEPD2_213_T5D::HEIGHT> display(GxEPD2_213_T5D(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0213T5D 104x212, UC8151D
  107. //GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // DEPG0213BN 128x250, SSD1680, TTGO T5 V2.4.1, V2.3.1
  108. //GxEPD2_BW<GxEPD2_213_GDEY0213B74, GxEPD2_213_GDEY0213B74::HEIGHT> display(GxEPD2_213_GDEY0213B74(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEY0213B74 128x250, SSD1680, (FPC-A002 20.04.08)
  109. //GxEPD2_BW<GxEPD2_260, GxEPD2_260::HEIGHT> display(GxEPD2_260(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW026T0 152x296, UC8151 (IL0373)
  110. //GxEPD2_BW<GxEPD2_260_M01, GxEPD2_260_M01::HEIGHT> display(GxEPD2_260_M01(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW026M01 152x296, UC8151 (IL0373)
  111. //GxEPD2_BW<GxEPD2_266_BN, GxEPD2_266_BN::HEIGHT> display(GxEPD2_266_BN(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // DEPG0266BN 152x296, SSD1680, TTGO T5 V2.66 / T92_V1.0
  112. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW027W3 176x264, EK79652 (IL91874)
  113. //GxEPD2_BW<GxEPD2_270_GDEY027T91, GxEPD2_270_GDEY027T91::HEIGHT> display(GxEPD2_270_GDEY027T91(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEY027T91 176x264, SSD1680
  114. //GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEH029A1 128x296, SSD1608 (IL3820)
  115. //GxEPD2_BW<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW029T5 128x296, UC8151 (IL0373)
  116. //GxEPD2_BW<GxEPD2_290_T5D, GxEPD2_290_T5D::HEIGHT> display(GxEPD2_290_T5D(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW029T5D 128x296, UC8151D
  117. //GxEPD2_BW<GxEPD2_290_I6FD, GxEPD2_290_I6FD::HEIGHT> display(GxEPD2_290_I6FD(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW029I6FD 128x296, UC8151D
  118. //GxEPD2_BW<GxEPD2_290_T94, GxEPD2_290_T94::HEIGHT> display(GxEPD2_290_T94(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEM029T94 128x296, SSD1680
  119. //GxEPD2_BW<GxEPD2_290_T94_V2, GxEPD2_290_T94_V2::HEIGHT> display(GxEPD2_290_T94_V2(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEM029T94 128x296, SSD1680, Waveshare 2.9" V2 variant
  120. //GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // DEPG0290BS 128x296, SSD1680
  121. //GxEPD2_BW<GxEPD2_290_M06, GxEPD2_290_M06::HEIGHT> display(GxEPD2_290_M06(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW029M06 128x296, UC8151D
  122. //GxEPD2_BW<GxEPD2_290_GDEY029T94, GxEPD2_290_GDEY029T94::HEIGHT> display(GxEPD2_290_GDEY029T94(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEY029T94 128x296, SSD1680, (FPC-A005 20.06.15)
  123. //GxEPD2_BW<GxEPD2_371, GxEPD2_371::HEIGHT> display(GxEPD2_371(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0371W7 240x416, UC8171 (IL0324)
  124. //GxEPD2_BW<GxEPD2_370_TC1, GxEPD2_370_TC1::HEIGHT> display(GxEPD2_370_TC1(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // ED037TC1 280x480, SSD1677, Waveshare 3.7"
  125. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW042T2 400x300, UC8176 (IL0398)
  126. //GxEPD2_BW<GxEPD2_420_M01, GxEPD2_420_M01::HEIGHT> display(GxEPD2_420_M01(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW042M01 400x300, UC8176 (IL0398)
  127. //GxEPD2_BW<GxEPD2_420_GDEY042T91, GxEPD2_420_GDEY042T91::HEIGHT> display(GxEPD2_420_GDEY042T91(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); GDEY042T91, 400x300, SSD1683 (no inking)
  128. // can use only half buffer size
  129. ////GxEPD2_BW < GxEPD2_583, GxEPD2_583::HEIGHT / 2 > display(GxEPD2_583(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  130. ////GxEPD2_BW < GxEPD2_583_T8, GxEPD2_583_T8::HEIGHT / 2 > display(GxEPD2_583_T8(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  131. ////GxEPD2_BW < GxEPD2_750, GxEPD2_750::HEIGHT / 2 > display(GxEPD2_750(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  132. ////GxEPD2_BW < GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT / 2 > display(GxEPD2_750_T7(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW075T7 800x480
  133. // 3-color e-papers
  134. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0154Z04 no longer available
  135. //GxEPD2_3C<GxEPD2_154_Z90c, GxEPD2_154_Z90c::HEIGHT> display(GxEPD2_154_Z90c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEH0154Z90
  136. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  137. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  138. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  139. // can use only half buffer size
  140. ////GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT / 2> display(GxEPD2_420c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  141. // can use only quarter buffer size
  142. ////GxEPD2_3C<GxEPD2_583c, GxEPD2_583c::HEIGHT / 4> display(GxEPD2_583c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  143. ////GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display(GxEPD2_750c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  144. ////GxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT / 4> display(GxEPD2_750c_Z08(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW075Z08 800x480
  145. ////GxEPD2_3C<GxEPD2_750c_Z90, GxEPD2_750c_Z90::HEIGHT / 4> display(GxEPD2_750c_Z90(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEH075Z90 880x528
  146. // 7-color e-paper
  147. ////GxEPD2_7C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 4 > display(GxEPD2_565c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // Waveshare 5.65" 7-color
  148. #endif
  149. #if defined(ESP32)
  150. // select one and adapt to your mapping, can use full buffer size (full HEIGHT)
  151. //GxEPD2_BW<GxEPD2_102, GxEPD2_102::HEIGHT> display(GxEPD2_102(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0102T4 80x128, UC8175
  152. //GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT> display(GxEPD2_150_BN(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // DEPG0150BN 200x200, SSD1681, TTGO T5 V2.4.1
  153. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEP015OC1 200x200, IL3829, no longer available
  154. //GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display(GxEPD2_154_D67(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0154D67 200x200, SSD1681
  155. //GxEPD2_BW<GxEPD2_154_T8, GxEPD2_154_T8::HEIGHT> display(GxEPD2_154_T8(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0154T8 152x152, UC8151 (IL0373)
  156. //GxEPD2_BW<GxEPD2_154_M09, GxEPD2_154_M09::HEIGHT> display(GxEPD2_154_M09(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0154M09 200x200, JD79653A
  157. //GxEPD2_BW<GxEPD2_154_M10, GxEPD2_154_M10::HEIGHT> display(GxEPD2_154_M10(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0154M10 152x152, UC8151D
  158. //GxEPD2_BW<GxEPD2_154_GDEY0154D67, GxEPD2_154_GDEY0154D67::HEIGHT> display(GxEPD2_154_GDEY0154D67(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEY0154D67 200x200, SSD1681, (FPC-B001 20.05.21)
  159. //GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display(GxEPD2_213(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDE0213B1 128x250, IL3895, phased out
  160. //GxEPD2_BW<GxEPD2_213_B72, GxEPD2_213_B72::HEIGHT> display(GxEPD2_213_B72(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213B72 128x250, SSD1675A (IL3897)
  161. //GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213B73 128x250, SSD1675B
  162. //GxEPD2_BW<GxEPD2_213_B74, GxEPD2_213_B74::HEIGHT> display(GxEPD2_213_B74(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEM0213B74 128x250, SSD1680
  163. //GxEPD2_BW<GxEPD2_213_flex, GxEPD2_213_flex::HEIGHT> display(GxEPD2_213_flex(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0213I5F 104x212, UC8151 (IL0373)
  164. //GxEPD2_BW<GxEPD2_213_M21, GxEPD2_213_M21::HEIGHT> display(GxEPD2_213_M21(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0213M21 104x212, UC8151 (IL0373)
  165. //GxEPD2_BW<GxEPD2_213_T5D, GxEPD2_213_T5D::HEIGHT> display(GxEPD2_213_T5D(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0213T5D 104x212, UC8151D
  166. //GxEPD2_BW<GxEPD2_213_BN, GxEPD2_213_BN::HEIGHT> display(GxEPD2_213_BN(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // DEPG0213BN 128x250, SSD1680, TTGO T5 V2.4.1, V2.3.1
  167. //GxEPD2_BW<GxEPD2_213_GDEY0213B74, GxEPD2_213_GDEY0213B74::HEIGHT> display(GxEPD2_213_GDEY0213B74(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEY0213B74 128x250, SSD1680, (FPC-A002 20.04.08)
  168. //GxEPD2_BW<GxEPD2_260, GxEPD2_260::HEIGHT> display(GxEPD2_260(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW026T0 152x296, UC8151 (IL0373)
  169. //GxEPD2_BW<GxEPD2_260_M01, GxEPD2_260_M01::HEIGHT> display(GxEPD2_260_M01(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW026M01 152x296, UC8151 (IL0373)
  170. //GxEPD2_BW<GxEPD2_266_BN, GxEPD2_266_BN::HEIGHT> display(GxEPD2_266_BN(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // DEPG0266BN 152x296, SSD1680, TTGO T5 V2.4.1
  171. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW027W3 176x264, EK79652 (IL91874)
  172. //GxEPD2_BW<GxEPD2_270_GDEY027T91, GxEPD2_270_GDEY027T91::HEIGHT> display(GxEPD2_270_GDEY027T91(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEY027T91 176x264, SSD1680
  173. //GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH029A1 128x296, SSD1608 (IL3820)
  174. //GxEPD2_BW<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW029T5 128x296, UC8151 (IL0373)
  175. //GxEPD2_BW<GxEPD2_290_T5D, GxEPD2_290_T5D::HEIGHT> display(GxEPD2_290_T5D(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW029T5D 128x296, UC8151D
  176. //GxEPD2_BW<GxEPD2_290_I6FD, GxEPD2_290_I6FD::HEIGHT> display(GxEPD2_290_I6FD(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW029I6FD 128x296, UC8151D
  177. //GxEPD2_BW<GxEPD2_290_T94, GxEPD2_290_T94::HEIGHT> display(GxEPD2_290_T94(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEM029T94 128x296, SSD1680
  178. //GxEPD2_BW<GxEPD2_290_T94_V2, GxEPD2_290_T94_V2::HEIGHT> display(GxEPD2_290_T94_V2(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEM029T94 128x296, SSD1680, Waveshare 2.9" V2 variant
  179. //GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // DEPG0290BS 128x296, SSD1680
  180. //GxEPD2_BW<GxEPD2_290_M06, GxEPD2_290_M06::HEIGHT> display(GxEPD2_290_M06(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW029M06 128x296, UC8151D
  181. //GxEPD2_BW<GxEPD2_290_GDEY029T94, GxEPD2_290_GDEY029T94::HEIGHT> display(GxEPD2_290_GDEY029T94(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEY029T94 128x296, SSD1680, (FPC-A005 20.06.15)
  182. //GxEPD2_BW<GxEPD2_371, GxEPD2_371::HEIGHT> display(GxEPD2_371(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0371W7 240x416, UC8171 (IL0324)
  183. //GxEPD2_BW<GxEPD2_370_TC1, GxEPD2_370_TC1::HEIGHT> display(GxEPD2_370_TC1(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // ED037TC1 280x480, SSD1677, Waveshare 3.7"
  184. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW042T2 400x300, UC8176 (IL0398)
  185. //GxEPD2_BW<GxEPD2_420_M01, GxEPD2_420_M01::HEIGHT> display(GxEPD2_420_M01(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW042M01 400x300, UC8176 (IL0398)
  186. //GxEPD2_BW<GxEPD2_420_GDEY042T91, GxEPD2_420_GDEY042T91::HEIGHT> display(GxEPD2_420_GDEY042T91(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); GDEY042T91, 400x300, SSD1683 (no inking)
  187. //GxEPD2_BW<GxEPD2_583, GxEPD2_583::HEIGHT> display(GxEPD2_583(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0583T7 600x448, UC8159c (IL0371)
  188. //GxEPD2_BW<GxEPD2_583_T8, GxEPD2_583_T8::HEIGHT> display(GxEPD2_583_T8(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0583T8 648x480, EK79655 (GD7965)
  189. //GxEPD2_BW<GxEPD2_583_GDEQ0583T31, GxEPD2_583_GDEQ0583T31::HEIGHT> display(GxEPD2_583_GDEQ0583T31(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEQ0583T31 648x480, UC8179, (P583010-MF1-B)
  190. //GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display(GxEPD2_750(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075T8 640x384, UC8159c (IL0371)
  191. //GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075T7 800x480, EK79655 (GD7965)
  192. //GxEPD2_BW<GxEPD2_750_YT7, GxEPD2_750_YT7::HEIGHT> display(GxEPD2_750_YT7(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEY075T7 800x480, UC8179 (GD7965)
  193. ////GxEPD2_BW < GxEPD2_1160_T91, GxEPD2_1160_T91::HEIGHT / 2> display(GxEPD2_1160_T91(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH116T91 960x640, SSD1677
  194. // 3-color e-papers
  195. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0154Z04 200x200, IL0376F, no longer available
  196. //GxEPD2_3C<GxEPD2_154_Z90c, GxEPD2_154_Z90c::HEIGHT> display(GxEPD2_154_Z90c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0154Z90 200x200, SSD1681
  197. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0213Z16 104x212, UC8151 (IL0373)
  198. //GxEPD2_3C<GxEPD2_213_Z19c, GxEPD2_213_Z19c::HEIGHT> display(GxEPD2_213_Z19c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213Z19 104x212, UC8151D
  199. //GxEPD2_3C<GxEPD2_213_Z98c, GxEPD2_213_Z98c::HEIGHT> display(GxEPD2_213_Z98c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEY0213Z98 122x250, SSD1680
  200. //GxEPD2_3C<GxEPD2_266c, GxEPD2_266c::HEIGHT> display(GxEPD2_266c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEY0266Z90 152x296, SSD1680
  201. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW027C44 176x264, IL91874
  202. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW029Z10 128x296, UC8151 (IL0373)
  203. //GxEPD2_3C<GxEPD2_290_Z13c, GxEPD2_290_Z13c::HEIGHT> display(GxEPD2_290_Z13c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH029Z13 128x296, UC8151D
  204. //GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEM029C90 128x296, SSD1680
  205. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT> display(GxEPD2_420c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW042Z15 400x300, UC8176 (IL0398)
  206. //GxEPD2_3C<GxEPD2_420c_Z21, GxEPD2_420c_Z21::HEIGHT> display(GxEPD2_420c_Z21(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEQ042Z21 400x300, UC8276
  207. //GxEPD2_3C<GxEPD2_583c, GxEPD2_583c::HEIGHT> display(GxEPD2_583c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0583Z21 600x448, UC8179 (IL0371)
  208. //GxEPD2_3C<GxEPD2_583c_Z83, GxEPD2_583c_Z83::HEIGHT> display(GxEPD2_583c_Z83(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0583Z83 648x480, GD7965
  209. //GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT> display(GxEPD2_750c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075Z09 640x384, UC8179 (IL0371)
  210. //GxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT> display(GxEPD2_750c_Z08(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075Z08 800x480, GD7965
  211. ////GxEPD2_3C<GxEPD2_750c_Z90, GxEPD2_750c_Z90::HEIGHT / 2> display(GxEPD2_750c_Z90(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH075Z90 880x528, SSD1677
  212. // grey levels parallel IF e-papers on Waveshare e-Paper IT8951 Driver HAT
  213. // HRDY -> 4, RST -> 16, CS -> SS(5), SCK -> SCK(18), MOSI -> MOSI(23), MISO -> MISO(19), GND -> GND, 5V -> 5V
  214. // note: 5V supply needs to be exact and strong; 5V over diode from USB (e.g. Wemos D1 mini) doesn't work!
  215. //GxEPD2_BW<GxEPD2_it60, GxEPD2_it60::HEIGHT> display(GxEPD2_it60(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  216. ////GxEPD2_BW < GxEPD2_it60_1448x1072, GxEPD2_it60_1448x1072::HEIGHT / 4 > display(GxEPD2_it60_1448x1072(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  217. #endif
  218. // can't use package "STMF1 Boards (STM32Duino.com)" (Roger Clark) anymore with Adafruit_GFX, use "STM32 Boards (selected from submenu)" (STMicroelectronics)
  219. #if defined(ARDUINO_ARCH_STM32)
  220. #define MAX_DISPLAY_BUFFER_SIZE 15000ul // ~15k is a good compromise
  221. #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))
  222. // select one and adapt to your mapping
  223. //GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEP015OC1 no longer available
  224. //GxEPD2_BW<GxEPD2_154_D67, MAX_HEIGHT(GxEPD2_154_D67)> display(GxEPD2_154_D67(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0154D67
  225. //GxEPD2_BW<GxEPD2_154_T8, MAX_HEIGHT(GxEPD2_154_T8)> display(GxEPD2_154_T8(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154T8 152x152
  226. //GxEPD2_BW<GxEPD2_154_M09, MAX_HEIGHT(GxEPD2_154_M09)> display(GxEPD2_154_M09(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154M09 200x200
  227. //GxEPD2_BW<GxEPD2_154_M10, MAX_HEIGHT(GxEPD2_154_M10)> display(GxEPD2_154_M10(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154M10 152x152
  228. //GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDE0213B1, phased out
  229. //GxEPD2_BW<GxEPD2_213_B72, MAX_HEIGHT(GxEPD2_213_B72)> display(GxEPD2_213_B72(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B72
  230. //GxEPD2_BW<GxEPD2_213_B73, MAX_HEIGHT(GxEPD2_213_B73)> display(GxEPD2_213_B73(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B73
  231. //GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213I5F
  232. //GxEPD2_BW<GxEPD2_213_M21, MAX_HEIGHT(GxEPD2_213_M21)> display(GxEPD2_213_M21(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213M21
  233. //GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  234. //GxEPD2_BW<GxEPD2_290_T5, MAX_HEIGHT(GxEPD2_290_T5)> display(GxEPD2_290_T5(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029T5
  235. //GxEPD2_BW<GxEPD2_290_M06, MAX_HEIGHT(GxEPD2_290_M06)> display(GxEPD2_290_M06(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029M06
  236. //GxEPD2_BW<GxEPD2_260, MAX_HEIGHT(GxEPD2_260)> display(GxEPD2_260(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  237. //GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  238. //GxEPD2_BW<GxEPD2_371, MAX_HEIGHT(GxEPD2_371)> display(GxEPD2_371(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  239. //GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  240. //GxEPD2_BW<GxEPD2_420_M01, MAX_HEIGHT(GxEPD2_420_M01)> display(GxEPD2_420_M01(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW042M01
  241. ////GxEPD2_BW<GxEPD2_583, MAX_HEIGHT(GxEPD2_583)> display(GxEPD2_583(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  242. ////GxEPD2_BW <GxEPD2_583_T8, MAX_HEIGHT(GxEPD2_583_T8)> display(GxEPD2_583_T8(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  243. ////GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  244. ////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
  245. // 3-color e-papers
  246. #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))
  247. //GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT_3C(GxEPD2_154c)> display(GxEPD2_154c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154Z04 no longer available
  248. //GxEPD2_3C<GxEPD2_154_Z90c, MAX_HEIGHT_3C(GxEPD2_154_Z90c)> display(GxEPD2_154_Z90c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0154Z90
  249. //GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  250. //GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  251. //GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT_3C(GxEPD2_270c)> display(GxEPD2_270c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  252. ////GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT_3C(GxEPD2_420c)> display(GxEPD2_420c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  253. ////GxEPD2_3C<GxEPD2_583c, MAX_HEIGHT_3C(GxEPD2_583c)> display(GxEPD2_583c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  254. ////GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  255. ////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
  256. #endif
  257. #if !defined(__AVR) && !defined(_BOARD_GENERIC_STM32F103C_H_)
  258. // comment out unused bitmaps to reduce code space used
  259. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  260. #include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  261. #include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  262. #include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  263. #include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  264. #include "bitmaps/Bitmaps400x300.h" // 4.2" b/w
  265. #include "bitmaps/Bitmaps640x384.h" // 7.5" b/w
  266. // 3-color
  267. #include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  268. #include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  269. #include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  270. #include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  271. #include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r
  272. #if defined(ESP8266) || defined(ESP32)
  273. #include "bitmaps/WS_Bitmaps800x600.h" // 6.0" grey
  274. #endif
  275. #else
  276. // select only one to fit in code space
  277. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  278. //#include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  279. //#include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  280. //#include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  281. //#include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  282. ////#include "bitmaps/Bitmaps400x300.h" // 4.2" b/w // not enough code space
  283. ////#include "bitmaps/Bitmaps640x384.h" // 7.5" b/w // not enough code space
  284. // 3-color
  285. //#include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  286. //#include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  287. //#include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  288. //#include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  289. ////#include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r // not enough code space
  290. #endif
  291. void setup()
  292. {
  293. Serial.begin(115200);
  294. Serial.println();
  295. Serial.println("setup");
  296. delay(100);
  297. //display.init(115200); // default 10ms reset pulse, e.g. for bare panels with DESPI-C02
  298. display.init(115200, true, 2, false); // USE THIS for Waveshare boards with "clever" reset circuit, 2ms reset pulse
  299. // first update should be full refresh
  300. helloWorld();
  301. delay(1000);
  302. // partial refresh mode can be used to full screen,
  303. // effective if display panel hasFastPartialUpdate
  304. helloFullScreenPartialMode();
  305. delay(1000);
  306. helloArduino();
  307. delay(1000);
  308. helloEpaper();
  309. delay(1000);
  310. //helloValue(123.9, 1);
  311. //delay(1000);
  312. showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  313. delay(1000);
  314. drawBitmaps();
  315. if (display.epd2.hasPartialUpdate)
  316. {
  317. showPartialUpdate();
  318. delay(1000);
  319. } // else // on GDEW0154Z04 only full update available, doesn't look nice
  320. //drawCornerTest();
  321. //showBox(16, 16, 48, 32, false);
  322. //showBox(16, 56, 48, 32, true);
  323. display.powerOff();
  324. deepSleepTest();
  325. Serial.println("setup done");
  326. }
  327. void loop()
  328. {
  329. }
  330. // note for partial update window and setPartialWindow() method:
  331. // partial update window size and position is on byte boundary in physical x direction
  332. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  333. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  334. const char HelloWorld[] = "Hello World!";
  335. const char HelloArduino[] = "Hello Arduino!";
  336. const char HelloEpaper[] = "Hello E-Paper!";
  337. void helloWorld()
  338. {
  339. //Serial.println("helloWorld");
  340. display.setRotation(1);
  341. display.setFont(&FreeMonoBold9pt7b);
  342. display.setTextColor(GxEPD_BLACK);
  343. int16_t tbx, tby; uint16_t tbw, tbh;
  344. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  345. // center bounding box by transposition of origin:
  346. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  347. uint16_t y = ((display.height() - tbh) / 2) - tby;
  348. // full window mode is the initial mode, set it anyway
  349. display.setFullWindow();
  350. display.fillScreen(GxEPD_WHITE);
  351. display.setCursor(x, y);
  352. display.print(HelloWorld);
  353. display.display(false); // full update
  354. //Serial.println("helloWorld done");
  355. }
  356. void helloWorldForDummiesNotPaged()
  357. {
  358. //Serial.println("helloWorld");
  359. const char text[] = "Hello World!";
  360. // most e-papers have width < height (portrait) as native orientation, especially the small ones
  361. // in GxEPD2 rotation 0 is used for native orientation (most TFT libraries use 0 fix for portrait orientation)
  362. // set rotation to 1 (rotate right 90 degrees) to have enough space on small displays (landscape)
  363. display.setRotation(1);
  364. // select a suitable font in Adafruit_GFX
  365. display.setFont(&FreeMonoBold9pt7b);
  366. // on e-papers black on white is more pleasant to read
  367. display.setTextColor(GxEPD_BLACK);
  368. // Adafruit_GFX has a handy method getTextBounds() to determine the boundary box for a text for the actual font
  369. int16_t tbx, tby; uint16_t tbw, tbh; // boundary box window
  370. display.getTextBounds(text, 0, 0, &tbx, &tby, &tbw, &tbh); // it works for origin 0, 0, fortunately (negative tby!)
  371. // center bounding box by transposition of origin:
  372. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  373. uint16_t y = ((display.height() - tbh) / 2) - tby;
  374. // full window mode is the initial mode, set it anyway
  375. display.setFullWindow();
  376. // here we use full buffered drawing
  377. // only part of the display is used if page_height is less than HEIGHT
  378. display.fillScreen(GxEPD_WHITE); // set the background to white (fill the buffer with value for white)
  379. display.setCursor(x, y); // set the postition to start printing text
  380. display.print(text); // print some text
  381. // tell the graphics class to transfer the buffer content (page) to the controller buffer
  382. // and to refresh to the screen
  383. display.display(false); // full update
  384. //Serial.println("helloWorld done");
  385. }
  386. void helloFullScreenPartialMode()
  387. {
  388. //Serial.println("helloFullScreenPartialMode");
  389. const char fullscreen[] = "full screen update";
  390. const char fpm[] = "fast partial mode";
  391. const char spm[] = "slow partial mode";
  392. const char npm[] = "no partial mode";
  393. // full window mode is the initial mode, set it anyway
  394. display.setFullWindow();
  395. display.setRotation(1);
  396. display.setFont(&FreeMonoBold9pt7b);
  397. display.setTextColor(GxEPD_BLACK);
  398. const char* updatemode;
  399. if (display.epd2.hasFastPartialUpdate)
  400. {
  401. updatemode = fpm;
  402. }
  403. else if (display.epd2.hasPartialUpdate)
  404. {
  405. updatemode = spm;
  406. }
  407. else
  408. {
  409. updatemode = npm;
  410. }
  411. // do this outside of the loop
  412. int16_t tbx, tby; uint16_t tbw, tbh;
  413. // center update text
  414. display.getTextBounds(fullscreen, 0, 0, &tbx, &tby, &tbw, &tbh);
  415. uint16_t utx = ((display.width() - tbw) / 2) - tbx;
  416. uint16_t uty = ((display.height() / 4) - tbh / 2) - tby;
  417. // center update mode
  418. display.getTextBounds(updatemode, 0, 0, &tbx, &tby, &tbw, &tbh);
  419. uint16_t umx = ((display.width() - tbw) / 2) - tbx;
  420. uint16_t umy = ((display.height() * 3 / 4) - tbh / 2) - tby;
  421. // center HelloWorld
  422. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  423. uint16_t hwx = ((display.width() - tbw) / 2) - tbx;
  424. uint16_t hwy = ((display.height() - tbh) / 2) - tby;
  425. display.fillScreen(GxEPD_WHITE);
  426. display.setCursor(hwx, hwy);
  427. display.print(HelloWorld);
  428. display.setCursor(utx, uty);
  429. display.print(fullscreen);
  430. display.setCursor(umx, umy);
  431. display.print(updatemode);
  432. display.display(true); // partial update
  433. //Serial.println("helloFullScreenPartialMode done");
  434. }
  435. void helloArduino()
  436. {
  437. //Serial.println("helloArduino");
  438. display.setRotation(1);
  439. display.setFont(&FreeMonoBold9pt7b);
  440. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  441. int16_t tbx, tby; uint16_t tbw, tbh;
  442. // align with centered HelloWorld
  443. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  444. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  445. // height might be different
  446. display.getTextBounds(HelloArduino, 0, 0, &tbx, &tby, &tbw, &tbh);
  447. uint16_t y = ((display.height() / 4) - tbh / 2) - tby; // y is base line!
  448. // make the window big enough to cover (overwrite) descenders of previous text
  449. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  450. uint16_t wy = (display.height() / 4) - wh / 2;
  451. // full window mode is the initial mode, set it anyway
  452. display.setFullWindow();
  453. // DO NOT display.fillScreen(GxEPD_WHITE); keep current content!
  454. display.fillRect(0, wy, display.width(), wh, GxEPD_WHITE); // clear rect instead
  455. display.setCursor(x, y);
  456. display.print(HelloArduino);
  457. display.displayWindow(0, wy, display.width(), wh);
  458. delay(1000);
  459. //Serial.println("helloArduino done");
  460. }
  461. void helloEpaper()
  462. {
  463. //Serial.println("helloEpaper");
  464. display.setRotation(1);
  465. display.setFont(&FreeMonoBold9pt7b);
  466. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  467. int16_t tbx, tby; uint16_t tbw, tbh;
  468. // align with centered HelloWorld
  469. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  470. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  471. // height might be different
  472. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  473. uint16_t y = (display.height() * 3 / 4) + tbh / 2; // y is base line!
  474. // make the window big enough to cover (overwrite) descenders of previous text
  475. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  476. uint16_t wy = (display.height() * 3 / 4) - wh / 2;
  477. // full window mode is the initial mode, set it anyway
  478. display.setFullWindow();
  479. // DO NOT display.fillScreen(GxEPD_WHITE); keep current content!
  480. display.fillRect(0, wy, display.width(), wh, GxEPD_WHITE); // clear rect instead
  481. display.setCursor(x, y);
  482. display.print(HelloEpaper);
  483. display.displayWindow(0, wy, display.width(), wh);
  484. //Serial.println("helloEpaper done");
  485. }
  486. #if defined(ESP8266) || defined(ESP32)
  487. #include <StreamString.h>
  488. #define PrintString StreamString
  489. #else
  490. class PrintString : public Print, public String
  491. {
  492. public:
  493. size_t write(uint8_t data) override
  494. {
  495. return concat(char(data));
  496. };
  497. };
  498. #endif
  499. void helloValue(double v, int digits)
  500. {
  501. //Serial.println("helloValue");
  502. display.setRotation(1);
  503. display.setFont(&FreeMonoBold9pt7b);
  504. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  505. PrintString valueString;
  506. valueString.print(v, digits);
  507. int16_t tbx, tby; uint16_t tbw, tbh;
  508. display.getTextBounds(valueString, 0, 0, &tbx, &tby, &tbw, &tbh);
  509. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  510. uint16_t y = (display.height() * 3 / 4) + tbh / 2; // y is base line!
  511. // show what happens, if we use the bounding box for partial window
  512. uint16_t wx = (display.width() - tbw) / 2;
  513. uint16_t wy = (display.height() * 3 / 4) - tbh / 2;
  514. // full window mode is the initial mode, set it anyway
  515. display.setFullWindow();
  516. // DO NOT display.fillScreen(GxEPD_WHITE); keep current content!
  517. display.fillRect(wx, wy, tbw, tbh, GxEPD_WHITE); // clear rect instead
  518. display.setCursor(x, y);
  519. display.print(valueString);
  520. display.displayWindow(wx, wy, tbw, tbh);
  521. delay(2000);
  522. // make the partial window big enough to cover the previous text
  523. uint16_t ww = tbw; // remember window width
  524. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  525. // adjust, because HelloEpaper was aligned, not centered (could calculate this to be precise)
  526. ww = max(ww, uint16_t(tbw + 12)); // 12 seems ok
  527. wx = (display.width() - tbw) / 2;
  528. // make the window big enough to cover (overwrite) descenders of previous text
  529. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  530. wy = (display.height() * 3 / 4) - wh / 2;
  531. // DO NOT display.fillScreen(GxEPD_WHITE); keep current content!
  532. display.fillRect(wx, wy, ww, wh, GxEPD_WHITE); // clear rect instead
  533. display.setCursor(x, y);
  534. display.print(valueString);
  535. display.displayWindow(wx, wy, ww, wh);
  536. // alternately use the whole width for partial window
  537. //display.displayWindow(wx, wy, display.width(), wh);
  538. //Serial.println("helloValue done");
  539. }
  540. void deepSleepTest()
  541. {
  542. //Serial.println("deepSleepTest");
  543. const char hibernating[] = "hibernating ...";
  544. const char wokeup[] = "woke up";
  545. const char from[] = "from deep sleep";
  546. const char again[] = "again";
  547. display.setRotation(1);
  548. display.setFont(&FreeMonoBold9pt7b);
  549. display.setTextColor(GxEPD_BLACK);
  550. int16_t tbx, tby; uint16_t tbw, tbh;
  551. // center text
  552. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  553. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  554. uint16_t y = ((display.height() - tbh) / 2) - tby;
  555. display.setFullWindow();
  556. display.fillScreen(GxEPD_WHITE);
  557. display.setCursor(x, y);
  558. display.print(hibernating);
  559. display.display(false); // full update
  560. display.hibernate();
  561. delay(5000);
  562. display.getTextBounds(wokeup, 0, 0, &tbx, &tby, &tbw, &tbh);
  563. uint16_t wx = (display.width() - tbw) / 2;
  564. uint16_t wy = (display.height() / 3) + tbh / 2; // y is base line!
  565. display.getTextBounds(from, 0, 0, &tbx, &tby, &tbw, &tbh);
  566. uint16_t fx = (display.width() - tbw) / 2;
  567. uint16_t fy = (display.height() * 2 / 3) + tbh / 2; // y is base line!
  568. display.fillScreen(GxEPD_WHITE);
  569. display.setCursor(wx, wy);
  570. display.print(wokeup);
  571. display.setCursor(fx, fy);
  572. display.print(from);
  573. display.display(false); // full update
  574. delay(5000);
  575. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  576. uint16_t hx = (display.width() - tbw) / 2;
  577. uint16_t hy = (display.height() / 3) + tbh / 2; // y is base line!
  578. display.getTextBounds(again, 0, 0, &tbx, &tby, &tbw, &tbh);
  579. uint16_t ax = (display.width() - tbw) / 2;
  580. uint16_t ay = (display.height() * 2 / 3) + tbh / 2; // y is base line!
  581. display.fillScreen(GxEPD_WHITE);
  582. display.setCursor(hx, hy);
  583. display.print(hibernating);
  584. display.setCursor(ax, ay);
  585. display.print(again);
  586. display.display(false); // full update
  587. display.hibernate();
  588. //Serial.println("deepSleepTest done");
  589. }
  590. void showBox(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
  591. {
  592. //Serial.println("showBox");
  593. display.setRotation(1);
  594. display.setFullWindow();
  595. display.fillScreen(GxEPD_WHITE);
  596. display.fillRect(x, y, w, h, GxEPD_BLACK);
  597. if (partial)
  598. {
  599. display.displayWindow(x, y, w, h);
  600. }
  601. else
  602. {
  603. display.display(false); // full update
  604. }
  605. //Serial.println("showBox done");
  606. }
  607. void drawCornerTest()
  608. {
  609. display.setFullWindow();
  610. display.setFont(&FreeMonoBold9pt7b);
  611. display.setTextColor(GxEPD_BLACK);
  612. for (uint16_t r = 0; r <= 4; r++)
  613. {
  614. display.setRotation(r);
  615. display.fillScreen(GxEPD_WHITE);
  616. display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
  617. display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
  618. display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
  619. display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
  620. display.setCursor(display.width() / 2, display.height() / 2);
  621. display.print(display.getRotation());
  622. display.display(false); // full update
  623. delay(2000);
  624. }
  625. }
  626. void showFont(const char name[], const GFXfont* f)
  627. {
  628. display.setFullWindow();
  629. display.setRotation(0);
  630. display.setTextColor(GxEPD_BLACK);
  631. drawFont(name, f);
  632. display.display(false); // full update
  633. }
  634. void drawFont(const char name[], const GFXfont* f)
  635. {
  636. //display.setRotation(0);
  637. display.fillScreen(GxEPD_WHITE);
  638. display.setTextColor(GxEPD_BLACK);
  639. display.setFont(f);
  640. display.setCursor(0, 0);
  641. display.println();
  642. display.println(name);
  643. display.println(" !\"#$%&'()*+,-./");
  644. display.println("0123456789:;<=>?");
  645. display.println("@ABCDEFGHIJKLMNO");
  646. display.println("PQRSTUVWXYZ[\\]^_");
  647. if (display.epd2.hasColor)
  648. {
  649. display.setTextColor(GxEPD_RED);
  650. }
  651. display.println("`abcdefghijklmno");
  652. display.println("pqrstuvwxyz{|}~ ");
  653. }
  654. // note for partial update window and setPartialWindow() method:
  655. // partial update window size and position is on byte boundary in physical x direction
  656. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  657. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  658. // showPartialUpdate() purposely uses values that are not multiples of 8 to test this
  659. void showPartialUpdate()
  660. {
  661. // some useful background
  662. helloWorld();
  663. // use asymmetric values for test
  664. uint16_t box_x = 10;
  665. uint16_t box_y = 15;
  666. uint16_t box_w = 70;
  667. uint16_t box_h = 20;
  668. uint16_t cursor_y = box_y + box_h - 6;
  669. float value = 13.95;
  670. uint16_t incr = display.epd2.hasFastPartialUpdate ? 1 : 3;
  671. display.setFont(&FreeMonoBold9pt7b);
  672. display.setTextColor(GxEPD_BLACK);
  673. display.setFullWindow();
  674. // show where the update box is
  675. for (uint16_t r = 0; r < 4; r++)
  676. {
  677. display.setRotation(r);
  678. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  679. //display.fillScreen(GxEPD_BLACK);
  680. display.displayWindow(box_x, box_y, box_w, box_h);
  681. delay(2000);
  682. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  683. display.displayWindow(box_x, box_y, box_w, box_h);
  684. delay(1000);
  685. }
  686. //return;
  687. // show updates in the update box
  688. for (uint16_t r = 0; r < 4; r++)
  689. {
  690. display.setRotation(r);
  691. for (uint16_t i = 1; i <= 10; i += incr)
  692. {
  693. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  694. display.setCursor(box_x, cursor_y);
  695. display.print(value * i, 2);
  696. display.displayWindow(box_x, box_y, box_w, box_h);
  697. delay(500);
  698. }
  699. delay(1000);
  700. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  701. display.displayWindow(box_x, box_y, box_w, box_h);
  702. delay(1000);
  703. }
  704. }
  705. void drawBitmaps()
  706. {
  707. display.setFullWindow();
  708. #ifdef _GxBitmaps104x212_H_
  709. drawBitmaps104x212();
  710. #endif
  711. #ifdef _GxBitmaps128x250_H_
  712. drawBitmaps128x250();
  713. #endif
  714. #ifdef _GxBitmaps128x296_H_
  715. drawBitmaps128x296();
  716. #endif
  717. #ifdef _GxBitmaps176x264_H_
  718. drawBitmaps176x264();
  719. #endif
  720. #ifdef _GxBitmaps400x300_H_
  721. drawBitmaps400x300();
  722. #endif
  723. #ifdef _GxBitmaps640x384_H_
  724. drawBitmaps640x384();
  725. #endif
  726. #ifdef _WS_Bitmaps800x600_H_
  727. drawBitmaps800x600();
  728. #endif
  729. // 3-color
  730. #ifdef _GxBitmaps3c104x212_H_
  731. drawBitmaps3c104x212();
  732. #endif
  733. #ifdef _GxBitmaps3c128x296_H_
  734. drawBitmaps3c128x296();
  735. #endif
  736. #ifdef _GxBitmaps3c176x264_H_
  737. drawBitmaps3c176x264();
  738. #endif
  739. #ifdef _GxBitmaps3c400x300_H_
  740. drawBitmaps3c400x300();
  741. #endif
  742. // show these after the specific bitmaps
  743. #ifdef _GxBitmaps200x200_H_
  744. drawBitmaps200x200();
  745. #endif
  746. // 3-color
  747. #ifdef _GxBitmaps3c200x200_H_
  748. drawBitmaps3c200x200();
  749. #endif
  750. }
  751. #ifdef _GxBitmaps200x200_H_
  752. void drawBitmaps200x200()
  753. {
  754. #if defined(__AVR)
  755. const unsigned char* bitmaps[] =
  756. {
  757. logo200x200, first200x200 //, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  758. };
  759. #elif defined(_BOARD_GENERIC_STM32F103C_H_)
  760. const unsigned char* bitmaps[] =
  761. {
  762. logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200 //, sixth200x200, senventh200x200, eighth200x200
  763. };
  764. #else
  765. const unsigned char* bitmaps[] =
  766. {
  767. logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  768. };
  769. #endif
  770. if ((display.epd2.panel == GxEPD2::GDEP015OC1) || (display.epd2.panel == GxEPD2::GDEH0154D67))
  771. {
  772. bool m = display.mirror(true);
  773. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  774. {
  775. display.fillScreen(GxEPD_WHITE);
  776. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  777. display.display();
  778. delay(2000);
  779. }
  780. display.mirror(m);
  781. }
  782. //else
  783. {
  784. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  785. display.clearScreen(); // use default for white
  786. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  787. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  788. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  789. {
  790. display.drawImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  791. delay(2000);
  792. }
  793. }
  794. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  795. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  796. {
  797. int16_t x = -60;
  798. int16_t y = -60;
  799. for (uint16_t j = 0; j < 10; j++)
  800. {
  801. display.writeScreenBuffer(); // use default for white
  802. display.writeImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  803. display.refresh(true);
  804. if (display.epd2.hasFastPartialUpdate)
  805. {
  806. // for differential update: set previous buffer equal to current buffer in controller
  807. display.epd2.writeScreenBufferAgain(); // use default for white
  808. display.epd2.writeImageAgain(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  809. }
  810. delay(2000);
  811. x += 40;
  812. y += 40;
  813. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  814. }
  815. if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
  816. break; // comment out for full show
  817. }
  818. display.writeScreenBuffer(); // use default for white
  819. display.writeImage(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  820. display.writeImage(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
  821. display.refresh(true);
  822. delay(2000);
  823. }
  824. #endif
  825. #ifdef _GxBitmaps104x212_H_
  826. void drawBitmaps104x212()
  827. {
  828. #if !defined(__AVR)
  829. const unsigned char* bitmaps[] =
  830. {
  831. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  832. };
  833. #else
  834. const unsigned char* bitmaps[] =
  835. {
  836. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  837. };
  838. #endif
  839. if (display.epd2.panel == GxEPD2::GDEW0213I5F)
  840. {
  841. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  842. {
  843. display.fillScreen(GxEPD_WHITE);
  844. display.drawBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  845. display.display();
  846. delay(2000);
  847. }
  848. }
  849. }
  850. #endif
  851. #ifdef _GxBitmaps128x250_H_
  852. void drawBitmaps128x250()
  853. {
  854. #if !defined(__AVR)
  855. const unsigned char* bitmaps[] =
  856. {
  857. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  858. };
  859. #else
  860. const unsigned char* bitmaps[] =
  861. {
  862. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  863. };
  864. #endif
  865. if ((display.epd2.panel == GxEPD2::GDE0213B1) || (display.epd2.panel == GxEPD2::GDEH0213B72))
  866. {
  867. bool m = display.mirror(true);
  868. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  869. {
  870. display.fillScreen(GxEPD_WHITE);
  871. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  872. display.display();
  873. delay(2000);
  874. }
  875. display.mirror(m);
  876. }
  877. }
  878. #endif
  879. #ifdef _GxBitmaps128x296_H_
  880. void drawBitmaps128x296()
  881. {
  882. #if !defined(__AVR)
  883. const unsigned char* bitmaps[] =
  884. {
  885. Bitmap128x296_1, logo128x296, first128x296, second128x296, third128x296
  886. };
  887. #else
  888. const unsigned char* bitmaps[] =
  889. {
  890. Bitmap128x296_1, logo128x296 //, first128x296, second128x296, third128x296
  891. };
  892. #endif
  893. if (display.epd2.panel == GxEPD2::GDEH029A1)
  894. {
  895. bool m = display.mirror(true);
  896. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  897. {
  898. display.fillScreen(GxEPD_WHITE);
  899. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  900. display.display();
  901. delay(2000);
  902. }
  903. display.mirror(m);
  904. }
  905. }
  906. #endif
  907. #ifdef _GxBitmaps176x264_H_
  908. void drawBitmaps176x264()
  909. {
  910. #if !defined(__AVR)
  911. const unsigned char* bitmaps[] =
  912. {
  913. Bitmap176x264_1, Bitmap176x264_2, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  914. };
  915. #else
  916. const unsigned char* bitmaps[] =
  917. {
  918. Bitmap176x264_1, Bitmap176x264_2 //, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  919. };
  920. #endif
  921. if (display.epd2.panel == GxEPD2::GDEW027W3)
  922. {
  923. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  924. {
  925. display.fillScreen(GxEPD_WHITE);
  926. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  927. display.display();
  928. delay(2000);
  929. }
  930. }
  931. }
  932. #endif
  933. #ifdef _GxBitmaps400x300_H_
  934. void drawBitmaps400x300()
  935. {
  936. #if !defined(__AVR)
  937. const unsigned char* bitmaps[] =
  938. {
  939. Bitmap400x300_1, Bitmap400x300_2
  940. };
  941. #else
  942. const unsigned char* bitmaps[] = {}; // not enough code space
  943. #endif
  944. if (display.epd2.panel == GxEPD2::GDEW042T2)
  945. {
  946. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  947. {
  948. display.fillScreen(GxEPD_WHITE);
  949. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  950. display.display();
  951. delay(2000);
  952. }
  953. }
  954. }
  955. #endif
  956. #ifdef _GxBitmaps640x384_H_
  957. void drawBitmaps640x384()
  958. {
  959. #if !defined(__AVR)
  960. const unsigned char* bitmaps[] =
  961. {
  962. Bitmap640x384_1, Bitmap640x384_2
  963. };
  964. #else
  965. const unsigned char* bitmaps[] = {}; // not enough code space
  966. #endif
  967. if ((display.epd2.panel == GxEPD2::GDEW075T8) || (display.epd2.panel == GxEPD2::GDEW075Z09))
  968. {
  969. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  970. {
  971. display.fillScreen(GxEPD_WHITE);
  972. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  973. display.display();
  974. delay(2000);
  975. }
  976. }
  977. }
  978. #endif
  979. #ifdef _WS_Bitmaps800x600_H_
  980. void drawBitmaps800x600()
  981. {
  982. #if defined(ESP8266) || defined(ESP32)
  983. if (display.epd2.panel == GxEPD2::ED060SCT)
  984. {
  985. // Serial.print("sizeof(WS_zoo_800x600) is "); Serial.println(sizeof(WS_zoo_800x600));
  986. display.drawNative(WS_zoo_800x600, 0, 0, 0, 800, 600, false, false, true);
  987. delay(2000);
  988. // Serial.print("sizeof(WS_pic_1200x825) is "); Serial.println(sizeof(WS_pic_1200x825));
  989. // display.drawNative((const uint8_t*)WS_pic_1200x825, 0, 0, 0, 1200, 825, false, false, true);
  990. // delay(2000);
  991. // Serial.print("sizeof(WS_acaa_1024x731) is "); Serial.println(sizeof(WS_acaa_1024x731));
  992. // display.drawNative(WS_acaa_1024x731, 0, 0, 0, 1024, 731, false, false, true);
  993. // delay(2000);
  994. }
  995. #endif
  996. }
  997. #endif
  998. struct bitmap_pair
  999. {
  1000. const unsigned char* black;
  1001. const unsigned char* red;
  1002. };
  1003. #ifdef _GxBitmaps3c200x200_H_
  1004. void drawBitmaps3c200x200()
  1005. {
  1006. bitmap_pair bitmap_pairs[] =
  1007. {
  1008. //{Bitmap3c200x200_black, Bitmap3c200x200_red},
  1009. {WS_Bitmap3c200x200_black, WS_Bitmap3c200x200_red}
  1010. };
  1011. if (display.epd2.panel == GxEPD2::GDEW0154Z04)
  1012. {
  1013. display.fillScreen(GxEPD_WHITE);
  1014. // Bitmap3c200x200_black has 2 bits per pixel
  1015. // taken from Adafruit_GFX.cpp, modified
  1016. int16_t byteWidth = (display.epd2.WIDTH + 7) / 8; // Bitmap scanline pad = whole byte
  1017. uint8_t byte = 0;
  1018. for (int16_t j = 0; j < display.epd2.HEIGHT; j++)
  1019. {
  1020. for (int16_t i = 0; i < display.epd2.WIDTH; i++)
  1021. {
  1022. if (i & 3) byte <<= 2;
  1023. else
  1024. {
  1025. #if defined(__AVR) || defined(ESP8266) || defined(ESP32)
  1026. byte = pgm_read_byte(&Bitmap3c200x200_black[j * byteWidth * 2 + i / 4]);
  1027. #else
  1028. byte = Bitmap3c200x200_black[j * byteWidth * 2 + i / 4];
  1029. #endif
  1030. }
  1031. if (!(byte & 0x80))
  1032. {
  1033. display.drawPixel(i, j, GxEPD_BLACK);
  1034. }
  1035. }
  1036. }
  1037. display.drawInvertedBitmap(0, 0, Bitmap3c200x200_red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1038. display.display();
  1039. delay(2000);
  1040. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1041. {
  1042. display.fillScreen(GxEPD_WHITE);
  1043. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1044. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1045. display.display();
  1046. delay(2000);
  1047. }
  1048. }
  1049. if (display.epd2.hasColor)
  1050. {
  1051. display.clearScreen(); // use default for white
  1052. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  1053. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  1054. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1055. {
  1056. display.drawImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1057. delay(2000);
  1058. }
  1059. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1060. {
  1061. int16_t x = -60;
  1062. int16_t y = -60;
  1063. for (uint16_t j = 0; j < 10; j++)
  1064. {
  1065. display.writeScreenBuffer(); // use default for white
  1066. display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1067. display.refresh();
  1068. delay(1000);
  1069. x += 40;
  1070. y += 40;
  1071. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  1072. }
  1073. }
  1074. display.writeScreenBuffer(); // use default for white
  1075. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, 0, 0, 200, 200, false, false, true);
  1076. 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);
  1077. display.refresh();
  1078. delay(2000);
  1079. }
  1080. }
  1081. #endif
  1082. #ifdef _GxBitmaps3c104x212_H_
  1083. void drawBitmaps3c104x212()
  1084. {
  1085. #if !defined(__AVR)
  1086. bitmap_pair bitmap_pairs[] =
  1087. {
  1088. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1089. {Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1090. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1091. };
  1092. #else
  1093. bitmap_pair bitmap_pairs[] =
  1094. {
  1095. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1096. //{Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1097. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1098. };
  1099. #endif
  1100. if (display.epd2.panel == GxEPD2::GDEW0213Z16)
  1101. {
  1102. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1103. {
  1104. display.fillScreen(GxEPD_WHITE);
  1105. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1106. if (bitmap_pairs[i].red == WS_Bitmap3c104x212_red)
  1107. {
  1108. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1109. }
  1110. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1111. display.display();
  1112. delay(2000);
  1113. }
  1114. }
  1115. }
  1116. #endif
  1117. #ifdef _GxBitmaps3c128x296_H_
  1118. void drawBitmaps3c128x296()
  1119. {
  1120. #if !defined(__AVR)
  1121. bitmap_pair bitmap_pairs[] =
  1122. {
  1123. {Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1124. {Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1125. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1126. };
  1127. #else
  1128. bitmap_pair bitmap_pairs[] =
  1129. {
  1130. //{Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1131. //{Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1132. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1133. };
  1134. #endif
  1135. if (display.epd2.panel == GxEPD2::GDEW029Z10)
  1136. {
  1137. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1138. {
  1139. display.fillScreen(GxEPD_WHITE);
  1140. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1141. if (bitmap_pairs[i].red == WS_Bitmap3c128x296_red)
  1142. {
  1143. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1144. }
  1145. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1146. display.display();
  1147. delay(2000);
  1148. }
  1149. }
  1150. }
  1151. #endif
  1152. #ifdef _GxBitmaps3c176x264_H_
  1153. void drawBitmaps3c176x264()
  1154. {
  1155. bitmap_pair bitmap_pairs[] =
  1156. {
  1157. {Bitmap3c176x264_black, Bitmap3c176x264_red}
  1158. };
  1159. if (display.epd2.panel == GxEPD2::GDEW027C44)
  1160. {
  1161. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1162. {
  1163. display.fillScreen(GxEPD_WHITE);
  1164. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1165. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1166. display.display();
  1167. delay(2000);
  1168. }
  1169. }
  1170. }
  1171. #endif
  1172. #ifdef _GxBitmaps3c400x300_H_
  1173. void drawBitmaps3c400x300()
  1174. {
  1175. #if !defined(__AVR)
  1176. bitmap_pair bitmap_pairs[] =
  1177. {
  1178. {Bitmap3c400x300_1_black, Bitmap3c400x300_1_red},
  1179. {Bitmap3c400x300_2_black, Bitmap3c400x300_2_red},
  1180. {WS_Bitmap3c400x300_black, WS_Bitmap3c400x300_red}
  1181. };
  1182. #else
  1183. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1184. #endif
  1185. if (display.epd2.panel == GxEPD2::GDEW042Z15)
  1186. {
  1187. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1188. {
  1189. display.fillScreen(GxEPD_WHITE);
  1190. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1191. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1192. display.display();
  1193. delay(2000);
  1194. }
  1195. }
  1196. }
  1197. #endif