GxEPD2_Example.ino 64 KB

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