GxEPD2_Example.ino 69 KB

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