GxEPD2_MultiDisplayExample.ino 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016
  1. // GxEPD2_MultiDisplayExample : 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: http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html
  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:
  12. // Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0
  13. // Good Display ePaper for Arduino : https://forum.arduino.cc/index.php?topic=436411.0
  14. // mapping suggestion from Waveshare SPI e-Paper to Wemos D1 mini
  15. // BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V
  16. // mapping suggestion from Waveshare SPI e-Paper to generic ESP8266
  17. // BUSY -> GPIO4, RST -> GPIO2, DC -> GPIO0, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V
  18. // mapping of Waveshare e-Paper ESP8266 Driver Board
  19. // BUSY -> GPIO16, RST -> GPIO5, DC -> GPIO4, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V
  20. // mapping suggestion for ESP32, e.g. LOLIN32, see .../variants/.../pins_arduino.h for your board
  21. // NOTE: there are variants with different pins for SPI ! CHECK SPI PINS OF YOUR BOARD
  22. // BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V
  23. // new mapping suggestion for STM32F1, e.g. STM32F103C8T6 "BluePill"
  24. // BUSY -> A1, RST -> A2, DC -> A3, CS-> A4, CLK -> A5, DIN -> A7
  25. // mapping suggestion for AVR, UNO, NANO etc.
  26. // BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11
  27. // base class GxEPD2_GFX can be used to pass references or pointers to the display instance as parameter
  28. // enable GxEPD2_GFX base class
  29. #define ENABLE_GxEPD2_GFX 1
  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. // !!!! ============================================================================================ !!!!
  35. #include <GxEPD2_BW.h>
  36. #include <GxEPD2_3C.h>
  37. #include <Fonts/FreeMonoBold9pt7b.h>
  38. // create display class instances for each display, each instance with different CS line, each instance with RST disabled,
  39. // (or use separate RST pins for each display),
  40. // each instance with different BUSY line, or BUSY lines or-ed to one pin
  41. // disable reset line to disable cross resets by multiple instances
  42. #if defined (ESP8266)
  43. #define RST_PIN 0 // D3(0)
  44. #define CS_1 SS // CS = D8(15)
  45. #define CS_2 16 // CS = D0(16)
  46. #define CS_3 5 // CS = D1(5)
  47. // BUSY lines can be or-ed with diodes and pulldown register for displays with BUSY active HIGH
  48. #define BUSY_H_x 4 // BUSY = D2(4)
  49. // BUSY lines can be or-ed with diodes and pullup resistor for displays with BUSY active LOW
  50. //#define BUSY_L_x 4 // BUSY = D2(4)
  51. // select one and adapt to your mapping, can use full buffer size (full HEIGHT)
  52. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display1(GxEPD2_154(/*CS=*/ CS_1, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEP015OC1 no longer available
  53. GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display1(GxEPD2_154_D67(/*CS=*/ CS_1, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEH0154D67
  54. //GxEPD2_BW<GxEPD2_154_T8, GxEPD2_154_T8::HEIGHT> display(GxEPD2_154_T8(/*CS=*/ CS_1, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEW0154T8 152x152
  55. //GxEPD2_BW<GxEPD2_154_M09, GxEPD2_154_M09::HEIGHT> display(GxEPD2_154_M09(/*CS=*/ CS_1, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEW0154M09 200x200
  56. //GxEPD2_BW<GxEPD2_154_M10, GxEPD2_154_M10::HEIGHT> display(GxEPD2_154_M10(/*CS=*/ CS_1, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEW0154M10 152x152
  57. GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display2(GxEPD2_213(/*CS=*/ CS_2, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x));
  58. //GxEPD2_BW<GxEPD2_213_B72, GxEPD2_213_B72::HEIGHT> display(GxEPD2_213_B72(/*CS=*/ CS_1, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEH0213B72
  59. //GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=*/ CS_1, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEH0213B73
  60. //GxEPD2_BW<GxEPD2_213_flex, GxEPD2_213_flex::HEIGHT> display(GxEPD2_213_flex(/*CS=*/ CS_1, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEW0213I5F
  61. GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display3(GxEPD2_290(/*CS=*/ CS_3, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x));
  62. //GxEPD2_BW<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=*/ CS_1, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEW029T5
  63. //GxEPD2_BW<GxEPD2_260, GxEPD2_260::HEIGHT> display(GxEPD2_260(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  64. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  65. //GxEPD2_BW<GxEPD2_371, GxEPD2_371::HEIGHT> display(GxEPD2_371(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  66. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  67. // can use only half buffer size
  68. //GxEPD2_BW < GxEPD2_583, GxEPD2_583::HEIGHT / 2 > display(GxEPD2_583(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  69. //GxEPD2_BW < GxEPD2_583_T8, GxEPD2_583_T8::HEIGHT / 2 > display(GxEPD2_583_T8(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  70. //GxEPD2_BW < GxEPD2_750, GxEPD2_750::HEIGHT / 2 > display(GxEPD2_750(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  71. //GxEPD2_BW < GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT / 2 > display(GxEPD2_750_T7(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x)); // GDEW075T7 800x480
  72. // 3-color e-papers
  73. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  74. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  75. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  76. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  77. // can use only half buffer size
  78. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT / 2> display(GxEPD2_420c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  79. // can use only quarter buffer size
  80. //GxEPD2_3C<GxEPD2_583c, GxEPD2_583c::HEIGHT / 4> display(GxEPD2_583c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  81. //GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display3(GxEPD2_750c(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  82. //GxEPD2_3C < GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT / 4 > display(GxEPD2_750c_Z08(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x)); // GDEW075Z08 800x480
  83. #endif
  84. #if defined(ESP32)
  85. #define RST_PIN 16
  86. #define CS_1 SS // CS = 5(SS)
  87. #define CS_2 0 // CS = 0
  88. #define CS_3 2 // CS = 2
  89. #define CS_4 13 // CS = 13
  90. // BUSY lines can be or-ed with diodes and pulldown register for displays with BUSY active HIGH
  91. #define BUSY_H_x 4 // BUSY = 4
  92. // BUSY lines can be or-ed with diodes and pullup resistor for displays with BUSY active LOW
  93. #define BUSY_L_x 15 // BUSY = 15
  94. // select one and adapt to your mapping, can use full buffer size (full HEIGHT)
  95. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display1(GxEPD2_154(/*CS=*/ CS_1, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEP015OC1 no longer available
  96. GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display1(GxEPD2_154_D67(/*CS=*/ CS_1, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEH0154D67
  97. //GxEPD2_BW<GxEPD2_154_T8, GxEPD2_154_T8::HEIGHT> display(GxEPD2_154_T8(/*CS=*/ CS_1, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEW0154T8 152x152
  98. //GxEPD2_BW<GxEPD2_154_M09, GxEPD2_154_M09::HEIGHT> display(GxEPD2_154_M09(/*CS=*/ CS_1, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEW0154M09 200x200
  99. //GxEPD2_BW<GxEPD2_154_M10, GxEPD2_154_M10::HEIGHT> display(GxEPD2_154_M10(/*CS=*/ CS_1, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEW0154M10 152x152
  100. GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display2(GxEPD2_213(/*CS=*/ CS_2, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x));
  101. GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display3(GxEPD2_290(/*CS=*/ CS_3, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x));
  102. //GxEPD2_BW<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=*/ CS_1, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_H_x)); // GDEW029T5
  103. //GxEPD2_BW<GxEPD2_260, GxEPD2_260::HEIGHT> display(GxEPD2_260(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  104. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  105. //GxEPD2_BW<GxEPD2_371, GxEPD2_371::HEIGHT> display(GxEPD2_371(/*CS=*/ CS_x, /*DC=D3*/ 0, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  106. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display4(GxEPD2_420(/*CS=*/ CS_4, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  107. //GxEPD2_BW<GxEPD2_583, GxEPD2_583::HEIGHT> display(GxEPD2_583(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  108. //GxEPD2_BW<GxEPD2_583_T8, GxEPD2_583_T8::HEIGHT> display(GxEPD2_583_T8(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  109. //GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display(GxEPD2_750(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  110. //GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x)); // GDEW075T7 800x480
  111. // 3-color e-papers
  112. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  113. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  114. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  115. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  116. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT> display(GxEPD2_420c(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  117. GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT> display4(GxEPD2_750c(/*CS=*/ CS_4, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x));
  118. //GxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT> display(GxEPD2_750c_Z08(/*CS=*/ CS_x, /*DC=*/ 17, /*RST=*/ -1, /*BUSY=*/ BUSY_L_x)); // GDEW075Z08 800x480
  119. #endif
  120. // comment out unused bitmaps to reduce code space used
  121. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  122. #include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  123. #include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  124. #include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  125. #include "bitmaps/Bitmaps400x300.h" // 4.2" b/w
  126. #include "bitmaps/Bitmaps640x384.h" // 7.5" b/w
  127. // 3-color
  128. #include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  129. #include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  130. #include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  131. #include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  132. #include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r
  133. void setup()
  134. {
  135. Serial.begin(115200);
  136. Serial.println();
  137. Serial.println("setup");
  138. // one common reset for all displays
  139. digitalWrite(RST_PIN, HIGH);
  140. pinMode(RST_PIN, OUTPUT);
  141. delay(20);
  142. digitalWrite(RST_PIN, LOW);
  143. delay(20);
  144. digitalWrite(RST_PIN, HIGH);
  145. delay(200);
  146. display1.init(115200); // enable diagnostic output on Serial
  147. display2.init(115200); // enable diagnostic output on Serial
  148. display3.init(115200); // enable diagnostic output on Serial
  149. #if defined(ESP32)
  150. display4.init(115200); // enable diagnostic output on Serial
  151. #endif
  152. // first update should be full refresh
  153. helloWorld(display1);
  154. helloWorld(display2);
  155. helloWorld(display3);
  156. #if defined(ESP32)
  157. helloWorld(display4);
  158. #endif
  159. delay(1000);
  160. // partial refresh mode can be used to full screen,
  161. // effective if display panel hasFastPartialUpdate
  162. helloFullScreenPartialMode(display1);
  163. helloFullScreenPartialMode(display2);
  164. helloFullScreenPartialMode(display3);
  165. #if defined(ESP32)
  166. helloFullScreenPartialMode(display4);
  167. #endif
  168. delay(1000);
  169. helloArduino(display1);
  170. helloArduino(display2);
  171. helloArduino(display3);
  172. #if defined(ESP32)
  173. helloArduino(display4);
  174. #endif
  175. delay(1000);
  176. helloEpaper(display1);
  177. helloEpaper(display2);
  178. helloEpaper(display3);
  179. #if defined(ESP32)
  180. helloEpaper(display4);
  181. #endif
  182. delay(1000);
  183. showFont(display1, "FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  184. showFont(display2, "FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  185. showFont(display3, "FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  186. #if defined(ESP32)
  187. showFont(display4, "FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  188. #endif
  189. delay(1000);
  190. drawBitmaps(display1);
  191. drawBitmaps(display2);
  192. drawBitmaps(display3);
  193. #if defined(ESP32)
  194. drawBitmaps(display4);
  195. #endif
  196. // if (display1.epd2.hasPartialUpdate)
  197. // {
  198. // showPartialUpdate(display1);
  199. // delay(1000);
  200. // } // else // on GDEW0154Z04 only full update available, doesn't look nice
  201. //drawCornerTest(display1);
  202. //showBox(display1, 16, 16, 48, 32, false);
  203. //showBox(display1, 16, 56, 48, 32, true);
  204. display1.powerOff();
  205. display2.powerOff();
  206. display3.powerOff();
  207. Serial.println("setup done");
  208. }
  209. void loop()
  210. {
  211. }
  212. void helloWorld(GxEPD2_GFX& display)
  213. {
  214. //Serial.println("helloWorld");
  215. display.setRotation(1);
  216. display.setFont(&FreeMonoBold9pt7b);
  217. display.setTextColor(GxEPD_BLACK);
  218. uint16_t x = (display.width() - 160) / 2;
  219. uint16_t y = display.height() / 2;
  220. display.setFullWindow();
  221. display.firstPage();
  222. do
  223. {
  224. display.fillScreen(GxEPD_WHITE);
  225. display.setCursor(x, y);
  226. display.println("Hello World!");
  227. }
  228. while (display.nextPage());
  229. //Serial.println("helloWorld done");
  230. }
  231. void helloFullScreenPartialMode(GxEPD2_GFX& display)
  232. {
  233. //Serial.println("helloFullScreenPartialMode");
  234. display.setPartialWindow(0, 0, display.width(), display.height());
  235. display.setRotation(1);
  236. display.setFont(&FreeMonoBold9pt7b);
  237. display.setTextColor(GxEPD_BLACK);
  238. display.firstPage();
  239. do
  240. {
  241. uint16_t x = (display.width() - 160) / 2;
  242. uint16_t y = display.height() / 2;
  243. display.fillScreen(GxEPD_WHITE);
  244. display.setCursor(x, y);
  245. display.println("Hello World!");
  246. y = display.height() / 4;
  247. display.setCursor(x, y);
  248. display.println("full screen");
  249. y = display.height() * 3 / 4;
  250. if (display.width() <= 200) x = 0;
  251. display.setCursor(x, y);
  252. if (display.epd2.hasFastPartialUpdate)
  253. {
  254. display.println("fast partial mode");
  255. }
  256. else if (display.epd2.hasPartialUpdate)
  257. {
  258. display.println("slow partial mode");
  259. }
  260. else
  261. {
  262. display.println("no partial mode");
  263. }
  264. }
  265. while (display.nextPage());
  266. //Serial.println("helloFullScreenPartialMode done");
  267. }
  268. void helloArduino(GxEPD2_GFX& display)
  269. {
  270. //Serial.println("helloArduino");
  271. display.setRotation(1);
  272. display.setFont(&FreeMonoBold9pt7b);
  273. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  274. uint16_t x = (display.width() - 160) / 2;
  275. uint16_t y = display.height() / 4;
  276. display.setPartialWindow(0, y - 14, display.width(), 20);
  277. display.firstPage();
  278. do
  279. {
  280. display.fillScreen(GxEPD_WHITE);
  281. display.setCursor(x, y);
  282. display.println("Hello Arduino!");
  283. }
  284. while (display.nextPage());
  285. delay(1000);
  286. //Serial.println("helloArduino done");
  287. }
  288. void helloEpaper(GxEPD2_GFX& display)
  289. {
  290. //Serial.println("helloEpaper");
  291. display.setRotation(1);
  292. display.setFont(&FreeMonoBold9pt7b);
  293. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  294. uint16_t x = (display.width() - 160) / 2;
  295. uint16_t y = display.height() * 3 / 4;
  296. display.setPartialWindow(0, y - 14, display.width(), 20);
  297. display.firstPage();
  298. do
  299. {
  300. display.fillScreen(GxEPD_WHITE);
  301. display.setCursor(x, y);
  302. display.println("Hello E-Paper!");
  303. }
  304. while (display.nextPage());
  305. //Serial.println("helloEpaper done");
  306. }
  307. void showBox(GxEPD2_GFX& display, uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
  308. {
  309. //Serial.println("showBox");
  310. display.setRotation(1);
  311. if (partial)
  312. {
  313. display.setPartialWindow(x, y, w, h);
  314. }
  315. else
  316. {
  317. display.setFullWindow();
  318. }
  319. display.firstPage();
  320. do
  321. {
  322. display.fillScreen(GxEPD_WHITE);
  323. display.fillRect(x, y, w, h, GxEPD_BLACK);
  324. }
  325. while (display.nextPage());
  326. //Serial.println("showBox done");
  327. }
  328. void drawCornerTest(GxEPD2_GFX& display)
  329. {
  330. display.setFullWindow();
  331. display.setFont(&FreeMonoBold9pt7b);
  332. display.setTextColor(GxEPD_BLACK);
  333. for (uint16_t r = 0; r <= 4; r++)
  334. {
  335. display.setRotation(r);
  336. display.firstPage();
  337. do
  338. {
  339. display.fillScreen(GxEPD_WHITE);
  340. display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
  341. display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
  342. display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
  343. display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
  344. display.setCursor(display.width() / 2, display.height() / 2);
  345. display.print(display.getRotation());
  346. }
  347. while (display.nextPage());
  348. delay(2000);
  349. }
  350. }
  351. void showFont(GxEPD2_GFX& display, const char name[], const GFXfont* f)
  352. {
  353. display.setFullWindow();
  354. display.setRotation(0);
  355. display.setTextColor(GxEPD_BLACK);
  356. display.firstPage();
  357. do
  358. {
  359. drawFont(display, name, f);
  360. }
  361. while (display.nextPage());
  362. }
  363. //void drawFont(GxEPD2_GFX& display, const char name[], const GFXfont* f);
  364. void drawFont(GxEPD2_GFX& display, const char name[], const GFXfont* f)
  365. {
  366. //display.setRotation(0);
  367. display.fillScreen(GxEPD_WHITE);
  368. display.setTextColor(GxEPD_BLACK);
  369. display.setFont(f);
  370. display.setCursor(0, 0);
  371. display.println();
  372. display.println(name);
  373. display.println(" !\"#$%&'()*+,-./");
  374. display.println("0123456789:;<=>?");
  375. display.println("@ABCDEFGHIJKLMNO");
  376. display.println("PQRSTUVWXYZ[\\]^_");
  377. if (display.epd2.hasColor)
  378. {
  379. display.setTextColor(GxEPD_RED);
  380. }
  381. display.println("`abcdefghijklmno");
  382. display.println("pqrstuvwxyz{|}~ ");
  383. }
  384. void showPartialUpdate(GxEPD2_GFX& display)
  385. {
  386. // some useful background
  387. helloWorld(display);
  388. // use asymmetric values for test
  389. uint16_t box_x = 10;
  390. uint16_t box_y = 15;
  391. uint16_t box_w = 70;
  392. uint16_t box_h = 20;
  393. uint16_t cursor_y = box_y + box_h - 6;
  394. float value = 13.95;
  395. uint16_t incr = display.epd2.hasFastPartialUpdate ? 1 : 3;
  396. display.setFont(&FreeMonoBold9pt7b);
  397. display.setTextColor(GxEPD_BLACK);
  398. // show where the update box is
  399. for (uint16_t r = 0; r < 4; r++)
  400. {
  401. display.setRotation(r);
  402. display.setPartialWindow(box_x, box_y, box_w, box_h);
  403. display.firstPage();
  404. do
  405. {
  406. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  407. //display.fillScreen(GxEPD_BLACK);
  408. }
  409. while (display.nextPage());
  410. delay(2000);
  411. display.firstPage();
  412. do
  413. {
  414. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  415. }
  416. while (display.nextPage());
  417. delay(1000);
  418. }
  419. //return;
  420. // show updates in the update box
  421. for (uint16_t r = 0; r < 4; r++)
  422. {
  423. display.setRotation(r);
  424. display.setPartialWindow(box_x, box_y, box_w, box_h);
  425. for (uint16_t i = 1; i <= 10; i += incr)
  426. {
  427. display.firstPage();
  428. do
  429. {
  430. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  431. display.setCursor(box_x, cursor_y);
  432. display.print(value * i, 2);
  433. }
  434. while (display.nextPage());
  435. delay(500);
  436. }
  437. delay(1000);
  438. display.firstPage();
  439. do
  440. {
  441. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  442. }
  443. while (display.nextPage());
  444. delay(1000);
  445. }
  446. }
  447. #ifdef _GxBitmaps200x200_H_
  448. void drawBitmaps200x200(GxEPD2_GFX& display);
  449. void drawBitmaps200x200(GxEPD2_GFX& display)
  450. {
  451. #if defined(__AVR)
  452. const unsigned char* bitmaps[] =
  453. {
  454. logo200x200, first200x200 //, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  455. };
  456. #elif defined(_BOARD_GENERIC_STM32F103C_H_)
  457. const unsigned char* bitmaps[] =
  458. {
  459. logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200 //, sixth200x200, senventh200x200, eighth200x200
  460. };
  461. #else
  462. const unsigned char* bitmaps[] =
  463. {
  464. logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  465. };
  466. #endif
  467. if ((display.epd2.panel == GxEPD2::GDEP015OC1) || (display.epd2.panel == GxEPD2::GDEH0154D67))
  468. {
  469. bool m = display.mirror(true);
  470. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  471. {
  472. display.firstPage();
  473. do
  474. {
  475. display.fillScreen(GxEPD_WHITE);
  476. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  477. }
  478. while (display.nextPage());
  479. delay(2000);
  480. }
  481. display.mirror(m);
  482. }
  483. //else
  484. {
  485. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  486. display.clearScreen(); // use default for white
  487. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  488. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  489. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  490. {
  491. display.drawImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  492. delay(2000);
  493. }
  494. }
  495. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  496. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  497. {
  498. int16_t x = -60;
  499. int16_t y = -60;
  500. for (uint16_t j = 0; j < 10; j++)
  501. {
  502. display.writeScreenBuffer(); // use default for white
  503. display.writeImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  504. display.refresh(true);
  505. if (display.epd2.hasFastPartialUpdate)
  506. {
  507. // for differential update: set previous buffer equal to current buffer in controller
  508. display.epd2.writeScreenBufferAgain(); // use default for white
  509. display.epd2.writeImageAgain(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  510. }
  511. delay(2000);
  512. x += 40;
  513. y += 40;
  514. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  515. }
  516. if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
  517. break; // comment out for full show
  518. }
  519. display.writeScreenBuffer(); // use default for white
  520. display.writeImage(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  521. display.writeImage(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
  522. display.refresh(true);
  523. delay(2000);
  524. }
  525. #endif
  526. #ifdef _GxBitmaps128x250_H_
  527. void drawBitmaps128x250(GxEPD2_GFX& display);
  528. void drawBitmaps128x250(GxEPD2_GFX& display)
  529. {
  530. #if !defined(__AVR)
  531. const unsigned char* bitmaps[] =
  532. {
  533. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  534. };
  535. #else
  536. const unsigned char* bitmaps[] =
  537. {
  538. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  539. };
  540. #endif
  541. if (display.epd2.panel == GxEPD2::GDE0213B1)
  542. {
  543. bool m = display.mirror(true);
  544. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  545. {
  546. display.firstPage();
  547. do
  548. {
  549. display.fillScreen(GxEPD_WHITE);
  550. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  551. }
  552. while (display.nextPage());
  553. delay(2000);
  554. }
  555. display.mirror(m);
  556. }
  557. }
  558. #endif
  559. #ifdef _GxBitmaps128x296_H_
  560. void drawBitmaps128x296(GxEPD2_GFX& display);
  561. void drawBitmaps128x296(GxEPD2_GFX& display)
  562. {
  563. #if !defined(__AVR)
  564. const unsigned char* bitmaps[] =
  565. {
  566. Bitmap128x296_1, logo128x296, first128x296, second128x296, third128x296
  567. };
  568. #else
  569. const unsigned char* bitmaps[] =
  570. {
  571. Bitmap128x296_1, logo128x296 //, first128x296, second128x296, third128x296
  572. };
  573. #endif
  574. if (display.epd2.panel == GxEPD2::GDEH029A1)
  575. {
  576. bool m = display.mirror(true);
  577. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  578. {
  579. display.firstPage();
  580. do
  581. {
  582. display.fillScreen(GxEPD_WHITE);
  583. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  584. }
  585. while (display.nextPage());
  586. delay(2000);
  587. }
  588. display.mirror(m);
  589. }
  590. }
  591. #endif
  592. #ifdef _GxBitmaps176x264_H_
  593. void drawBitmaps176x264(GxEPD2_GFX& display);
  594. void drawBitmaps176x264(GxEPD2_GFX& display)
  595. {
  596. const unsigned char* bitmaps[] =
  597. {
  598. Bitmap176x264_1, Bitmap176x264_2
  599. };
  600. if (display.epd2.panel == GxEPD2::GDEW027W3)
  601. {
  602. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  603. {
  604. display.firstPage();
  605. do
  606. {
  607. display.fillScreen(GxEPD_WHITE);
  608. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  609. }
  610. while (display.nextPage());
  611. delay(2000);
  612. }
  613. }
  614. }
  615. #endif
  616. #ifdef _GxBitmaps400x300_H_
  617. void drawBitmaps400x300(GxEPD2_GFX& display);
  618. void drawBitmaps400x300(GxEPD2_GFX& display)
  619. {
  620. #if !defined(__AVR)
  621. const unsigned char* bitmaps[] =
  622. {
  623. Bitmap400x300_1, Bitmap400x300_2
  624. };
  625. #else
  626. const unsigned char* bitmaps[] = {}; // not enough code space
  627. #endif
  628. if (display.epd2.panel == GxEPD2::GDEW042T2)
  629. {
  630. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  631. {
  632. display.firstPage();
  633. do
  634. {
  635. display.fillScreen(GxEPD_WHITE);
  636. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  637. }
  638. while (display.nextPage());
  639. delay(2000);
  640. }
  641. }
  642. }
  643. #endif
  644. #ifdef _GxBitmaps640x384_H_
  645. void drawBitmaps640x384(GxEPD2_GFX& display);
  646. void drawBitmaps640x384(GxEPD2_GFX& display)
  647. {
  648. #if !defined(__AVR)
  649. const unsigned char* bitmaps[] =
  650. {
  651. Bitmap640x384_1, Bitmap640x384_2
  652. };
  653. #else
  654. const unsigned char* bitmaps[] = {}; // not enough code space
  655. #endif
  656. if (display.epd2.panel == GxEPD2::GDEW075T8)
  657. {
  658. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  659. {
  660. display.firstPage();
  661. do
  662. {
  663. display.fillScreen(GxEPD_WHITE);
  664. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  665. }
  666. while (display.nextPage());
  667. delay(2000);
  668. }
  669. }
  670. }
  671. #endif
  672. struct bitmap_pair
  673. {
  674. const unsigned char* black;
  675. const unsigned char* red;
  676. };
  677. #ifdef _GxBitmaps3c200x200_H_
  678. void drawBitmaps3c200x200(GxEPD2_GFX& display);
  679. void drawBitmaps3c200x200(GxEPD2_GFX& display)
  680. {
  681. bitmap_pair bitmap_pairs[] =
  682. {
  683. //{Bitmap3c200x200_black, Bitmap3c200x200_red},
  684. {WS_Bitmap3c200x200_black, WS_Bitmap3c200x200_red}
  685. };
  686. if (display.epd2.panel == GxEPD2::GDEW0154Z04)
  687. {
  688. display.firstPage();
  689. do
  690. {
  691. display.fillScreen(GxEPD_WHITE);
  692. // Bitmap3c200x200_black has 2 bits per pixel
  693. // taken from Adafruit_GFX.cpp, modified
  694. int16_t byteWidth = (display.epd2.WIDTH + 7) / 8; // Bitmap scanline pad = whole byte
  695. uint8_t byte = 0;
  696. for (int16_t j = 0; j < display.epd2.HEIGHT; j++)
  697. {
  698. for (int16_t i = 0; i < display.epd2.WIDTH; i++)
  699. {
  700. if (i & 3) byte <<= 2;
  701. else
  702. {
  703. #if defined(__AVR) || defined(ESP8266) || defined(ESP32)
  704. byte = pgm_read_byte(&Bitmap3c200x200_black[j * byteWidth * 2 + i / 4]);
  705. #else
  706. byte = Bitmap3c200x200_black[j * byteWidth * 2 + i / 4];
  707. #endif
  708. }
  709. if (!(byte & 0x80))
  710. {
  711. display.drawPixel(i, j, GxEPD_BLACK);
  712. }
  713. }
  714. }
  715. display.drawInvertedBitmap(0, 0, Bitmap3c200x200_red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  716. }
  717. while (display.nextPage());
  718. delay(2000);
  719. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  720. {
  721. display.firstPage();
  722. do
  723. {
  724. display.fillScreen(GxEPD_WHITE);
  725. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  726. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  727. }
  728. while (display.nextPage());
  729. delay(2000);
  730. }
  731. }
  732. if (display.epd2.hasColor)
  733. {
  734. display.clearScreen(); // use default for white
  735. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  736. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  737. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  738. {
  739. display.drawImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  740. delay(2000);
  741. }
  742. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  743. {
  744. int16_t x = -60;
  745. int16_t y = -60;
  746. for (uint16_t j = 0; j < 10; j++)
  747. {
  748. display.writeScreenBuffer(); // use default for white
  749. display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  750. display.refresh();
  751. delay(2000);
  752. x += 40;
  753. y += 40;
  754. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  755. }
  756. }
  757. display.writeScreenBuffer(); // use default for white
  758. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, 0, 0, 200, 200, false, false, true);
  759. 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);
  760. display.refresh();
  761. delay(2000);
  762. }
  763. }
  764. #endif
  765. #ifdef _GxBitmaps3c104x212_H_
  766. void drawBitmaps3c104x212(GxEPD2_GFX& display);
  767. void drawBitmaps3c104x212(GxEPD2_GFX& display)
  768. {
  769. #if !defined(__AVR)
  770. bitmap_pair bitmap_pairs[] =
  771. {
  772. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  773. {Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  774. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  775. };
  776. #else
  777. bitmap_pair bitmap_pairs[] =
  778. {
  779. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  780. //{Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  781. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  782. };
  783. #endif
  784. if (display.epd2.panel == GxEPD2::GDEW0213Z16)
  785. {
  786. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  787. {
  788. display.firstPage();
  789. do
  790. {
  791. display.fillScreen(GxEPD_WHITE);
  792. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  793. if (bitmap_pairs[i].red == WS_Bitmap3c104x212_red)
  794. {
  795. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  796. }
  797. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  798. }
  799. while (display.nextPage());
  800. delay(2000);
  801. }
  802. }
  803. }
  804. #endif
  805. #ifdef _GxBitmaps3c128x296_H_
  806. void drawBitmaps3c128x296(GxEPD2_GFX& display);
  807. void drawBitmaps3c128x296(GxEPD2_GFX& display)
  808. {
  809. #if !defined(__AVR)
  810. bitmap_pair bitmap_pairs[] =
  811. {
  812. {Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  813. {Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  814. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  815. };
  816. #else
  817. bitmap_pair bitmap_pairs[] =
  818. {
  819. //{Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  820. //{Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  821. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  822. };
  823. #endif
  824. if (display.epd2.panel == GxEPD2::GDEW029Z10)
  825. {
  826. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  827. {
  828. display.firstPage();
  829. do
  830. {
  831. display.fillScreen(GxEPD_WHITE);
  832. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  833. if (bitmap_pairs[i].red == WS_Bitmap3c128x296_red)
  834. {
  835. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  836. }
  837. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  838. }
  839. while (display.nextPage());
  840. delay(2000);
  841. }
  842. }
  843. }
  844. #endif
  845. #ifdef _GxBitmaps3c176x264_H_
  846. void drawBitmaps3c176x264(GxEPD2_GFX& display);
  847. void drawBitmaps3c176x264(GxEPD2_GFX& display)
  848. {
  849. bitmap_pair bitmap_pairs[] =
  850. {
  851. {Bitmap3c176x264_black, Bitmap3c176x264_red}
  852. };
  853. if (display.epd2.panel == GxEPD2::GDEW027C44)
  854. {
  855. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  856. {
  857. display.firstPage();
  858. do
  859. {
  860. display.fillScreen(GxEPD_WHITE);
  861. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  862. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  863. }
  864. while (display.nextPage());
  865. delay(2000);
  866. }
  867. }
  868. }
  869. #endif
  870. #ifdef _GxBitmaps3c400x300_H_
  871. void drawBitmaps3c400x300(GxEPD2_GFX& display);
  872. void drawBitmaps3c400x300(GxEPD2_GFX& display)
  873. {
  874. #if !defined(__AVR)
  875. bitmap_pair bitmap_pairs[] =
  876. {
  877. {Bitmap3c400x300_1_black, Bitmap3c400x300_1_red},
  878. {Bitmap3c400x300_2_black, Bitmap3c400x300_2_red},
  879. {WS_Bitmap3c400x300_black, WS_Bitmap3c400x300_red}
  880. };
  881. #else
  882. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  883. #endif
  884. if (display.epd2.panel == GxEPD2::GDEW042Z15)
  885. {
  886. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  887. {
  888. display.firstPage();
  889. do
  890. {
  891. display.fillScreen(GxEPD_WHITE);
  892. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  893. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  894. }
  895. while (display.nextPage());
  896. delay(2000);
  897. }
  898. }
  899. }
  900. #endif
  901. void drawBitmaps(GxEPD2_GFX& display)
  902. {
  903. display.setFullWindow();
  904. display.setRotation(0);
  905. #ifdef _GxBitmaps128x250_H_
  906. drawBitmaps128x250(display);
  907. #endif
  908. #ifdef _GxBitmaps128x296_H_
  909. drawBitmaps128x296(display);
  910. #endif
  911. #ifdef _GxBitmaps176x264_H_
  912. drawBitmaps176x264(display);
  913. #endif
  914. #ifdef _GxBitmaps400x300_H_
  915. drawBitmaps400x300(display);
  916. #endif
  917. #ifdef _GxBitmaps640x384_H_
  918. drawBitmaps640x384(display);
  919. #endif
  920. // 3-color
  921. #ifdef _GxBitmaps3c104x212_H_
  922. drawBitmaps3c104x212(display);
  923. #endif
  924. #ifdef _GxBitmaps3c128x296_H_
  925. drawBitmaps3c128x296(display);
  926. #endif
  927. #ifdef _GxBitmaps3c176x264_H_
  928. drawBitmaps3c176x264(display);
  929. #endif
  930. #ifdef _GxBitmaps3c400x300_H_
  931. drawBitmaps3c400x300(display);
  932. #endif
  933. // show these after the specific bitmaps
  934. #ifdef _GxBitmaps200x200_H_
  935. drawBitmaps200x200(display);
  936. #endif
  937. // 3-color
  938. #ifdef _GxBitmaps3c200x200_H_
  939. drawBitmaps3c200x200(display);
  940. #endif
  941. }