GxEPD2_Example.ino 66 KB

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