GxEPD2_Example.ino 70 KB

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