GxEPD2_Example.ino 65 KB

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