GxEPD2_Example.ino 70 KB

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