GxEPD2_Example.ino 65 KB

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