GxEPD2_Example.ino 79 KB

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