GxEPD2_Example.ino 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280
  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: https://www.good-display.com/companyfile/32/
  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 (closed, read only):
  12. // Good Display ePaper for Arduino: https://forum.arduino.cc/t/good-display-epaper-for-arduino/419657
  13. // Waveshare e-paper displays with SPI: https://forum.arduino.cc/t/waveshare-e-paper-displays-with-spi/467865
  14. //
  15. // Add new topics in https://forum.arduino.cc/c/using-arduino/displays/23 for new questions and issues
  16. // see GxEPD2_wiring_examples.h for wiring suggestions and examples
  17. // NOTE for use with Waveshare ESP32 Driver Board:
  18. // **** also need to select the constructor with the parameters for this board in GxEPD2_display_selection_new_style.h ****
  19. //
  20. // The Wavehare ESP32 Driver Board uses uncommon SPI pins for the FPC connector. It uses HSPI pins, but SCK and MOSI are swapped.
  21. // To use HW SPI with the ESP32 Driver Board, HW SPI pins need be re-mapped in any case. Can be done using either HSPI or VSPI.
  22. // Other SPI clients can either be connected to the same SPI bus as the e-paper, or to the other HW SPI bus, or through SW SPI.
  23. // The logical configuration would be to use the e-paper connection on HSPI with re-mapped pins, and use VSPI for other SPI clients.
  24. // VSPI with standard VSPI pins is used by the global SPI instance of the Arduino IDE ESP32 package.
  25. // uncomment next line to use HSPI for EPD (and e.g VSPI for SD), e.g. with Waveshare ESP32 Driver Board
  26. //#define USE_HSPI_FOR_EPD
  27. // base class GxEPD2_GFX can be used to pass references or pointers to the display instance as parameter, uses ~1.2k more code
  28. // enable or disable GxEPD2_GFX base class
  29. #define ENABLE_GxEPD2_GFX 0
  30. // uncomment next line to use class GFX of library GFX_Root instead of Adafruit_GFX
  31. //#include <GFX.h>
  32. // Note: if you use this with ENABLE_GxEPD2_GFX 1:
  33. // uncomment it in GxEPD2_GFX.h too, or add #include <GFX.h> before any #include <GxEPD2_GFX.h>
  34. #include <GxEPD2_BW.h>
  35. #include <GxEPD2_3C.h>
  36. #include <GxEPD2_4C.h>
  37. #include <GxEPD2_7C.h>
  38. #include <Fonts/FreeMonoBold9pt7b.h>
  39. #include <Fonts/FreeMonoBold12pt7b.h>
  40. // select the display constructor line in one of the following files (old style):
  41. #include "GxEPD2_display_selection.h"
  42. #include "GxEPD2_display_selection_added.h"
  43. // or select the display class and display driver class in the following file (new style):
  44. #include "GxEPD2_display_selection_new_style.h"
  45. //#define WITHOUT_BITMAPS
  46. #ifndef WITHOUT_BITMAPS
  47. #if !defined(__AVR) && !defined(STM32F1xx)
  48. // note 16.11.2019: the compiler may exclude code based on constant if statements (display.epd2.panel == constant),
  49. // therefore bitmaps may get optimized out by the linker
  50. // comment out unused bitmaps to reduce code space used
  51. #include "bitmaps/Bitmaps80x128.h" // 1.02" b/w
  52. #include "bitmaps/Bitmaps152x152.h" // 1.54" b/w
  53. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  54. #include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  55. #include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  56. #include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  57. #include "bitmaps/Bitmaps168x384.h" // 2.9" b/w
  58. #include "bitmaps/Bitmaps152x296.h" // 2.6" b/w
  59. #include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  60. #include "bitmaps/Bitmaps240x360.h" // 3.1" b/w
  61. #include "bitmaps/Bitmaps240x416.h" // 3.71" b/w
  62. #include "bitmaps/Bitmaps400x300.h" // 4.2" b/w
  63. #include "bitmaps/Bitmaps648x480.h" // 5.38" b/w
  64. #include "bitmaps/Bitmaps640x384.h" // 7.5" b/w
  65. #include "bitmaps/Bitmaps800x276.h" // 5.79" b/w
  66. #include "bitmaps/Bitmaps800x480.h" // 7.5" b/w
  67. #include "bitmaps/Bitmaps960x640.h" // 10.2" b/w
  68. #include "bitmaps/Bitmaps960x680.h" // 13.3" b/w
  69. // 3-color
  70. #include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  71. #include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  72. #include "bitmaps/Bitmaps3c128x250.h" // 2.13" b/w/r
  73. #include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  74. #include "bitmaps/Bitmaps3c152x296.h" // 2.66" b/w/r
  75. #include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  76. #include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r
  77. #if defined(ESP8266) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
  78. #include "bitmaps/Bitmaps3c800x276.h" // 5.79" b/w/r
  79. #include "bitmaps/Bitmaps3c648x480.h" // 5.83" b/w/r
  80. #include "bitmaps/Bitmaps3c800x480.h" // 7.5" b/w/r
  81. #include "bitmaps/Bitmaps3c880x528.h" // 7.5" b/w/r
  82. #include "bitmaps/Bitmaps3c960x640.h" // 11.6" b/w/r
  83. #include "bitmaps/Bitmaps3c960x680.h" // 13.3" b/w/r
  84. #include "bitmaps/WS_Bitmaps800x600.h" // 6.0" grey
  85. // 4-color
  86. #include "bitmaps/Bitmaps4c128x250.h" // 2.13" 4-color
  87. #include "bitmaps/Bitmaps4c184x360.h" // 2.66" 4-color
  88. #include "bitmaps/Bitmaps4c168x384.h" // 2.9" 4-color
  89. #include "bitmaps/WS_Bitmaps4c168x168.h" // 4.37" 4-color
  90. #include "bitmaps/WS_Bitmaps4c168x400.h" // 3.00" 4-color
  91. #include "bitmaps/Bitmaps4c400x300.h" // 4.2" 4-color
  92. #include "bitmaps/Bitmaps4c792x272.h" // 5.79" 4-color
  93. #include "bitmaps/Bitmaps4c960x640.h" // 11.6" 4-color
  94. // 7-color
  95. #include "bitmaps/Bitmaps7c600x448.h" // 5.65" 7-color
  96. #include "bitmaps/WS_Bitmaps7c192x143.h" // 5.65" 7-color
  97. #include "bitmaps/WS_Bitmaps7c300x180.h" // 7.3" 7-color
  98. #endif
  99. #if defined(ESP32) || defined(ESP_PLATFORM) || defined(ARDUINO_ARCH_RP2040)
  100. #include "bitmaps/Bitmaps1304x984.h" // 12.48" b/w
  101. #include "bitmaps/Bitmaps1360x480.h" // 10.85" b/w
  102. #include "bitmaps/Bitmaps3c1304x984.h" // 12.48" b/w/r
  103. #include "bitmaps/Bitmaps7c800x480.h" // 7.3" 7-color
  104. #endif
  105. #else
  106. // select only one to fit in code space
  107. //#include "bitmaps/Bitmaps80x128.h" // 1.02" b/w
  108. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  109. //#include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  110. //#include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  111. //#include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  112. #include "bitmaps/Bitmaps168x384.h" // 2.9" b/w
  113. //#include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  114. ////#include "bitmaps/Bitmaps400x300.h" // 4.2" b/w // not enough code space
  115. ////#include "bitmaps/Bitmaps640x384.h" // 7.5" b/w // not enough code space
  116. ////#include "bitmaps/Bitmaps800x480.h" // 7.5" b/w // not enough code space
  117. // 3-color
  118. //#include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  119. //#include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  120. #include "bitmaps/Bitmaps3c128x250.h" // 2.13" b/w/r
  121. //#include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  122. //#include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  123. ////#include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r // not enough code space
  124. #endif
  125. #endif
  126. #if defined(ARDUINO_ARCH_RP2040) && (defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_RASPBERRY_PI_PICO_W))
  127. #if defined(__MBED__)
  128. // SPI pins used by GoodDisplay DESPI-PICO. note: steals standard I2C pins PIN_WIRE_SDA (6), PIN_WIRE_SCL (7)
  129. // uncomment next line for use with GoodDisplay DESPI-PICO. // MbedSPI(int miso, int mosi, int sck);
  130. arduino::MbedSPI SPIn(4, 7, 6); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
  131. // uncomment next line for use with my proto board. // MbedSPI(int miso, int mosi, int sck);
  132. //arduino::MbedSPI SPIn(4, 3, 2); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
  133. // uncomment next line for use with Waveshare Pico-ePaper-2.9. // MbedSPI(int miso, int mosi, int sck);
  134. // note: doesn't work with Waveshare PhotoPainter, conflict on pin 12. use philhower package instead.
  135. //arduino::MbedSPI SPIn(12, 11, 10); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
  136. #else // package https://github.com/earlephilhower/arduino-pico
  137. // SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pin_size_t sck, pin_size_t tx);
  138. // uncomment next line for use with my proto board.
  139. //SPIClassRP2040 SPIn(spi0, 4, 5, 2, 3); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
  140. // uncomment next line for use with Waveshare Pico-ePaper-2.9 or Waveshare PhotoPainter module
  141. SPIClassRP2040 SPIn(spi1, 12, 13, 10, 11); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
  142. #endif
  143. #endif
  144. #if defined(ESP32) && defined(USE_HSPI_FOR_EPD)
  145. SPIClass hspi(HSPI);
  146. #endif
  147. void setup()
  148. {
  149. Serial.begin(115200);
  150. Serial.println();
  151. Serial.println("setup");
  152. delay(100);
  153. #if defined(ARDUINO_ARCH_RP2040) && (defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_RASPBERRY_PI_PICO_W))
  154. // uncomment next line for use with GoodDisplay DESPI-PICO or my proto board, or Waveshare RPi boards
  155. display.epd2.selectSPI(SPIn, SPISettings(4000000, MSBFIRST, SPI_MODE0));
  156. // uncomment next 2 lines to allow recovery from configuration failures
  157. pinMode(15, INPUT_PULLUP); // safety pin
  158. while (!digitalRead(15)) delay(100); // check safety pin for fail recovery
  159. // recovery can be done also by holding BOOTSEL during power-up.
  160. // uncomment next line for Waveshare PhotoPainter module
  161. pinMode(16, OUTPUT); digitalWrite(16, HIGH); // power to the paper
  162. #endif
  163. #if defined(ESP32) && defined(USE_HSPI_FOR_EPD)
  164. hspi.begin(13, 12, 14, 15); // remap hspi for EPD (swap pins)
  165. display.epd2.selectSPI(hspi, SPISettings(4000000, MSBFIRST, SPI_MODE0));
  166. #elif (defined(ARDUINO_ARCH_ESP32) && defined(ARDUINO_LOLIN_S2_MINI))
  167. // SPI.begin(sck, miso, mosi, ss); // preset for remapped pins
  168. SPI.begin(18, -1, 16, 33); // my LOLIN ESP32 S2 mini connection
  169. #endif
  170. #if defined(ESP32) && defined(ARDUINO_ESP32S3_DEV) && true // CrowPanel
  171. pinMode(7, OUTPUT);
  172. digitalWrite(7, HIGH); // enable power to the panel
  173. #endif
  174. //display.init(115200); // default 10ms reset pulse, e.g. for bare panels with DESPI-C02
  175. display.init(115200, true, 2, false); // USE THIS for Waveshare boards with "clever" reset circuit, 2ms reset pulse
  176. //display.init(115200, true, 10, false, SPIn, SPISettings(4000000, MSBFIRST, SPI_MODE0)); // extended init method with SPI channel and/or settings selection
  177. if (display.pages() > 1)
  178. {
  179. delay(100);
  180. Serial.print("pages = "); Serial.print(display.pages()); Serial.print(" page height = "); Serial.println(display.pageHeight());
  181. delay(1000);
  182. }
  183. //display.clearScreen(); return;
  184. // first update should be full refresh
  185. helloWorld();
  186. delay(1000);
  187. // partial refresh mode can be used to full screen,
  188. // effective if display panel hasFastPartialUpdate
  189. helloFullScreenPartialMode();
  190. delay(1000);
  191. //stripeTest(); return; // GDEH029Z13 issue
  192. helloArduino();
  193. delay(1000);
  194. helloEpaper();
  195. delay(1000);
  196. //helloValue(123.9, 1);
  197. //delay(1000);
  198. showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  199. //showFont("FreeMonoBold12pt7b", &FreeMonoBold12pt7b);
  200. delay(1000);
  201. if (display.epd2.WIDTH < 104)
  202. {
  203. showFont("glcdfont", 0);
  204. delay(1000);
  205. }
  206. //drawGrid(); return;
  207. //drawCornerTest(); return;
  208. display.writeScreenBuffer();
  209. drawBitmaps();
  210. //display.powerOff(); return;
  211. drawGraphics();
  212. //display.powerOff(); return;
  213. #if !defined(__AVR) // takes too long!
  214. if ((display.epd2.panel == GxEPD2::ACeP565) || (display.epd2.panel == GxEPD2::GDEY073D46) || (display.epd2.panel == GxEPD2::ACeP730) ||
  215. (display.epd2.panel == GxEPD2::GDEP0565D90) || (display.epd2.panel == GxEPD2::GDEP073E01))
  216. {
  217. //draw7colorlines();
  218. //delay(2000);
  219. draw7colors();
  220. delay(4000);
  221. display.epd2.drawNativeColors(); delay(2000);
  222. //return;
  223. }
  224. #endif
  225. if (display.epd2.hasPartialUpdate)
  226. {
  227. showPartialUpdate();
  228. delay(1000);
  229. } // else // on GDEW0154Z04 only full update available, doesn't look nice
  230. //drawCornerTest();
  231. //showBox(16, 16, 48, 32, false);
  232. //showBox(16, 56, 48, 32, true);
  233. display.powerOff();
  234. deepSleepTest();
  235. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  236. drawBitmaps1304x984();
  237. display.powerOff();
  238. #endif
  239. Serial.println("setup done");
  240. display.end();
  241. }
  242. void loop()
  243. {
  244. }
  245. // note for partial update window and setPartialWindow() method:
  246. // partial update window size and position is on byte boundary in physical x direction
  247. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  248. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  249. const char HelloWorld[] = "Hello World!";
  250. const char HelloArduino[] = "Hello Arduino!";
  251. const char HelloEpaper[] = "Hello E-Paper!";
  252. void helloWorld()
  253. {
  254. //Serial.println("helloWorld");
  255. display.setRotation(1);
  256. display.setFont(&FreeMonoBold9pt7b);
  257. if (display.epd2.WIDTH < 104) display.setFont(0);
  258. display.setTextColor(GxEPD_BLACK);
  259. int16_t tbx, tby; uint16_t tbw, tbh;
  260. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  261. // center bounding box by transposition of origin:
  262. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  263. uint16_t y = ((display.height() - tbh) / 2) - tby;
  264. display.setFullWindow();
  265. display.firstPage();
  266. do
  267. {
  268. display.fillScreen(GxEPD_WHITE);
  269. display.setCursor(x, y);
  270. display.print(HelloWorld);
  271. }
  272. while (display.nextPage());
  273. //Serial.println("helloWorld done");
  274. }
  275. void helloWorldForDummies()
  276. {
  277. //Serial.println("helloWorld");
  278. const char text[] = "Hello World!";
  279. // most e-papers have width < height (portrait) as native orientation, especially the small ones
  280. // in GxEPD2 rotation 0 is used for native orientation (most TFT libraries use 0 fix for portrait orientation)
  281. // set rotation to 1 (rotate right 90 degrees) to have enough space on small displays (landscape)
  282. display.setRotation(1);
  283. // select a suitable font in Adafruit_GFX
  284. display.setFont(&FreeMonoBold9pt7b);
  285. // on e-papers black on white is more pleasant to read
  286. display.setTextColor(GxEPD_BLACK);
  287. // Adafruit_GFX has a handy method getTextBounds() to determine the boundary box for a text for the actual font
  288. int16_t tbx, tby; uint16_t tbw, tbh; // boundary box window
  289. display.getTextBounds(text, 0, 0, &tbx, &tby, &tbw, &tbh); // it works for origin 0, 0, fortunately (negative tby!)
  290. // center bounding box by transposition of origin:
  291. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  292. uint16_t y = ((display.height() - tbh) / 2) - tby;
  293. // full window mode is the initial mode, set it anyway
  294. display.setFullWindow();
  295. // here we use paged drawing, even if the processor has enough RAM for full buffer
  296. // so this can be used with any supported processor board.
  297. // the cost in code overhead and execution time penalty is marginal
  298. // tell the graphics class to use paged drawing mode
  299. display.firstPage();
  300. do
  301. {
  302. // this part of code is executed multiple times, as many as needed,
  303. // in case of full buffer it is executed once
  304. // IMPORTANT: each iteration needs to draw the same, to avoid strange effects
  305. // use a copy of values that might change, don't read e.g. from analog or pins in the loop!
  306. display.fillScreen(GxEPD_WHITE); // set the background to white (fill the buffer with value for white)
  307. display.setCursor(x, y); // set the postition to start printing text
  308. display.print(text); // print some text
  309. // end of part executed multiple times
  310. }
  311. // tell the graphics class to transfer the buffer content (page) to the controller buffer
  312. // the graphics class will command the controller to refresh to the screen when the last page has been transferred
  313. // returns true if more pages need be drawn and transferred
  314. // returns false if the last page has been transferred and the screen refreshed for panels without fast partial update
  315. // returns false for panels with fast partial update when the controller buffer has been written once more, to make the differential buffers equal
  316. // (for full buffered with fast partial update the (full) buffer is just transferred again, and false returned)
  317. while (display.nextPage());
  318. //Serial.println("helloWorld done");
  319. }
  320. void helloFullScreenPartialMode()
  321. {
  322. //Serial.println("helloFullScreenPartialMode");
  323. const char fullscreen[] = "full screen update";
  324. const char fpm[] = "fast partial mode";
  325. const char spm[] = "slow partial mode";
  326. const char npm[] = "no partial mode";
  327. display.setPartialWindow(0, 0, display.width(), display.height());
  328. display.setRotation(1);
  329. display.setFont(&FreeMonoBold9pt7b);
  330. if (display.epd2.WIDTH < 104) display.setFont(0);
  331. display.setTextColor(GxEPD_BLACK);
  332. const char* updatemode;
  333. if (display.epd2.hasFastPartialUpdate)
  334. {
  335. updatemode = fpm;
  336. }
  337. else if (display.epd2.hasPartialUpdate)
  338. {
  339. updatemode = spm;
  340. }
  341. else
  342. {
  343. updatemode = npm;
  344. }
  345. // do this outside of the loop
  346. int16_t tbx, tby; uint16_t tbw, tbh;
  347. // center update text
  348. display.getTextBounds(fullscreen, 0, 0, &tbx, &tby, &tbw, &tbh);
  349. uint16_t utx = ((display.width() - tbw) / 2) - tbx;
  350. uint16_t uty = ((display.height() / 4) - tbh / 2) - tby;
  351. // center update mode
  352. display.getTextBounds(updatemode, 0, 0, &tbx, &tby, &tbw, &tbh);
  353. uint16_t umx = ((display.width() - tbw) / 2) - tbx;
  354. uint16_t umy = ((display.height() * 3 / 4) - tbh / 2) - tby;
  355. // center HelloWorld
  356. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  357. uint16_t hwx = ((display.width() - tbw) / 2) - tbx;
  358. uint16_t hwy = ((display.height() - tbh) / 2) - tby;
  359. display.firstPage();
  360. do
  361. {
  362. display.fillScreen(GxEPD_WHITE);
  363. display.setCursor(hwx, hwy);
  364. display.print(HelloWorld);
  365. display.setCursor(utx, uty);
  366. display.print(fullscreen);
  367. display.setCursor(umx, umy);
  368. display.print(updatemode);
  369. }
  370. while (display.nextPage());
  371. //Serial.println("helloFullScreenPartialMode done");
  372. }
  373. void helloArduino()
  374. {
  375. //Serial.println("helloArduino");
  376. display.setRotation(1);
  377. display.setFont(&FreeMonoBold9pt7b);
  378. if (display.epd2.WIDTH < 104) display.setFont(0);
  379. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  380. int16_t tbx, tby; uint16_t tbw, tbh;
  381. // align with centered HelloWorld
  382. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  383. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  384. // height might be different
  385. display.getTextBounds(HelloArduino, 0, 0, &tbx, &tby, &tbw, &tbh);
  386. uint16_t y = ((display.height() / 4) - tbh / 2) - tby; // y is base line!
  387. // make the window big enough to cover (overwrite) descenders of previous text
  388. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  389. uint16_t wy = (display.height() / 4) - wh / 2;
  390. display.setPartialWindow(0, wy, display.width(), wh);
  391. display.firstPage();
  392. do
  393. {
  394. display.fillScreen(GxEPD_WHITE);
  395. //display.drawRect(x, y - tbh, tbw, tbh, GxEPD_BLACK);
  396. display.setCursor(x, y);
  397. display.print(HelloArduino);
  398. }
  399. while (display.nextPage());
  400. delay(1000);
  401. //Serial.println("helloArduino done");
  402. }
  403. void helloEpaper()
  404. {
  405. //Serial.println("helloEpaper");
  406. display.setRotation(1);
  407. display.setFont(&FreeMonoBold9pt7b);
  408. if (display.epd2.WIDTH < 104) display.setFont(0);
  409. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  410. int16_t tbx, tby; uint16_t tbw, tbh;
  411. // align with centered HelloWorld
  412. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  413. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  414. // height might be different
  415. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  416. uint16_t y = ((display.height() * 3 / 4) - tbh / 2) - tby; // y is base line!
  417. // make the window big enough to cover (overwrite) descenders of previous text
  418. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  419. uint16_t wy = (display.height() * 3 / 4) - wh / 2;
  420. display.setPartialWindow(0, wy, display.width(), wh);
  421. display.firstPage();
  422. do
  423. {
  424. display.fillScreen(GxEPD_WHITE);
  425. display.setCursor(x, y);
  426. display.print(HelloEpaper);
  427. }
  428. while (display.nextPage());
  429. //Serial.println("helloEpaper done");
  430. }
  431. // test partial window issue on GDEW0213Z19 and GDEH029Z13
  432. void stripeTest()
  433. {
  434. helloStripe(104);
  435. delay(2000);
  436. helloStripe(96);
  437. }
  438. const char HelloStripe[] = "Hello Stripe!";
  439. void helloStripe(uint16_t pw_xe) // end of partial window in physcal x direction
  440. {
  441. //Serial.print("HelloStripe("); Serial.print(pw_xe); Serial.println(")");
  442. display.setRotation(3);
  443. display.setFont(&FreeMonoBold9pt7b);
  444. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  445. int16_t tbx, tby; uint16_t tbw, tbh;
  446. display.getTextBounds(HelloStripe, 0, 0, &tbx, &tby, &tbw, &tbh);
  447. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  448. uint16_t wy = pw_xe - wh;
  449. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  450. uint16_t y = wy - tby;
  451. display.setPartialWindow(0, wy, display.width(), wh);
  452. display.firstPage();
  453. do
  454. {
  455. display.fillScreen(GxEPD_WHITE);
  456. display.setCursor(x, y);
  457. display.print(HelloStripe);
  458. }
  459. while (display.nextPage());
  460. //Serial.println("HelloStripe done");
  461. }
  462. #if defined(ESP8266) || defined(ESP32)
  463. #include <StreamString.h>
  464. #define PrintString StreamString
  465. #else
  466. class PrintString : public Print, public String
  467. {
  468. public:
  469. size_t write(uint8_t data) override
  470. {
  471. return concat(char(data));
  472. };
  473. };
  474. #endif
  475. void helloValue(double v, int digits)
  476. {
  477. //Serial.println("helloValue");
  478. display.setRotation(1);
  479. display.setFont(&FreeMonoBold9pt7b);
  480. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  481. PrintString valueString;
  482. valueString.print(v, digits);
  483. int16_t tbx, tby; uint16_t tbw, tbh;
  484. display.getTextBounds(valueString, 0, 0, &tbx, &tby, &tbw, &tbh);
  485. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  486. uint16_t y = ((display.height() * 3 / 4) - tbh / 2) - tby; // y is base line!
  487. // show what happens, if we use the bounding box for partial window
  488. uint16_t wx = (display.width() - tbw) / 2;
  489. uint16_t wy = ((display.height() * 3 / 4) - tbh / 2);
  490. display.setPartialWindow(wx, wy, tbw, tbh);
  491. display.firstPage();
  492. do
  493. {
  494. display.fillScreen(GxEPD_WHITE);
  495. display.setCursor(x, y);
  496. display.print(valueString);
  497. }
  498. while (display.nextPage());
  499. delay(2000);
  500. // make the partial window big enough to cover the previous text
  501. uint16_t ww = tbw; // remember window width
  502. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  503. // adjust, because HelloEpaper was aligned, not centered (could calculate this to be precise)
  504. ww = max(ww, uint16_t(tbw + 12)); // 12 seems ok
  505. wx = (display.width() - tbw) / 2;
  506. // make the window big enough to cover (overwrite) descenders of previous text
  507. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  508. wy = (display.height() * 3 / 4) - wh / 2;
  509. display.setPartialWindow(wx, wy, ww, wh);
  510. // alternately use the whole width for partial window
  511. //display.setPartialWindow(0, wy, display.width(), wh);
  512. display.firstPage();
  513. do
  514. {
  515. display.fillScreen(GxEPD_WHITE);
  516. display.setCursor(x, y);
  517. display.print(valueString);
  518. }
  519. while (display.nextPage());
  520. //Serial.println("helloValue done");
  521. }
  522. void deepSleepTest()
  523. {
  524. //Serial.println("deepSleepTest");
  525. const char hibernating[] = "hibernating ...";
  526. const char wokeup[] = "woke up";
  527. const char from[] = "from deep sleep";
  528. const char again[] = "again";
  529. display.setRotation(1);
  530. display.setFont(&FreeMonoBold9pt7b);
  531. if (display.epd2.WIDTH < 104) display.setFont(0);
  532. display.setTextColor(GxEPD_BLACK);
  533. int16_t tbx, tby; uint16_t tbw, tbh;
  534. // center text
  535. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  536. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  537. uint16_t y = ((display.height() - tbh) / 2) - tby;
  538. display.setFullWindow();
  539. display.firstPage();
  540. do
  541. {
  542. display.fillScreen(GxEPD_WHITE);
  543. display.setCursor(x, y);
  544. display.print(hibernating);
  545. }
  546. while (display.nextPage());
  547. display.hibernate();
  548. delay(5000);
  549. display.getTextBounds(wokeup, 0, 0, &tbx, &tby, &tbw, &tbh);
  550. uint16_t wx = (display.width() - tbw) / 2;
  551. uint16_t wy = ((display.height() / 3) - tbh / 2) - tby; // y is base line!
  552. display.getTextBounds(from, 0, 0, &tbx, &tby, &tbw, &tbh);
  553. uint16_t fx = (display.width() - tbw) / 2;
  554. uint16_t fy = ((display.height() * 2 / 3) - tbh / 2) - tby; // y is base line!
  555. display.firstPage();
  556. do
  557. {
  558. display.fillScreen(GxEPD_WHITE);
  559. display.setCursor(wx, wy);
  560. display.print(wokeup);
  561. display.setCursor(fx, fy);
  562. display.print(from);
  563. }
  564. while (display.nextPage());
  565. delay(5000);
  566. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  567. uint16_t hx = (display.width() - tbw) / 2;
  568. uint16_t hy = ((display.height() / 3) - tbh / 2) - tby; // y is base line!
  569. display.getTextBounds(again, 0, 0, &tbx, &tby, &tbw, &tbh);
  570. uint16_t ax = (display.width() - tbw) / 2;
  571. uint16_t ay = ((display.height() * 2 / 3) - tbh / 2) - tby; // y is base line!
  572. display.firstPage();
  573. do
  574. {
  575. display.fillScreen(GxEPD_WHITE);
  576. display.setCursor(hx, hy);
  577. display.print(hibernating);
  578. display.setCursor(ax, ay);
  579. display.print(again);
  580. }
  581. while (display.nextPage());
  582. display.hibernate();
  583. //Serial.println("deepSleepTest done");
  584. }
  585. void showBox(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
  586. {
  587. //Serial.println("showBox");
  588. display.setRotation(1);
  589. if (partial)
  590. {
  591. display.setPartialWindow(x, y, w, h);
  592. }
  593. else
  594. {
  595. display.setFullWindow();
  596. }
  597. display.firstPage();
  598. do
  599. {
  600. display.fillScreen(GxEPD_WHITE);
  601. display.fillRect(x, y, w, h, GxEPD_BLACK);
  602. }
  603. while (display.nextPage());
  604. //Serial.println("showBox done");
  605. }
  606. void drawCornerTest()
  607. {
  608. display.setFullWindow();
  609. display.setFont(&FreeMonoBold9pt7b);
  610. display.setTextColor(GxEPD_BLACK);
  611. for (uint16_t r = 0; r <= 4; r++)
  612. {
  613. display.setRotation(r);
  614. display.firstPage();
  615. do
  616. {
  617. display.fillScreen(GxEPD_WHITE);
  618. display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
  619. display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
  620. display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
  621. display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
  622. display.setCursor(display.width() / 2, display.height() / 2);
  623. display.print(display.getRotation());
  624. }
  625. while (display.nextPage());
  626. delay(2000);
  627. }
  628. }
  629. void showFont(const char name[], const GFXfont* f)
  630. {
  631. display.setFullWindow();
  632. display.setRotation(0);
  633. display.setTextColor(GxEPD_BLACK);
  634. display.firstPage();
  635. do
  636. {
  637. drawFont(name, f);
  638. }
  639. while (display.nextPage());
  640. }
  641. void drawFont(const char name[], const GFXfont* f)
  642. {
  643. //display.setRotation(0);
  644. display.fillScreen(GxEPD_WHITE);
  645. display.setTextColor(GxEPD_BLACK);
  646. display.setFont(f);
  647. display.setCursor(0, 0);
  648. display.println();
  649. display.println(name);
  650. display.println(" !\"#$%&'()*+,-./");
  651. display.println("0123456789:;<=>?");
  652. display.println("@ABCDEFGHIJKLMNO");
  653. display.println("PQRSTUVWXYZ[\\]^_");
  654. if (display.epd2.hasColor)
  655. {
  656. display.setTextColor(GxEPD_RED);
  657. }
  658. display.println("`abcdefghijklmno");
  659. display.println("pqrstuvwxyz{|}~ ");
  660. }
  661. // note for partial update window and setPartialWindow() method:
  662. // partial update window size and position is on byte boundary in physical x direction
  663. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  664. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  665. // showPartialUpdate() purposely uses values that are not multiples of 8 to test this
  666. void showPartialUpdate()
  667. {
  668. // some useful background
  669. helloWorld();
  670. // use asymmetric values for test
  671. uint16_t box_x = 10;
  672. uint16_t box_y = 15;
  673. uint16_t box_w = 70;
  674. uint16_t box_h = 20;
  675. uint16_t cursor_y = box_y + box_h - 6;
  676. if (display.epd2.WIDTH < 104) cursor_y = box_y + 6;
  677. float value = 13.95;
  678. uint16_t incr = display.epd2.hasFastPartialUpdate ? 1 : 3;
  679. display.setFont(&FreeMonoBold9pt7b);
  680. if (display.epd2.WIDTH < 104) display.setFont(0);
  681. display.setTextColor(GxEPD_BLACK);
  682. // show where the update box is
  683. for (uint16_t r = 0; r < 4; r++)
  684. {
  685. display.setRotation(r);
  686. display.setPartialWindow(box_x, box_y, box_w, box_h);
  687. display.firstPage();
  688. do
  689. {
  690. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  691. //display.fillScreen(GxEPD_BLACK);
  692. }
  693. while (display.nextPage());
  694. delay(2000);
  695. display.firstPage();
  696. do
  697. {
  698. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  699. }
  700. while (display.nextPage());
  701. delay(1000);
  702. }
  703. //return;
  704. // show updates in the update box
  705. for (uint16_t r = 0; r < 4; r++)
  706. {
  707. display.setRotation(r);
  708. display.setPartialWindow(box_x, box_y, box_w, box_h);
  709. for (uint16_t i = 1; i <= 10; i += incr)
  710. {
  711. display.firstPage();
  712. do
  713. {
  714. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  715. display.setCursor(box_x, cursor_y);
  716. display.print(value * i, 2);
  717. }
  718. while (display.nextPage());
  719. delay(500);
  720. }
  721. delay(1000);
  722. display.firstPage();
  723. do
  724. {
  725. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  726. }
  727. while (display.nextPage());
  728. delay(1000);
  729. }
  730. }
  731. void drawGrid()
  732. {
  733. int16_t x, y;
  734. display.firstPage();
  735. do
  736. {
  737. x = 0;
  738. do
  739. {
  740. display.drawLine(x, 0, x, display.height() - 1, GxEPD_BLACK);
  741. x += 10;
  742. }
  743. while (x < display.width());
  744. y = 0;
  745. do
  746. {
  747. display.drawLine(0, y, display.width() - 1, y, GxEPD_BLACK);
  748. y += 10;
  749. }
  750. while (y < display.height());
  751. x = 0;
  752. do
  753. {
  754. display.fillCircle(x, display.height() / 2, 3, GxEPD_BLACK);
  755. x += 50;
  756. }
  757. while (x <= display.width());
  758. y = 0;
  759. do
  760. {
  761. display.fillCircle(display.width() / 2, y, 3, GxEPD_BLACK);
  762. y += 50;
  763. }
  764. while (y <= display.height());
  765. }
  766. while (display.nextPage());
  767. }
  768. void drawBitmaps()
  769. {
  770. display.setRotation(0);
  771. display.setFullWindow();
  772. #ifdef _GxBitmaps80x128_H_
  773. drawBitmaps80x128();
  774. #endif
  775. #ifdef _GxBitmaps152x152_H_
  776. drawBitmaps152x152();
  777. #endif
  778. #ifdef _GxBitmaps104x212_H_
  779. drawBitmaps104x212();
  780. #endif
  781. #ifdef _GxBitmaps200x200_H_
  782. drawBitmaps200x200();
  783. #endif
  784. #ifdef _GxBitmaps128x250_H_
  785. drawBitmaps128x250();
  786. #endif
  787. #ifdef _GxBitmaps128x296_H_
  788. drawBitmaps128x296();
  789. #endif
  790. #ifdef _GxBitmaps168x384_H_
  791. drawBitmaps168x384();
  792. #endif
  793. #ifdef _GxBitmaps152x296_H_
  794. drawBitmaps152x296();
  795. #endif
  796. #ifdef _GxBitmaps240x320_H_
  797. drawBitmaps240x320();
  798. #endif
  799. #ifdef _GxBitmaps176x264_H_
  800. drawBitmaps176x264();
  801. #endif
  802. #ifdef _GxBitmaps240x416_H_
  803. drawBitmaps240x416();
  804. #endif
  805. #ifdef _GxBitmaps400x300_H_
  806. drawBitmaps400x300();
  807. #endif
  808. #ifdef _GxBitmaps640x384_H_
  809. drawBitmaps640x384();
  810. #endif
  811. #ifdef _GxBitmaps648x480_H_
  812. drawBitmaps648x480();
  813. #endif
  814. #if defined(ESP32) && defined(_GxBitmaps800x276_H_)
  815. drawBitmaps800x276();
  816. #endif
  817. #ifdef _GxBitmaps800x480_H_
  818. drawBitmaps800x480();
  819. #endif
  820. #ifdef _WS_Bitmaps800x600_H_
  821. drawBitmaps800x600();
  822. #endif
  823. #if defined(ESP32) && defined(_GxBitmaps960x640_H_)
  824. drawBitmaps960x640();
  825. #endif
  826. #if defined(ESP32) && defined(_GxBitmaps960x680_H_)
  827. drawBitmaps960x680();
  828. #endif
  829. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  830. drawBitmaps1304x984();
  831. #endif
  832. // 3-color
  833. #ifdef _GxBitmaps3c104x212_H_
  834. drawBitmaps3c104x212();
  835. #endif
  836. #ifdef _GxBitmaps3c200x200_H_
  837. drawBitmaps3c200x200();
  838. #endif
  839. #ifdef _GxBitmaps3c128x250_H_
  840. drawBitmaps3c128x250();
  841. #endif
  842. #ifdef _GxBitmaps3c128x296_H_
  843. drawBitmaps3c128x296();
  844. #endif
  845. #ifdef _GxBitmaps3c152x296_H_
  846. drawBitmaps3c152x296();
  847. #endif
  848. #ifdef _GxBitmaps3c176x264_H_
  849. drawBitmaps3c176x264();
  850. #endif
  851. #ifdef _GxBitmaps3c400x300_H_
  852. drawBitmaps3c400x300();
  853. #endif
  854. #ifdef _GxBitmaps3c648x480_H_
  855. drawBitmaps3c648x480();
  856. #endif
  857. #ifdef _GxBitmaps3c800x480_H_
  858. drawBitmaps3c800x480();
  859. #endif
  860. #ifdef _GxBitmaps3c880x528_H_
  861. drawBitmaps3c880x528();
  862. #endif
  863. #if defined(ESP32) && defined(_GxBitmaps3c960x640_H_)
  864. drawBitmaps3c960x640();
  865. #endif
  866. #if defined(ESP32) && defined(_GxBitmaps3c960x680_H_)
  867. drawBitmaps3c960x680();
  868. #endif
  869. #if defined(ESP32) && defined(_GxBitmaps1360x480_H_)
  870. drawBitmaps1360x480();
  871. #endif
  872. // 3-color
  873. #if defined(ESP32) && defined(_GxBitmaps3c800x276_H_)
  874. drawBitmaps3c800x276();
  875. #endif
  876. // 4-color
  877. #if defined(_GxBitmaps4c128x250_H_)
  878. drawBitmaps4c128x250();
  879. #endif
  880. #if defined(_WS_Bitmaps4c168x168_H_)
  881. drawBitmaps4c168x168();
  882. #endif
  883. #if defined(_GxBitmaps4c168x384_H_)
  884. drawBitmaps4c168x384();
  885. #endif
  886. #if defined(_GxBitmaps4c184x360_H_)
  887. drawBitmaps4c184x360();
  888. #endif
  889. #if defined(_GxBitmaps4c400x300_H_)
  890. drawBitmaps4c400x300();
  891. #endif
  892. #if defined(_GxBitmaps4c960x640_H_)
  893. drawBitmaps4c960x640();
  894. #endif
  895. #if defined(ESP32) && defined(_GxBitmaps4c792x272_H_)
  896. drawBitmaps4c792x272();
  897. #endif
  898. // 7-color
  899. #if defined(_GxBitmaps7c600x448_H_)
  900. drawBitmaps7c600x448();
  901. #endif
  902. #if defined(_WS_Bitmaps7c192x143_H_)
  903. drawBitmaps7c192x143();
  904. #endif
  905. #if defined(_GxBitmaps7c800x480_H_)
  906. drawBitmaps7c800x480();
  907. #endif
  908. #if defined(_WS_Bitmaps7c300x180_H_)
  909. drawBitmaps7c300x180();
  910. #endif
  911. #if defined(ESP32) && defined(_GxBitmaps3c1304x984_H_)
  912. drawBitmaps3c1304x984();
  913. #endif
  914. }
  915. #ifdef _GxBitmaps80x128_H_
  916. void drawBitmaps80x128()
  917. {
  918. #if !defined(__AVR)
  919. const unsigned char* bitmaps[] =
  920. {
  921. Bitmap80x128_1, Bitmap80x128_2, Bitmap80x128_3, Bitmap80x128_4, Bitmap80x128_5
  922. };
  923. #else
  924. const unsigned char* bitmaps[] =
  925. {
  926. Bitmap80x128_1, Bitmap80x128_2, Bitmap80x128_3, Bitmap80x128_4, Bitmap80x128_5
  927. };
  928. #endif
  929. if ((display.epd2.WIDTH == 80) && (display.epd2.HEIGHT == 128))
  930. {
  931. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  932. {
  933. display.firstPage();
  934. do
  935. {
  936. display.fillScreen(GxEPD_WHITE);
  937. display.drawInvertedBitmap(0, 0, bitmaps[i], 80, 128, GxEPD_BLACK);
  938. }
  939. while (display.nextPage());
  940. delay(2000);
  941. }
  942. display.firstPage();
  943. do
  944. {
  945. display.fillScreen(GxEPD_WHITE);
  946. display.drawBitmap(0, 0, WS_Bitmap80x128, 80, 128, GxEPD_BLACK);
  947. }
  948. while (display.nextPage());
  949. delay(2000);
  950. }
  951. }
  952. #endif
  953. #ifdef _GxBitmaps152x152_H_
  954. void drawBitmaps152x152()
  955. {
  956. #if !defined(__AVR)
  957. const unsigned char* bitmaps[] =
  958. {
  959. Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
  960. };
  961. #else
  962. const unsigned char* bitmaps[] =
  963. {
  964. Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
  965. };
  966. #endif
  967. if ((display.epd2.WIDTH == 152) && (display.epd2.HEIGHT == 152))
  968. {
  969. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  970. {
  971. display.firstPage();
  972. do
  973. {
  974. display.fillScreen(GxEPD_WHITE);
  975. display.drawInvertedBitmap(0, 0, bitmaps[i], 152, 152, GxEPD_BLACK);
  976. }
  977. while (display.nextPage());
  978. delay(2000);
  979. }
  980. }
  981. }
  982. #endif
  983. #ifdef _GxBitmaps200x200_H_
  984. void drawBitmaps200x200()
  985. {
  986. #if defined(ARDUINO_AVR_PRO)
  987. const unsigned char* bitmaps[] =
  988. {
  989. logo200x200
  990. };
  991. #elif defined(__AVR)
  992. const unsigned char* bitmaps[] =
  993. {
  994. logo200x200, //first200x200
  995. };
  996. #elif defined(_BOARD_GENERIC_STM32F103C_H_) || defined(STM32F1xx)
  997. const unsigned char* bitmaps[] =
  998. {
  999. logo200x200, first200x200, second200x200, third200x200, //fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  1000. };
  1001. #else
  1002. const unsigned char* bitmaps[] =
  1003. {
  1004. logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  1005. //logo200x200, first200x200, second200x200, fourth200x200, third200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200 // ED037TC1 test
  1006. };
  1007. #endif
  1008. if (display.epd2.hasColor) return; // to avoid many long refreshes
  1009. if ((display.epd2.WIDTH == 200) && (display.epd2.HEIGHT == 200) && !display.epd2.hasColor)
  1010. {
  1011. bool m = display.mirror(true);
  1012. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1013. {
  1014. display.firstPage();
  1015. do
  1016. {
  1017. display.fillScreen(GxEPD_WHITE);
  1018. display.drawInvertedBitmap(0, 0, bitmaps[i], 200, 200, GxEPD_BLACK);
  1019. }
  1020. while (display.nextPage());
  1021. delay(2000);
  1022. }
  1023. display.mirror(m);
  1024. }
  1025. //else
  1026. {
  1027. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  1028. display.clearScreen(); // use default for white
  1029. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  1030. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  1031. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1032. {
  1033. display.drawImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1034. delay(2000);
  1035. }
  1036. }
  1037. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  1038. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1039. {
  1040. int16_t x = -60;
  1041. int16_t y = -60;
  1042. for (uint16_t j = 0; j < 10; j++)
  1043. {
  1044. display.writeScreenBuffer(); // use default for white
  1045. display.writeImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1046. display.refresh(true);
  1047. if (display.epd2.hasFastPartialUpdate)
  1048. {
  1049. // for differential update: set previous buffer equal to current buffer in controller
  1050. display.epd2.writeScreenBufferAgain(); // use default for white
  1051. display.epd2.writeImageAgain(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1052. }
  1053. delay(2000);
  1054. x += display.epd2.WIDTH / 4;
  1055. y += display.epd2.HEIGHT / 4;
  1056. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  1057. }
  1058. if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
  1059. break; // comment out for full show
  1060. }
  1061. display.writeScreenBuffer(); // use default for white
  1062. display.writeImage(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  1063. display.writeImage(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
  1064. display.refresh(true);
  1065. // for differential update: set previous buffer equal to current buffer in controller
  1066. display.epd2.writeScreenBufferAgain(); // use default for white
  1067. display.epd2.writeImageAgain(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  1068. 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);
  1069. delay(2000);
  1070. }
  1071. #endif
  1072. #ifdef _GxBitmaps104x212_H_
  1073. void drawBitmaps104x212()
  1074. {
  1075. #if !defined(__AVR)
  1076. const unsigned char* bitmaps[] =
  1077. {
  1078. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  1079. };
  1080. #else
  1081. const unsigned char* bitmaps[] =
  1082. {
  1083. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  1084. };
  1085. #endif
  1086. if ((display.epd2.WIDTH == 104) && (display.epd2.HEIGHT == 212) && !display.epd2.hasColor)
  1087. {
  1088. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1089. {
  1090. display.firstPage();
  1091. do
  1092. {
  1093. display.fillScreen(GxEPD_WHITE);
  1094. display.drawBitmap(0, 0, bitmaps[i], 104, 212, GxEPD_BLACK);
  1095. }
  1096. while (display.nextPage());
  1097. delay(2000);
  1098. }
  1099. }
  1100. }
  1101. #endif
  1102. #ifdef _GxBitmaps128x250_H_
  1103. void drawBitmaps128x250()
  1104. {
  1105. #if !defined(__AVR)
  1106. const unsigned char* bitmaps[] =
  1107. {
  1108. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  1109. };
  1110. #else
  1111. const unsigned char* bitmaps[] =
  1112. {
  1113. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  1114. };
  1115. #endif
  1116. if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 250) && !display.epd2.hasColor)
  1117. {
  1118. bool m = display.mirror(true);
  1119. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1120. {
  1121. display.firstPage();
  1122. do
  1123. {
  1124. display.fillScreen(GxEPD_WHITE);
  1125. display.drawInvertedBitmap(0, 0, bitmaps[i], 128, 250, GxEPD_BLACK);
  1126. }
  1127. while (display.nextPage());
  1128. delay(2000);
  1129. }
  1130. display.mirror(m);
  1131. }
  1132. }
  1133. #endif
  1134. #ifdef _GxBitmaps128x296_H_
  1135. void drawBitmaps128x296()
  1136. {
  1137. #if !defined(__AVR)
  1138. const unsigned char* bitmaps[] =
  1139. {
  1140. Bitmap128x296_1, logo128x296, first128x296, second128x296, third128x296
  1141. };
  1142. #else
  1143. const unsigned char* bitmaps[] =
  1144. {
  1145. Bitmap128x296_1, logo128x296 //, first128x296, second128x296, third128x296
  1146. };
  1147. #endif
  1148. if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 296) && !display.epd2.hasColor)
  1149. {
  1150. bool m = display.mirror(true);
  1151. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1152. {
  1153. display.firstPage();
  1154. do
  1155. {
  1156. display.fillScreen(GxEPD_WHITE);
  1157. display.drawInvertedBitmap(0, 0, bitmaps[i], 128, 296, GxEPD_BLACK);
  1158. }
  1159. while (display.nextPage());
  1160. delay(2000);
  1161. }
  1162. display.mirror(m);
  1163. }
  1164. }
  1165. #endif
  1166. #ifdef _GxBitmaps168x384_H_
  1167. void drawBitmaps168x384()
  1168. {
  1169. #if !defined(__AVR)
  1170. const unsigned char* bitmaps[] =
  1171. {
  1172. Bitmap168x384_1, Bitmap168x384_2, Bitmap168x384_3, Bitmap168x384_4, Bitmap168x384_5
  1173. };
  1174. #else
  1175. const unsigned char* bitmaps[] =
  1176. {
  1177. Bitmap168x384_1
  1178. };
  1179. #endif
  1180. if ((display.epd2.WIDTH == 168) && (display.epd2.HEIGHT == 384) && !display.epd2.hasColor)
  1181. {
  1182. bool mirrored = display.mirror(true);
  1183. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1184. {
  1185. display.firstPage();
  1186. do
  1187. {
  1188. display.fillScreen(GxEPD_WHITE);
  1189. display.drawInvertedBitmap(0, 0, bitmaps[i], 168, 384, GxEPD_BLACK);
  1190. }
  1191. while (display.nextPage());
  1192. delay(2000);
  1193. }
  1194. display.mirror(mirrored);
  1195. }
  1196. }
  1197. #endif
  1198. #ifdef _GxBitmaps152x296_H_
  1199. void drawBitmaps152x296()
  1200. {
  1201. #if !defined(__AVR)
  1202. const unsigned char* bitmaps[] =
  1203. {
  1204. Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
  1205. };
  1206. #else
  1207. const unsigned char* bitmaps[] =
  1208. {
  1209. Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
  1210. };
  1211. #endif
  1212. if ((display.epd2.WIDTH == 152) && (display.epd2.HEIGHT == 296) && !display.epd2.hasColor)
  1213. {
  1214. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1215. {
  1216. display.firstPage();
  1217. do
  1218. {
  1219. display.fillScreen(GxEPD_WHITE);
  1220. display.drawInvertedBitmap(0, 0, bitmaps[i], 152, 296, GxEPD_BLACK);
  1221. }
  1222. while (display.nextPage());
  1223. delay(2000);
  1224. }
  1225. }
  1226. }
  1227. #endif
  1228. #ifdef _GxBitmaps240x320_H_
  1229. void drawBitmaps240x320()
  1230. {
  1231. #if !defined(__AVR)
  1232. const unsigned char* bitmaps[] =
  1233. {
  1234. Bitmap240x320_1, Bitmap240x320_2, Bitmap240x320_3, Bitmap240x320_4, Bitmap240x320_5
  1235. };
  1236. #else
  1237. const unsigned char* bitmaps[] =
  1238. {
  1239. Bitmap240x320_1, Bitmap240x320_2
  1240. };
  1241. #endif
  1242. if ((display.epd2.WIDTH == 240) && (display.epd2.HEIGHT == 320) && !display.epd2.hasColor)
  1243. {
  1244. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1245. {
  1246. display.firstPage();
  1247. do
  1248. {
  1249. display.fillScreen(GxEPD_WHITE);
  1250. display.drawInvertedBitmap(0, 0, bitmaps[i], 240, 320, GxEPD_BLACK);
  1251. }
  1252. while (display.nextPage());
  1253. delay(2000);
  1254. }
  1255. }
  1256. }
  1257. #endif
  1258. #ifdef _GxBitmaps176x264_H_
  1259. void drawBitmaps176x264()
  1260. {
  1261. #if !defined(__AVR)
  1262. const unsigned char* bitmaps[] =
  1263. {
  1264. Bitmap176x264_1, Bitmap176x264_2, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  1265. };
  1266. #else
  1267. const unsigned char* bitmaps[] =
  1268. {
  1269. Bitmap176x264_1, Bitmap176x264_2 //, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  1270. };
  1271. #endif
  1272. if ((display.epd2.WIDTH == 176) && (display.epd2.HEIGHT == 264) && !display.epd2.hasColor)
  1273. {
  1274. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1275. {
  1276. display.firstPage();
  1277. do
  1278. {
  1279. display.fillScreen(GxEPD_WHITE);
  1280. display.drawInvertedBitmap(0, 0, bitmaps[i], 176, 264, GxEPD_BLACK);
  1281. }
  1282. while (display.nextPage());
  1283. delay(2000);
  1284. }
  1285. }
  1286. }
  1287. #endif
  1288. #ifdef _GxBitmaps240x416_H_
  1289. void drawBitmaps240x416()
  1290. {
  1291. #if !defined(__AVR)
  1292. const unsigned char* bitmaps[] =
  1293. {
  1294. Bitmap240x416_1, Bitmap240x416_2, Bitmap240x416_3
  1295. };
  1296. #else
  1297. const unsigned char* bitmaps[] =
  1298. {
  1299. Bitmap240x460_1, Bitmap240x460_2, Bitmap240x460_3
  1300. };
  1301. #endif
  1302. if ((display.epd2.WIDTH == 240) && (display.epd2.HEIGHT == 416) && !display.epd2.hasColor)
  1303. {
  1304. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1305. {
  1306. display.firstPage();
  1307. do
  1308. {
  1309. display.fillScreen(GxEPD_WHITE);
  1310. display.drawInvertedBitmap(0, 0, bitmaps[i], 240, 416, GxEPD_BLACK);
  1311. }
  1312. while (display.nextPage());
  1313. delay(2000);
  1314. }
  1315. }
  1316. }
  1317. #endif
  1318. #ifdef _GxBitmaps400x300_H_
  1319. void drawBitmaps400x300()
  1320. {
  1321. #if !defined(__AVR)
  1322. const unsigned char* bitmaps[] =
  1323. {
  1324. Bitmap400x300_1, Bitmap400x300_2
  1325. };
  1326. #else
  1327. const unsigned char* bitmaps[] = {}; // not enough code space
  1328. #endif
  1329. if ((display.epd2.WIDTH == 400) && (display.epd2.HEIGHT == 300) && !display.epd2.hasColor)
  1330. {
  1331. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1332. {
  1333. display.firstPage();
  1334. do
  1335. {
  1336. display.fillScreen(GxEPD_WHITE);
  1337. display.drawInvertedBitmap(0, 0, bitmaps[i], 400, 300, GxEPD_BLACK);
  1338. }
  1339. while (display.nextPage());
  1340. delay(2000);
  1341. }
  1342. }
  1343. }
  1344. #endif
  1345. #ifdef _GxBitmaps640x384_H_
  1346. void drawBitmaps640x384()
  1347. {
  1348. #if !defined(__AVR)
  1349. const unsigned char* bitmaps[] =
  1350. {
  1351. Bitmap640x384_1, Bitmap640x384_2
  1352. };
  1353. #else
  1354. const unsigned char* bitmaps[] = {}; // not enough code space
  1355. #endif
  1356. if ((display.epd2.WIDTH == 640) && (display.epd2.HEIGHT == 384))
  1357. {
  1358. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1359. {
  1360. display.firstPage();
  1361. do
  1362. {
  1363. display.fillScreen(GxEPD_WHITE);
  1364. display.drawInvertedBitmap(0, 0, bitmaps[i], 640, 384, GxEPD_BLACK);
  1365. }
  1366. while (display.nextPage());
  1367. delay(2000);
  1368. }
  1369. }
  1370. }
  1371. #endif
  1372. #ifdef _GxBitmaps648x480_H_
  1373. void drawBitmaps648x480()
  1374. {
  1375. #if !defined(__AVR)
  1376. const unsigned char* bitmaps[] =
  1377. {
  1378. Bitmap648x480_1, Bitmap648x480_2, Bitmap648x480_3
  1379. };
  1380. #else
  1381. const unsigned char* bitmaps[] = {}; // not enough code space
  1382. #endif
  1383. if ((display.epd2.WIDTH == 648) && (display.epd2.HEIGHT == 480) && !display.epd2.hasColor)
  1384. {
  1385. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1386. {
  1387. display.firstPage();
  1388. do
  1389. {
  1390. display.fillScreen(GxEPD_WHITE);
  1391. display.drawBitmap(0, 0, bitmaps[i], 648, 480, GxEPD_BLACK);
  1392. }
  1393. while (display.nextPage());
  1394. delay(2000);
  1395. }
  1396. }
  1397. }
  1398. #endif
  1399. #if defined(ESP32) && defined(_GxBitmaps800x276_H_)
  1400. void drawBitmaps800x276()
  1401. {
  1402. if ((display.epd2.WIDTH == 792) && (display.epd2.HEIGHT == 272) && !display.epd2.hasColor)
  1403. {
  1404. display.drawImage(Bitmap800x276_1, 0, 0, 800, 272, true, false, true); delay(2000);
  1405. display.drawImage(Bitmap800x276_2, 0, 0, 800, 272, true, false, true); delay(2000);
  1406. display.drawImage(Bitmap800x276_3, 0, 0, 800, 272, true, false, true); delay(2000);
  1407. display.clearScreen();
  1408. int16_t wp = display.epd2.WIDTH / 5;
  1409. int16_t hp = display.epd2.HEIGHT / 5;
  1410. for (int16_t i = 0; i < 5; i++)
  1411. {
  1412. for (int16_t j = 0; j < 5; j++)
  1413. {
  1414. display.writeImagePart(Bitmap800x276_1, i * wp, j * hp, 800, 272, i * wp, j * hp, wp, hp, true, false, true);
  1415. display.refresh(true);
  1416. display.epd2.writeImagePartAgain(Bitmap800x276_1, i * wp, j * hp, 800, 272, i * wp, j * hp, wp, hp, true, false, true);
  1417. delay(500);
  1418. }
  1419. }
  1420. }
  1421. }
  1422. #endif
  1423. #ifdef _GxBitmaps800x480_H_
  1424. void drawBitmaps800x480()
  1425. {
  1426. #if defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_UNOR4_WIFI)
  1427. const unsigned char* bitmaps[] =
  1428. {
  1429. Bitmap800x480_3, Bitmap800x480_4
  1430. };
  1431. #elif !defined(__AVR)
  1432. const unsigned char* bitmaps[] =
  1433. {
  1434. Bitmap800x480_1, Bitmap800x480_2, Bitmap800x480_3, Bitmap800x480_4
  1435. };
  1436. #else
  1437. const unsigned char* bitmaps[] = {}; // not enough code space
  1438. #endif
  1439. if ((display.epd2.WIDTH == 800) && (display.epd2.HEIGHT == 480) && !display.epd2.hasColor)
  1440. {
  1441. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1442. {
  1443. display.firstPage();
  1444. do
  1445. {
  1446. display.fillScreen(GxEPD_WHITE);
  1447. display.drawBitmap(0, 0, bitmaps[i], 800, 480, GxEPD_BLACK);
  1448. }
  1449. while (display.nextPage());
  1450. delay(2000);
  1451. }
  1452. #if defined(ESP32)
  1453. if (display.epd2.panel == GxEPD2::GDEM0397T81)
  1454. {
  1455. display.drawImage(Bitmap800x480_5, 0, 0, 800, 480, false, true, true); delay(2000);
  1456. display.drawImage(Bitmap800x480_6, 0, 0, 800, 480, false, true, true); delay(2000);
  1457. display.drawImage(Bitmap800x480_7, 0, 0, 800, 480, false, true, true); delay(2000);
  1458. display.drawImage(Bitmap800x480_8, 0, 0, 800, 480, false, true, true); delay(2000);
  1459. display.drawImage(Bitmap800x480_9, 0, 0, 800, 480, false, true, true); delay(2000);
  1460. }
  1461. #endif
  1462. if ((display.epd2.panel == GxEPD2::GDEW075T7) || (display.epd2.panel == GxEPD2::GDEY075T7))
  1463. {
  1464. // avoid ghosting caused by OTP waveform
  1465. display.clearScreen();
  1466. display.refresh(false); // full update
  1467. }
  1468. }
  1469. }
  1470. #endif
  1471. #if defined(ESP32) && defined(_GxBitmaps960x640_H_)
  1472. void drawBitmaps960x640()
  1473. {
  1474. if ((display.epd2.WIDTH == 960) && (display.epd2.HEIGHT == 640) && !display.epd2.hasColor)
  1475. {
  1476. display.drawImage(Bitmap960x640_1, 0, 0, 960, 640, false, true, true); delay(5000);
  1477. display.drawImage(Bitmap960x640_2, 0, 0, 960, 640, false, true, true); delay(5000);
  1478. display.drawImage(Bitmap960x640_3, 0, 0, 960, 640, false, true, true); delay(5000);
  1479. }
  1480. }
  1481. #endif
  1482. #if defined(ESP32) && defined(_GxBitmaps960x680_H_)
  1483. void drawBitmaps960x680()
  1484. {
  1485. if ((display.epd2.WIDTH == 960) && (display.epd2.HEIGHT == 680) && !display.epd2.hasColor)
  1486. {
  1487. display.drawImage(Bitmap960x680_1, 0, 0, 960, 680, false, true, true); delay(5000);
  1488. display.drawImage(Bitmap960x680_2, 0, 0, 960, 680, false, true, true); delay(5000);
  1489. }
  1490. }
  1491. #endif
  1492. #ifdef _WS_Bitmaps800x600_H_
  1493. void drawBitmaps800x600()
  1494. {
  1495. #if defined(ESP8266) || defined(ESP32)
  1496. if ((display.epd2.panel == GxEPD2::ED060SCT) || (display.epd2.panel == GxEPD2::ED060KC1) || (display.epd2.panel == GxEPD2::ED078KC2))
  1497. {
  1498. // Serial.print("sizeof(WS_zoo_800x600) is "); Serial.println(sizeof(WS_zoo_800x600));
  1499. display.drawNative(WS_zoo_800x600, 0, 0, 0, 800, 600, false, false, true);
  1500. delay(2000);
  1501. // Serial.print("sizeof(WS_pic_1200x825) is "); Serial.println(sizeof(WS_pic_1200x825));
  1502. // display.drawNative((const uint8_t*)WS_pic_1200x825, 0, 0, 0, 1200, 825, false, false, true);
  1503. // delay(2000);
  1504. // Serial.print("sizeof(WS_acaa_1024x731) is "); Serial.println(sizeof(WS_acaa_1024x731));
  1505. // display.drawNative(WS_acaa_1024x731, 0, 0, 0, 1024, 731, false, false, true);
  1506. // delay(2000);
  1507. }
  1508. #endif
  1509. }
  1510. #endif
  1511. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  1512. void drawBitmaps1304x984()
  1513. {
  1514. if (display.epd2.panel == GxEPD2::GDEW1248T3)
  1515. {
  1516. display.drawImage(Bitmap1304x984, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1517. }
  1518. }
  1519. #endif
  1520. #if defined(ESP32) && defined(_GxBitmaps1360x480_H_)
  1521. void drawBitmaps1360x480()
  1522. {
  1523. if (display.epd2.panel == GxEPD2::GDEM1085T51)
  1524. {
  1525. display.drawImage(Bitmap1360x480_1, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1526. delay(2000);
  1527. display.drawImage(Bitmap1360x480_p1, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1528. delay(1000);
  1529. display.drawImage(Bitmap1360x480_p2, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1530. delay(1000);
  1531. display.drawImage(Bitmap1360x480_p3, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1532. delay(1000);
  1533. display.clearScreen();
  1534. int16_t wp = display.epd2.WIDTH / 5;
  1535. int16_t hp = display.epd2.HEIGHT / 5;
  1536. for (int16_t i = 0; i < 5; i++)
  1537. {
  1538. for (int16_t j = 0; j < 5; j++)
  1539. {
  1540. display.writeImagePart(Bitmap1360x480_1, i * wp, j * hp, 1360, 480, i * wp, j * hp, wp, hp, false, false, true);
  1541. display.refresh(true);
  1542. delay(500);
  1543. }
  1544. }
  1545. }
  1546. }
  1547. #endif
  1548. struct bitmap_pair
  1549. {
  1550. const unsigned char* black;
  1551. const unsigned char* red;
  1552. };
  1553. #ifdef _GxBitmaps3c200x200_H_
  1554. void drawBitmaps3c200x200()
  1555. {
  1556. bitmap_pair bitmap_pairs[] =
  1557. {
  1558. //{Bitmap3c200x200_black, Bitmap3c200x200_red},
  1559. {WS_Bitmap3c200x200_black, WS_Bitmap3c200x200_red}
  1560. };
  1561. if (display.epd2.panel == GxEPD2::GDEW0154Z04)
  1562. {
  1563. display.firstPage();
  1564. do
  1565. {
  1566. display.fillScreen(GxEPD_WHITE);
  1567. // Bitmap3c200x200_black has 2 bits per pixel
  1568. // taken from Adafruit_GFX.cpp, modified
  1569. int16_t byteWidth = (display.epd2.WIDTH + 7) / 8; // Bitmap scanline pad = whole byte
  1570. uint8_t byte = 0;
  1571. for (int16_t j = 0; j < display.epd2.HEIGHT; j++)
  1572. {
  1573. for (int16_t i = 0; i < display.epd2.WIDTH; i++)
  1574. {
  1575. if (i & 3) byte <<= 2;
  1576. else
  1577. {
  1578. #if defined(__AVR) || defined(ESP8266) || defined(ESP32)
  1579. byte = pgm_read_byte(&Bitmap3c200x200_black[j * byteWidth * 2 + i / 4]);
  1580. #else
  1581. byte = Bitmap3c200x200_black[j * byteWidth * 2 + i / 4];
  1582. #endif
  1583. }
  1584. if (!(byte & 0x80))
  1585. {
  1586. display.drawPixel(i, j, GxEPD_BLACK);
  1587. }
  1588. }
  1589. }
  1590. display.drawInvertedBitmap(0, 0, Bitmap3c200x200_red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1591. }
  1592. while (display.nextPage());
  1593. delay(2000);
  1594. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1595. {
  1596. display.firstPage();
  1597. do
  1598. {
  1599. display.fillScreen(GxEPD_WHITE);
  1600. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1601. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1602. }
  1603. while (display.nextPage());
  1604. delay(2000);
  1605. }
  1606. }
  1607. if (display.epd2.hasColor)
  1608. {
  1609. display.clearScreen(); // use default for white
  1610. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  1611. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  1612. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1613. {
  1614. display.drawImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1615. delay(2000);
  1616. }
  1617. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1618. {
  1619. int16_t x = -60;
  1620. int16_t y = -60;
  1621. for (uint16_t j = 0; j < 10; j++)
  1622. {
  1623. display.writeScreenBuffer(); // use default for white
  1624. display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1625. display.refresh();
  1626. delay(1000);
  1627. x += display.epd2.WIDTH / 4;
  1628. y += display.epd2.HEIGHT / 4;
  1629. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  1630. }
  1631. }
  1632. display.writeScreenBuffer(); // use default for white
  1633. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, 0, 0, 200, 200, false, false, true);
  1634. 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);
  1635. display.refresh();
  1636. delay(2000);
  1637. }
  1638. }
  1639. #endif
  1640. #ifdef _GxBitmaps3c104x212_H_
  1641. void drawBitmaps3c104x212()
  1642. {
  1643. #if !defined(__AVR)
  1644. bitmap_pair bitmap_pairs[] =
  1645. {
  1646. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1647. {Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1648. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1649. };
  1650. #else
  1651. bitmap_pair bitmap_pairs[] =
  1652. {
  1653. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1654. //{Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1655. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1656. };
  1657. #endif
  1658. if (display.epd2.panel == GxEPD2::GDEW0213Z16)
  1659. {
  1660. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1661. {
  1662. display.firstPage();
  1663. do
  1664. {
  1665. display.fillScreen(GxEPD_WHITE);
  1666. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1667. if (bitmap_pairs[i].red == WS_Bitmap3c104x212_red)
  1668. {
  1669. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1670. }
  1671. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1672. }
  1673. while (display.nextPage());
  1674. delay(2000);
  1675. }
  1676. }
  1677. }
  1678. #endif
  1679. #ifdef _GxBitmaps3c128x250_H_
  1680. void drawBitmaps3c128x250()
  1681. {
  1682. if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 250) && display.epd2.hasColor)
  1683. {
  1684. bool mirrored = display.mirror(true);
  1685. display.firstPage();
  1686. do
  1687. {
  1688. display.fillScreen(GxEPD_WHITE);
  1689. display.drawInvertedBitmap(0, 0, Bitmap3c128x250_1_black, 128, 250, GxEPD_BLACK);
  1690. display.drawInvertedBitmap(0, 0, Bitmap3c128x250_1_red, 128, 250, GxEPD_RED);
  1691. }
  1692. while (display.nextPage());
  1693. delay(2000);
  1694. #if !defined(__AVR)
  1695. display.firstPage();
  1696. do
  1697. {
  1698. display.fillScreen(GxEPD_WHITE);
  1699. display.drawInvertedBitmap(0, 0, Bitmap3c128x250_2_black, 128, 250, GxEPD_BLACK);
  1700. display.drawBitmap(0, 0, Bitmap3c128x250_2_red, 128, 250, GxEPD_RED);
  1701. }
  1702. while (display.nextPage());
  1703. delay(2000);
  1704. #endif
  1705. display.mirror(mirrored);
  1706. }
  1707. }
  1708. #endif
  1709. #ifdef _GxBitmaps3c128x296_H_
  1710. void drawBitmaps3c128x296()
  1711. {
  1712. #if !defined(__AVR)
  1713. bitmap_pair bitmap_pairs[] =
  1714. {
  1715. {Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1716. {Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1717. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1718. };
  1719. #else
  1720. bitmap_pair bitmap_pairs[] =
  1721. {
  1722. //{Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1723. //{Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1724. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1725. };
  1726. #endif
  1727. if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 296) && display.epd2.hasColor)
  1728. {
  1729. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1730. {
  1731. display.firstPage();
  1732. do
  1733. {
  1734. display.fillScreen(GxEPD_WHITE);
  1735. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, 128, 296, GxEPD_BLACK);
  1736. if (bitmap_pairs[i].red == WS_Bitmap3c128x296_red)
  1737. {
  1738. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, 128, 296, GxEPD_RED);
  1739. }
  1740. else display.drawBitmap(0, 0, bitmap_pairs[i].red, 128, 296, GxEPD_RED);
  1741. }
  1742. while (display.nextPage());
  1743. delay(2000);
  1744. }
  1745. }
  1746. }
  1747. #endif
  1748. #ifdef _GxBitmaps3c152x296_H_
  1749. void drawBitmaps3c152x296()
  1750. {
  1751. bitmap_pair bitmap_pairs[] =
  1752. {
  1753. {Bitmap3c152x296_black, Bitmap3c152x296_red}
  1754. };
  1755. if (display.epd2.panel == GxEPD2::GDEY0266Z90)
  1756. {
  1757. bool mirrored = display.mirror(true);
  1758. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1759. {
  1760. display.firstPage();
  1761. do
  1762. {
  1763. display.fillScreen(GxEPD_WHITE);
  1764. display.drawBitmap(0, 0, bitmap_pairs[i].black, 152, 296, GxEPD_BLACK);
  1765. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, 152, 296, GxEPD_RED);
  1766. }
  1767. while (display.nextPage());
  1768. delay(2000);
  1769. }
  1770. display.mirror(mirrored);
  1771. }
  1772. }
  1773. #endif
  1774. #ifdef _GxBitmaps3c176x264_H_
  1775. void drawBitmaps3c176x264()
  1776. {
  1777. bitmap_pair bitmap_pairs[] =
  1778. {
  1779. {Bitmap3c176x264_black, Bitmap3c176x264_red}
  1780. };
  1781. if (display.epd2.panel == GxEPD2::GDEW027C44)
  1782. {
  1783. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1784. {
  1785. display.firstPage();
  1786. do
  1787. {
  1788. display.fillScreen(GxEPD_WHITE);
  1789. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1790. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1791. }
  1792. while (display.nextPage());
  1793. delay(2000);
  1794. }
  1795. }
  1796. }
  1797. #endif
  1798. #ifdef _GxBitmaps3c400x300_H_
  1799. void drawBitmaps3c400x300()
  1800. {
  1801. #if !defined(__AVR)
  1802. bitmap_pair bitmap_pairs[] =
  1803. {
  1804. {Bitmap3c400x300_1_black, Bitmap3c400x300_1_red},
  1805. {Bitmap3c400x300_2_black, Bitmap3c400x300_2_red},
  1806. {WS_Bitmap3c400x300_black, WS_Bitmap3c400x300_red},
  1807. {Bitmap3c400x300_3_black, Bitmap3c400x300_3_red},
  1808. {Bitmap3c400x300_4_black, Bitmap3c400x300_4_red},
  1809. };
  1810. #else
  1811. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1812. #endif
  1813. if ((display.epd2.WIDTH == 400) && (display.epd2.HEIGHT == 300) && display.epd2.hasColor)
  1814. {
  1815. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1816. {
  1817. display.firstPage();
  1818. do
  1819. {
  1820. display.fillScreen(GxEPD_WHITE);
  1821. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1822. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1823. }
  1824. while (display.nextPage());
  1825. delay(2000);
  1826. }
  1827. }
  1828. }
  1829. #endif
  1830. #ifdef _GxBitmaps3c648x480_H_
  1831. void drawBitmaps3c648x480()
  1832. {
  1833. #if !defined(__AVR)
  1834. bitmap_pair bitmap_pairs[] =
  1835. {
  1836. {Bitmap3c648x480_black, Bitmap3c648x480_red},
  1837. {Bitmap3c648x480_black_2, Bitmap3c648x480_red_2}
  1838. };
  1839. #else
  1840. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1841. #endif
  1842. if ((display.epd2.panel == GxEPD2::GDEW0583Z83) || (display.epd2.panel == GxEPD2::GDEQ0583Z31))
  1843. {
  1844. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1845. {
  1846. display.firstPage();
  1847. do
  1848. {
  1849. display.fillScreen(GxEPD_WHITE);
  1850. display.drawBitmap(0, 0, bitmap_pairs[i].black, 648, 480, GxEPD_BLACK);
  1851. display.drawBitmap(0, 0, bitmap_pairs[i].red, 648, 480, GxEPD_RED);
  1852. }
  1853. while (display.nextPage());
  1854. delay(2000);
  1855. }
  1856. }
  1857. }
  1858. #endif
  1859. #if defined(ESP32) && defined(_GxBitmaps3c800x276_H_)
  1860. void drawBitmaps3c800x276()
  1861. {
  1862. if ((display.epd2.WIDTH == 792) && (display.epd2.HEIGHT == 272) && display.epd2.hasColor)
  1863. {
  1864. display.drawImage(Bitmap3c800x276_black_1, Bitmap3c800x276_red_1, 0, 0, 800, 272, true, false, true); delay(2000);
  1865. display.drawImage(Bitmap3c800x276_black_2, Bitmap3c800x276_red_2, 0, 0, 800, 272, true, false, true); delay(2000);
  1866. int16_t wp = display.epd2.WIDTH / 5;
  1867. int16_t hp = display.epd2.HEIGHT / 5;
  1868. int16_t n = 0;
  1869. for (int16_t k = 0; k < 3; k++)
  1870. {
  1871. display.writeScreenBuffer();
  1872. for (int16_t i = 0; i < 5; i++)
  1873. {
  1874. for (int16_t j = 0; j < 5; j++)
  1875. {
  1876. if ((n++ % 2) || (k == 2))
  1877. {
  1878. display.writeImagePart(Bitmap3c800x276_black_1, Bitmap3c800x276_red_1, i * wp, j * hp, 800, 272, i * wp, j * hp, wp, hp, true, false, true);
  1879. }
  1880. }
  1881. }
  1882. display.refresh(false);
  1883. delay(2000);
  1884. }
  1885. }
  1886. }
  1887. #endif
  1888. #ifdef _GxBitmaps3c800x480_H_
  1889. void drawBitmaps3c800x480()
  1890. {
  1891. #if !defined(__AVR)
  1892. bitmap_pair bitmap_pairs[] =
  1893. {
  1894. {Bitmap3c800x480_1_black, Bitmap3c800x480_1_red}
  1895. };
  1896. #else
  1897. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1898. #endif
  1899. if (display.epd2.panel == GxEPD2::GDEW075Z08)
  1900. {
  1901. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1902. {
  1903. display.firstPage();
  1904. do
  1905. {
  1906. display.fillScreen(GxEPD_WHITE);
  1907. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1908. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1909. }
  1910. while (display.nextPage());
  1911. delay(2000);
  1912. }
  1913. }
  1914. }
  1915. #endif
  1916. #ifdef _GxBitmaps3c880x528_H_
  1917. void drawBitmaps3c880x528()
  1918. {
  1919. #if !defined(__AVR)
  1920. bitmap_pair bitmap_pairs[] =
  1921. {
  1922. {Bitmap3c880x528_black, Bitmap3c880x528_red}
  1923. };
  1924. #else
  1925. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1926. #endif
  1927. if (display.epd2.panel == GxEPD2::GDEH075Z90)
  1928. {
  1929. bool m = display.mirror(true);
  1930. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1931. {
  1932. display.firstPage();
  1933. do
  1934. {
  1935. display.fillScreen(GxEPD_WHITE);
  1936. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, 880, 528, GxEPD_BLACK);
  1937. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, 880, 528, GxEPD_RED);
  1938. }
  1939. while (display.nextPage());
  1940. delay(2000);
  1941. }
  1942. display.mirror(m);
  1943. }
  1944. }
  1945. #endif
  1946. #if defined(ESP32) && defined(_GxBitmaps3c960x640_H_)
  1947. void drawBitmaps3c960x640()
  1948. {
  1949. if ((display.epd2.WIDTH == 960) && (display.epd2.HEIGHT == 640) && display.epd2.hasColor)
  1950. {
  1951. display.drawImage(Bitmap3c960x640_black, Bitmap3c960x640_red, 0, 0, 960, 640, false, false, true);
  1952. delay(2000);
  1953. }
  1954. }
  1955. #endif
  1956. #if defined(ESP32) && defined(_GxBitmaps3c960x680_H_)
  1957. void drawBitmaps3c960x680()
  1958. {
  1959. if ((display.epd2.WIDTH == 960) && (display.epd2.HEIGHT == 680) && display.epd2.hasColor)
  1960. {
  1961. display.drawImage(Bitmap3c960x680_black, Bitmap3c960x680_red, 0, 0, 960, 680, false, true, true);
  1962. }
  1963. delay(2000);
  1964. }
  1965. #endif
  1966. #if defined(ESP32) && defined(_GxBitmaps3c1304x984_H_)
  1967. void drawBitmaps3c1304x984()
  1968. {
  1969. if (display.epd2.panel == GxEPD2::GDEY1248Z51)
  1970. {
  1971. //display.drawImage(Bitmap3c1304x984_black, Bitmap3c1304x984_red, 0, 0, 1304, 984, false, false, true);
  1972. display.writeImage(0, Bitmap3c1304x984_red, 0, 0, 1304, 984, true, false, true); // red bitmap is inverted
  1973. display.drawImage(Bitmap3c1304x984_black, 0, 0, 0, 1304, 984, true, false, true); // black bitmap is normal
  1974. }
  1975. }
  1976. #endif
  1977. #if defined(_GxBitmaps4c128x250_H_)
  1978. void drawBitmaps4c128x250()
  1979. {
  1980. if (display.epd2.panel == GxEPD2::GDEY0213F51)
  1981. {
  1982. display.drawNative(Bitmap4c128x250, 0, 0, 0, 128, 250, false, false, true);
  1983. delay(5000);
  1984. }
  1985. }
  1986. #endif
  1987. #if defined(_WS_Bitmaps4c168x168_H_)
  1988. void drawBitmaps4c168x168()
  1989. {
  1990. if ((display.epd2.panel == GxEPD2::Waveshare437inch4color) || (display.epd2.panel == GxEPD2::Waveshare3inch4color) ||
  1991. (display.epd2.panel == GxEPD2::GDEY0579F51) || (display.epd2.panel == GxEPD2::GDEY116F51))
  1992. {
  1993. display.drawNative(WS_Bitmap4c168x168, 0, (display.epd2.WIDTH - 168) / 2, (display.epd2.HEIGHT - 168) / 2, 168, 168, false, false, true);
  1994. delay(5000);
  1995. }
  1996. }
  1997. #endif
  1998. #if defined(_WS_Bitmaps4c168x400_H_)
  1999. void drawBitmaps4c168x400()
  2000. {
  2001. if (display.epd2.panel == GxEPD2::Waveshare3inch4color)
  2002. {
  2003. display.drawNative(WS_Bitmap4c168x400, 0, (display.epd2.WIDTH - 168) / 2, (display.epd2.HEIGHT - 400) / 2, 168, 400, false, false, true);
  2004. delay(5000);
  2005. }
  2006. }
  2007. #endif
  2008. #if defined(_GxBitmaps4c168x384_H_)
  2009. void drawBitmaps4c168x384()
  2010. {
  2011. if (display.epd2.panel == GxEPD2::GDEY029F51H)
  2012. {
  2013. display.drawNative(Bitmap4c168x384, 0, (display.epd2.WIDTH - 168) / 2, (display.epd2.HEIGHT - 384) / 2, 168, 384, false, false, true);
  2014. delay(5000);
  2015. }
  2016. }
  2017. #endif
  2018. #if defined(_GxBitmaps4c184x360_H_)
  2019. void drawBitmaps4c184x360()
  2020. {
  2021. if (display.epd2.panel == GxEPD2::GDEY0266F51H)
  2022. {
  2023. display.drawNative(Bitmap4c184x360, 0, (display.epd2.WIDTH - 184) / 2, (display.epd2.HEIGHT - 360) / 2, 184, 360, false, false, true);
  2024. delay(5000);
  2025. }
  2026. }
  2027. #endif
  2028. #if defined(_GxBitmaps4c400x300_H_)
  2029. void drawBitmaps4c400x300()
  2030. {
  2031. if (display.epd2.panel == GxEPD2::GDEY0420F51)
  2032. {
  2033. display.drawNative(Bitmap4c400x300, 0, (display.epd2.WIDTH - 400) / 2, (display.epd2.HEIGHT - 300) / 2, 400, 300, false, false, true);
  2034. delay(5000);
  2035. }
  2036. }
  2037. #endif
  2038. #if defined(_GxBitmaps4c960x640_H_)
  2039. void drawBitmaps4c960x640()
  2040. {
  2041. if (display.epd2.panel == GxEPD2::GDEY116F51)
  2042. {
  2043. display.drawNative(Bitmap4c960x640, 0, (display.epd2.WIDTH - 960) / 2, (display.epd2.HEIGHT - 640) / 2, 960, 640, true, false, true);
  2044. delay(5000);
  2045. }
  2046. }
  2047. #endif
  2048. #if defined(ESP32) && defined(_GxBitmaps4c792x272_H_)
  2049. void drawBitmaps4c792x272()
  2050. {
  2051. if (display.epd2.panel == GxEPD2::GDEY0579F51)
  2052. {
  2053. display.drawNative(Bitmap4c792x272, 0, (display.epd2.WIDTH - 792) / 2, (display.epd2.HEIGHT - 272) / 2, 792, 272, true, false, true);
  2054. delay(5000);
  2055. #if defined(GxEPD2_DRIVER_CLASS) && defined(IS_GxEPD2_DRIVER_4C)
  2056. #if IS_GxEPD2_DRIVER_4C(GxEPD2_DRIVER_CLASS)
  2057. int16_t wp = display.epd2.WIDTH / 5;
  2058. int16_t hp = display.epd2.HEIGHT / 5;
  2059. int16_t n = 0;
  2060. for (int16_t k = 0; k < 3; k++)
  2061. {
  2062. display.writeScreenBuffer();
  2063. for (int16_t i = 0; i < 5; i++)
  2064. {
  2065. for (int16_t j = 0; j < 5; j++)
  2066. {
  2067. if ((n++ % 2) || (k == 2))
  2068. {
  2069. display.epd2.writeNativePart(Bitmap4c792x272, 0, i * wp, j * hp, 792, 272, i * wp, j * hp, wp, hp, true, false, true);
  2070. }
  2071. }
  2072. }
  2073. display.refresh(false);
  2074. delay(2000);
  2075. }
  2076. #endif
  2077. #endif
  2078. }
  2079. }
  2080. #endif
  2081. #if defined(_GxBitmaps7c600x448_H_)
  2082. void drawBitmaps7c600x448()
  2083. {
  2084. if (display.epd2.panel == GxEPD2::GDEP0565D90)
  2085. {
  2086. display.epd2.drawDemoBitmap(Bitmap7c600x448, 0, 0, 0, 600, 448, 1, false, true);
  2087. delay(5000);
  2088. }
  2089. }
  2090. #endif
  2091. #if defined(_WS_Bitmaps7c192x143_H_)
  2092. void drawBitmaps7c192x143()
  2093. {
  2094. if (display.epd2.panel == GxEPD2::ACeP565)
  2095. {
  2096. display.drawNative(WS_Bitmap7c192x143, 0, (display.epd2.WIDTH - 192) / 2, (display.epd2.HEIGHT - 143) / 2, 192, 143, false, false, true);
  2097. delay(5000);
  2098. }
  2099. }
  2100. #endif
  2101. #if defined(_GxBitmaps7c800x480_H_)
  2102. void drawBitmaps7c800x480()
  2103. {
  2104. if ((display.epd2.panel == GxEPD2::GDEY073D46) || (display.epd2.panel == GxEPD2::ACeP730) || (display.epd2.panel == GxEPD2::GDEP0565D90) || (display.epd2.panel == GxEPD2::GDEP073E01))
  2105. {
  2106. display.epd2.drawDemoBitmap(Bitmap7c800x480, 0, 0, 0, 800, 480, 0, false, true); // special format
  2107. delay(5000);
  2108. display.epd2.drawDemoBitmap(Bitmap7c800x480_2, 0, 0, 0, 800, 480, 1, false, true); // special format mode 1
  2109. delay(5000);
  2110. }
  2111. }
  2112. #endif
  2113. #if defined(_WS_Bitmaps7c300x180_H_)
  2114. void drawBitmaps7c300x180()
  2115. {
  2116. if ((display.epd2.panel == GxEPD2::GDEY073D46) || (display.epd2.panel == GxEPD2::ACeP730) || (display.epd2.panel == GxEPD2::GDEP0565D90))
  2117. {
  2118. display.drawNative(WS_Bitmap7c300x180, 0, (display.epd2.WIDTH - 300) / 2, (display.epd2.HEIGHT - 180) / 2, 300, 180, false, false, true);
  2119. delay(5000);
  2120. }
  2121. }
  2122. #endif
  2123. void draw7colors()
  2124. {
  2125. display.setRotation(0);
  2126. uint16_t h = display.height() / 7;
  2127. display.firstPage();
  2128. do
  2129. {
  2130. display.fillRect(0, 0, display.width(), h, GxEPD_BLACK);
  2131. display.fillRect(0, h, display.width(), h, GxEPD_WHITE);
  2132. display.fillRect(0, 2 * h, display.width(), h, GxEPD_GREEN);
  2133. display.fillRect(0, 3 * h, display.width(), h, GxEPD_BLUE);
  2134. display.fillRect(0, 4 * h, display.width(), h, GxEPD_RED);
  2135. display.fillRect(0, 5 * h, display.width(), h, GxEPD_YELLOW);
  2136. display.fillRect(0, 6 * h, display.width(), h, GxEPD_ORANGE);
  2137. }
  2138. while (display.nextPage());
  2139. }
  2140. void draw7colorlines()
  2141. {
  2142. display.setRotation(0);
  2143. uint16_t h = 2;
  2144. display.firstPage();
  2145. do
  2146. {
  2147. uint16_t y = 0;
  2148. do
  2149. {
  2150. display.fillRect(0, y, display.width(), h, GxEPD_BLACK); y += h;
  2151. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2152. display.fillRect(0, y, display.width(), h, GxEPD_GREEN); y += h;
  2153. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2154. display.fillRect(0, y, display.width(), h, GxEPD_BLUE); y += h;
  2155. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2156. display.fillRect(0, y, display.width(), h, GxEPD_RED); y += h;
  2157. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2158. display.fillRect(0, y, display.width(), h, GxEPD_YELLOW); y += h;
  2159. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2160. display.fillRect(0, y, display.width(), h, GxEPD_ORANGE); y += h;
  2161. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  2162. }
  2163. while ((y + 12 * h) < uint16_t(display.height()));
  2164. //display.drawPixel(0, y, GxEPD_BLACK); display.drawPixel(10, y, GxEPD_GREEN);
  2165. //display.drawPixel(20, y, GxEPD_BLUE); display.drawPixel(30, y, GxEPD_RED);
  2166. //display.drawPixel(40, y, GxEPD_YELLOW); display.drawPixel(50, y, GxEPD_ORANGE);
  2167. display.fillRect(0, y, 2, 2, GxEPD_BLACK); display.fillRect(10, y, 2, 2, GxEPD_GREEN);
  2168. display.fillRect(20, y, 2, 2, GxEPD_BLUE); display.fillRect(30, y, 2, 2, GxEPD_RED);
  2169. display.fillRect(40, y, 2, 2, GxEPD_YELLOW); display.fillRect(50, y, 2, 2, GxEPD_ORANGE);
  2170. }
  2171. while (display.nextPage());
  2172. }
  2173. void drawGraphics()
  2174. {
  2175. display.setRotation(0);
  2176. display.firstPage();
  2177. do
  2178. {
  2179. display.drawRect(display.width() / 8, display.height() / 8, display.width() * 3 / 4, display.height() * 3 / 4, GxEPD_BLACK);
  2180. display.drawLine(display.width() / 8, display.height() / 8, display.width() * 7 / 8, display.height() * 7 / 8, GxEPD_BLACK);
  2181. display.drawLine(display.width() / 8, display.height() * 7 / 8, display.width() * 7 / 8, display.height() / 8, GxEPD_BLACK);
  2182. display.drawCircle(display.width() / 2, display.height() / 2, display.height() / 4, GxEPD_BLACK);
  2183. display.drawPixel(display.width() / 4, display.height() / 2 , GxEPD_BLACK);
  2184. display.drawPixel(display.width() * 3 / 4, display.height() / 2 , GxEPD_BLACK);
  2185. }
  2186. while (display.nextPage());
  2187. delay(1000);
  2188. }