GxEPD2_Example.ino 66 KB

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