GxEPD2_Example.ino 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789
  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: 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. // NOTE: connect 3.3k pull-down from D8 to GND if your board or shield has level converters
  17. // NOTE for ESP8266: using SS (GPIO15) for CS may cause boot mode problems, use different pin in case, or 4k7 pull-down
  18. // mapping suggestion from Waveshare SPI e-Paper to generic ESP8266
  19. // BUSY -> GPIO4, RST -> GPIO2, DC -> GPIO0, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V
  20. // NOTE: connect 3.3k pull-down from GPIO15 to GND if your board or shield has level converters
  21. // NOTE for ESP8266: using SS (GPIO15) for CS may cause boot mode problems, use different pin in case, or 3.3k pull-down
  22. // mapping of Waveshare e-Paper ESP8266 Driver Board, new version (see GxEPD2_boards_added.h for old version)
  23. // BUSY -> GPIO5, RST -> GPIO2, DC -> GPIO4, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V
  24. // NOTE for ESP8266: using SS (GPIO15) for CS may cause boot mode problems, add a 3.3k pull-down in case
  25. // the e-Paper ESP8266 Driver Board should have no boot mode issue, as it doesn't use level converters
  26. // mapping suggestion for ESP32, e.g. LOLIN32, see .../variants/.../pins_arduino.h for your board
  27. // NOTE: there are variants with different pins for SPI ! CHECK SPI PINS OF YOUR BOARD
  28. // BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V
  29. // mapping of Waveshare ESP32 Driver Board
  30. // BUSY -> 25, RST -> 26, DC -> 27, CS-> 15, CLK -> 13, DIN -> 14
  31. // NOTE: this board uses "unusual" SPI pins and requires re-mapping of HW SPI to these pins in SPIClass
  32. // see example GxEPD2_WS_ESP32_Driver.ino, it shows how this can be done easily
  33. // new mapping suggestion for STM32F1, e.g. STM32F103C8T6 "BluePill"
  34. // BUSY -> A1, RST -> A2, DC -> A3, CS-> A4, CLK -> A5, DIN -> A7
  35. // mapping suggestion for AVR, UNO, NANO etc.
  36. // BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11
  37. // mapping of Waveshare Universal e-Paper Raw Panel Driver Shield for Arduino / NUCLEO
  38. // BUSY -> 7, RST -> 8, DC -> 9, CS-> 10, CLK -> 13, DIN -> 11
  39. // mapping suggestion for Arduino MEGA
  40. // BUSY -> 7, RST -> 9, DC -> 8, CS-> 53, CLK -> 52, DIN -> 51
  41. // base class GxEPD2_GFX can be used to pass references or pointers to the display instance as parameter, uses ~1.2k more code
  42. // enable or disable GxEPD2_GFX base class
  43. #define ENABLE_GxEPD2_GFX 0
  44. // uncomment next line to use class GFX of library GFX_Root instead of Adafruit_GFX
  45. //#include <GFX.h>
  46. // Note: if you use this with ENABLE_GxEPD2_GFX 1:
  47. // uncomment it in GxEPD2_GFX.h too, or add #include <GFX.h> before any #include <GxEPD2_GFX.h>
  48. #include <GxEPD2_BW.h>
  49. #include <GxEPD2_3C.h>
  50. #include <GxEPD2_7C.h>
  51. #include <Fonts/FreeMonoBold9pt7b.h>
  52. #if defined (ESP8266)
  53. // select one and adapt to your mapping, can use full buffer size (full HEIGHT)
  54. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEP015OC1 no longer available
  55. //GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display(GxEPD2_154_D67(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEH0154D67
  56. //GxEPD2_BW<GxEPD2_154_T8, GxEPD2_154_T8::HEIGHT> display(GxEPD2_154_T8(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0154T8 152x152
  57. //GxEPD2_BW<GxEPD2_154_M09, GxEPD2_154_M09::HEIGHT> display(GxEPD2_154_M09(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0154M09 200x200
  58. //GxEPD2_BW<GxEPD2_154_M10, GxEPD2_154_M10::HEIGHT> display(GxEPD2_154_M10(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0154M10 152x152
  59. //GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display(GxEPD2_213(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDE0213B1, phased out
  60. //GxEPD2_BW<GxEPD2_213_B72, GxEPD2_213_B72::HEIGHT> display(GxEPD2_213_B72(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEH0213B72
  61. //GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEH0213B73
  62. //GxEPD2_BW<GxEPD2_213_flex, GxEPD2_213_flex::HEIGHT> display(GxEPD2_213_flex(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0213I5F
  63. //GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  64. //GxEPD2_BW<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW029T5
  65. //GxEPD2_BW<GxEPD2_260, GxEPD2_260::HEIGHT> display(GxEPD2_260(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  66. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  67. //GxEPD2_BW<GxEPD2_371, GxEPD2_371::HEIGHT> display(GxEPD2_371(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  68. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  69. // can use only half buffer size
  70. //GxEPD2_BW < GxEPD2_583, GxEPD2_583::HEIGHT / 2 > display(GxEPD2_583(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  71. //GxEPD2_BW < GxEPD2_583_T8, GxEPD2_583_T8::HEIGHT / 2 > display(GxEPD2_583_T8(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  72. //GxEPD2_BW < GxEPD2_750, GxEPD2_750::HEIGHT / 2 > display(GxEPD2_750(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  73. //GxEPD2_BW < GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT / 2 > display(GxEPD2_750_T7(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW075T7 800x480
  74. // 3-color e-papers
  75. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0154Z04 no longer available
  76. //GxEPD2_3C<GxEPD2_154_Z90c, GxEPD2_154_Z90c::HEIGHT> display(GxEPD2_154_Z90c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEH0154Z90
  77. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  78. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  79. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  80. // can use only half buffer size
  81. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT / 2> display(GxEPD2_420c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  82. // can use only quarter buffer size
  83. //GxEPD2_3C < GxEPD2_583c, GxEPD2_583c::HEIGHT / 4 > display(GxEPD2_583c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  84. //GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display(GxEPD2_750c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
  85. //GxEPD2_3C < GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT / 4 > display(GxEPD2_750c_Z08(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW075Z08 800x480
  86. //GxEPD2_3C < GxEPD2_750c_Z90, GxEPD2_750c_Z90::HEIGHT / 4 > display(GxEPD2_750c_Z90(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEH075Z90 880x528
  87. // 7-color e-paper
  88. //GxEPD2_3C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 4 > display(GxEPD2_565c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // Waveshare 5.65" 7-color (3C graphics)
  89. //GxEPD2_7C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 4 > display(GxEPD2_565c(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // Waveshare 5.65" 7-color
  90. // grey levels parallel IF e-papers on Waveshare e-Paper IT8951 Driver HAT
  91. // HRDY -> 4, RST -> 2, CS -> SS(15), SCK -> SCK(14), MOSI -> MOSI(D7(13)), MISO -> MISO(D6(12)), GND -> GND, 5V -> 5V
  92. // note: 5V supply needs to be exact and strong; 5V pin of USB powered Wemos D1 mini doesn't work!
  93. //GxEPD2_BW<GxEPD2_it60, GxEPD2_it60::HEIGHT / 8> display(GxEPD2_it60(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 4));
  94. //GxEPD2_BW < GxEPD2_it60_1448x1072, GxEPD2_it60_1448x1072::HEIGHT / 8 > display(GxEPD2_it60_1448x1072(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 4));
  95. // ***** for mapping of Waveshare e-Paper ESP8266 Driver Board *****
  96. // select one , can use full buffer size (full HEIGHT)
  97. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEP015OC1 no longer available
  98. //GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display(GxEPD2_154_D67(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEH0154D67
  99. //GxEPD2_BW<GxEPD2_154_T8, GxEPD2_154_T8::HEIGHT> display(GxEPD2_154_T8(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0154T8 152x152
  100. //GxEPD2_BW<GxEPD2_154_M09, GxEPD2_154_M09::HEIGHT> display(GxEPD2_154_M09(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0154M09 200x200
  101. //GxEPD2_BW<GxEPD2_154_M10, GxEPD2_154_M10::HEIGHT> display(GxEPD2_154_M10(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0154M10 152x152
  102. //GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display(GxEPD2_213(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDE0213B1, phased out
  103. //GxEPD2_BW<GxEPD2_213_B72, GxEPD2_213_B72::HEIGHT> display(GxEPD2_213_B72(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEH0213B72
  104. //GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEH0213B73
  105. //GxEPD2_BW<GxEPD2_213_flex, GxEPD2_213_flex::HEIGHT> display(GxEPD2_213_flex(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0213I5F
  106. //GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  107. //GxEPD2_BW<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW029T5
  108. //GxEPD2_BW<GxEPD2_260, GxEPD2_260::HEIGHT> display(GxEPD2_260(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  109. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  110. //GxEPD2_BW<GxEPD2_371, GxEPD2_371::HEIGHT> display(GxEPD2_371(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  111. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  112. // can use only half buffer size
  113. //GxEPD2_BW < GxEPD2_583, GxEPD2_583::HEIGHT / 2 > display(GxEPD2_583(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  114. //GxEPD2_BW < GxEPD2_583_T8, GxEPD2_583_T8::HEIGHT / 2 > display(GxEPD2_583_T8(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  115. //GxEPD2_BW < GxEPD2_750, GxEPD2_750::HEIGHT / 2 > display(GxEPD2_750(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  116. //GxEPD2_BW < GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT / 2 > display(GxEPD2_750_T7(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW075T7 800x480
  117. // 3-color e-papers
  118. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW0154Z04 no longer available
  119. //GxEPD2_3C<GxEPD2_154_Z90c, GxEPD2_154_Z90c::HEIGHT> display(GxEPD2_154_Z90c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEH0154Z90
  120. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  121. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  122. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  123. // can use only half buffer size
  124. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT / 2> display(GxEPD2_420c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  125. // can use only quarter buffer size
  126. //GxEPD2_3C<GxEPD2_583c, GxEPD2_583c::HEIGHT / 4> display(GxEPD2_583c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  127. //GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT / 4> display(GxEPD2_750c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5));
  128. //GxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT / 4> display(GxEPD2_750c_Z08(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEW075Z08 800x480
  129. //GxEPD2_3C<GxEPD2_750c_Z90, GxEPD2_750c_Z90::HEIGHT / 4> display(GxEPD2_750c_Z90(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // GDEH075Z90 880x528
  130. // 7-color e-paper
  131. //GxEPD2_7C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 4 > display(GxEPD2_565c(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=2*/ 2, /*BUSY=5*/ 5)); // Waveshare 5.65" 7-color
  132. #endif
  133. #if defined(ESP32)
  134. // select one and adapt to your mapping, can use full buffer size (full HEIGHT)
  135. //GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEP015OC1 no longer available
  136. //GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display(GxEPD2_154_D67(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0154D67
  137. //GxEPD2_BW<GxEPD2_154_T8, GxEPD2_154_T8::HEIGHT> display(GxEPD2_154_T8(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0154T8 152x152
  138. //GxEPD2_BW<GxEPD2_154_M09, GxEPD2_154_M09::HEIGHT> display(GxEPD2_154_M09(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0154M09 200x200
  139. //GxEPD2_BW<GxEPD2_154_M10, GxEPD2_154_M10::HEIGHT> display(GxEPD2_154_M10(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0154M10 152x152
  140. //GxEPD2_BW<GxEPD2_213, GxEPD2_213::HEIGHT> display(GxEPD2_213(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDE0213B1, phased out
  141. //GxEPD2_BW<GxEPD2_213_B72, GxEPD2_213_B72::HEIGHT> display(GxEPD2_213_B72(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213B72
  142. //GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213B73
  143. //GxEPD2_BW<GxEPD2_213_flex, GxEPD2_213_flex::HEIGHT> display(GxEPD2_213_flex(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0213I5F
  144. //GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  145. //GxEPD2_BW<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW029T5
  146. //GxEPD2_BW<GxEPD2_260, GxEPD2_260::HEIGHT> display(GxEPD2_260(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  147. //GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  148. //GxEPD2_BW<GxEPD2_371, GxEPD2_371::HEIGHT> display(GxEPD2_371(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  149. //GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  150. //GxEPD2_BW<GxEPD2_583, GxEPD2_583::HEIGHT> display(GxEPD2_583(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  151. //GxEPD2_BW<GxEPD2_583_T8, GxEPD2_583_T8::HEIGHT> display(GxEPD2_583_T8(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  152. //GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display(GxEPD2_750(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  153. //GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075T7 800x480
  154. // 3-color e-papers
  155. //GxEPD2_3C<GxEPD2_154c, GxEPD2_154c::HEIGHT> display(GxEPD2_154c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW0154Z04 no longer available
  156. //GxEPD2_3C<GxEPD2_154_Z90c, GxEPD2_154_Z90c::HEIGHT> display(GxEPD2_154_Z90c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0154Z90
  157. //GxEPD2_3C<GxEPD2_213c, GxEPD2_213c::HEIGHT> display(GxEPD2_213c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  158. //GxEPD2_3C<GxEPD2_290c, GxEPD2_290c::HEIGHT> display(GxEPD2_290c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  159. //GxEPD2_3C<GxEPD2_270c, GxEPD2_270c::HEIGHT> display(GxEPD2_270c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  160. //GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT> display(GxEPD2_420c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  161. //GxEPD2_3C<GxEPD2_583c, GxEPD2_583c::HEIGHT> display(GxEPD2_583c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  162. //GxEPD2_3C<GxEPD2_750c, GxEPD2_750c::HEIGHT> display(GxEPD2_750c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  163. //GxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT> display(GxEPD2_750c_Z08(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075Z08 800x480
  164. //GxEPD2_3C<GxEPD2_750c_Z90, GxEPD2_750c_Z90::HEIGHT / 2> display(GxEPD2_750c_Z90(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH075Z90 880x528
  165. // 7-color e-paper
  166. //GxEPD2_3C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 2 > display(GxEPD2_565c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // Waveshare 5.65" 7-color (3C graphics)
  167. //GxEPD2_7C < GxEPD2_565c, GxEPD2_565c::HEIGHT / 2 > display(GxEPD2_565c(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // Waveshare 5.65" 7-color
  168. // grey levels parallel IF e-papers on Waveshare e-Paper IT8951 Driver HAT
  169. // HRDY -> 4, RST -> 16, CS -> SS(5), SCK -> SCK(18), MOSI -> MOSI(23), MISO -> MISO(19), GND -> GND, 5V -> 5V
  170. // note: 5V supply needs to be exact and strong; 5V over diode from USB (e.g. Wemos D1 mini) doesn't work!
  171. //GxEPD2_BW<GxEPD2_it60, GxEPD2_it60::HEIGHT> display(GxEPD2_it60(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  172. //GxEPD2_BW < GxEPD2_it60_1448x1072, GxEPD2_it60_1448x1072::HEIGHT / 4 > display(GxEPD2_it60_1448x1072(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
  173. // Waveshare 12.48 b/w SPI display board and frame or Good Display 12.48 b/w panel GDEW1248T3
  174. // general constructor for use with all parameters, e.g. for Waveshare ESP32 driver board mounted on connection board
  175. //GxEPD2_BW < GxEPD2_1248, GxEPD2_1248::HEIGHT / 4 >
  176. //display(GxEPD2_1248(/*sck=*/ 13, /*miso=*/ 12, /*mosi=*/ 14, /*cs_m1=*/ 23, /*cs_s1=*/ 22, /*cs_m2=*/ 16, /*cs_s2=*/ 19,
  177. // /*dc1=*/ 25, /*dc2=*/ 17, /*rst1=*/ 33, /*rst2=*/ 5, /*busy_m1=*/ 32, /*busy_s1=*/ 26, /*busy_m2=*/ 18, /*busy_s2=*/ 4));
  178. #endif
  179. // can't use package "STMF1 Boards (STM32Duino.com)" (Roger Clark) anymore with Adafruit_GFX, use "STM32 Boards (selected from submenu)" (STMicroelectronics)
  180. #if defined(ARDUINO_ARCH_STM32)
  181. #define MAX_DISPLAY_BUFFER_SIZE 15000ul // ~15k is a good compromise
  182. #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))
  183. // select one and adapt to your mapping
  184. //GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEP015OC1 no longer available
  185. //GxEPD2_BW<GxEPD2_154_D67, MAX_HEIGHT(GxEPD2_154_D67)> display(GxEPD2_154_D67(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0154D67
  186. //GxEPD2_BW<GxEPD2_154_T8, MAX_HEIGHT(GxEPD2_154_T8)> display(GxEPD2_154_T8(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154T8 152x152
  187. //GxEPD2_BW<GxEPD2_154_M09, MAX_HEIGHT(GxEPD2_154_M09)> display(GxEPD2_154_M09(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154M09 200x200
  188. //GxEPD2_BW<GxEPD2_154_M10, MAX_HEIGHT(GxEPD2_154_M10)> display(GxEPD2_154_M10(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154M10 152x152
  189. //GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDE0213B1, phased out
  190. //GxEPD2_BW<GxEPD2_213_B72, MAX_HEIGHT(GxEPD2_213_B72)> display(GxEPD2_213_B72(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B72
  191. //GxEPD2_BW<GxEPD2_213_B73, MAX_HEIGHT(GxEPD2_213_B73)> display(GxEPD2_213_B73(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0213B73
  192. //GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0213I5F
  193. //GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  194. //GxEPD2_BW<GxEPD2_290_T5, MAX_HEIGHT(GxEPD2_290_T5)> display(GxEPD2_290_T5(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW029T5
  195. //GxEPD2_BW<GxEPD2_260, MAX_HEIGHT(GxEPD2_260)> display(GxEPD2_260(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  196. //GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  197. //GxEPD2_BW<GxEPD2_371, MAX_HEIGHT(GxEPD2_371)> display(GxEPD2_371(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  198. //GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  199. //GxEPD2_BW<GxEPD2_583, MAX_HEIGHT(GxEPD2_583)> display(GxEPD2_583(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  200. //GxEPD2_BW <GxEPD2_583_T8, MAX_HEIGHT(GxEPD2_583_T8)> display(GxEPD2_583_T8(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  201. //GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  202. //GxEPD2_BW<GxEPD2_750_T7, MAX_HEIGHT(GxEPD2_750_T7)> display(GxEPD2_750_T7(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075T7 800x480
  203. // 3-color e-papers
  204. #define MAX_HEIGHT_3C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8))
  205. //GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT_3C(GxEPD2_154c)> display(GxEPD2_154c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW0154Z04 no longer available
  206. //GxEPD2_3C<GxEPD2_154_Z90c, MAX_HEIGHT_3C(GxEPD2_154_Z90c)> display(GxEPD2_154_Z90c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH0154Z90
  207. //GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  208. //GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  209. //GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT_3C(GxEPD2_270c)> display(GxEPD2_270c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  210. //GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT_3C(GxEPD2_420c)> display(GxEPD2_420c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  211. //GxEPD2_3C<GxEPD2_583c, MAX_HEIGHT_3C(GxEPD2_583c)> display(GxEPD2_583c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  212. //GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1));
  213. //GxEPD2_3C<GxEPD2_750c_Z08, MAX_HEIGHT_3C(GxEPD2_750c_Z08)> display(GxEPD2_750c_Z08(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEW075Z08 800x480
  214. //GxEPD2_3C<GxEPD2_750c_Z90, MAX_HEIGHT_3C(GxEPD2_750c_Z90)> display(GxEPD2_750c_Z90(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // GDEH075Z90 880x528
  215. // 7-color e-paper
  216. #define MAX_HEIGHT_7C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) // 2 pixel per byte
  217. //GxEPD2_7C<GxEPD2_565c, MAX_HEIGHT_7C(GxEPD2_565c)> display(GxEPD2_565c(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2, /*BUSY=*/ 1)); // Waveshare 5.65" 7-color
  218. #endif
  219. #if defined(__AVR)
  220. #if defined (ARDUINO_AVR_MEGA2560)
  221. #define MAX_DISPLAY_BUFFER_SIZE 5000 // e.g. full height for 200x200
  222. #else
  223. #define MAX_DISPLAY_BUFFER_SIZE 800 //
  224. #endif
  225. #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))
  226. // select one and adapt to your mapping
  227. //GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEP015OC1 no longer available
  228. //GxEPD2_BW<GxEPD2_154_D67, MAX_HEIGHT(GxEPD2_154_D67)> display(GxEPD2_154_D67(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEH0154D67
  229. //GxEPD2_BW<GxEPD2_154_T8, MAX_HEIGHT(GxEPD2_154_T8)> display(GxEPD2_154_T8(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW0154T8 152x152
  230. //GxEPD2_BW<GxEPD2_154_M09, MAX_HEIGHT(GxEPD2_154_M09)> display(GxEPD2_154_M09(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW0154M09 200x200
  231. //GxEPD2_BW<GxEPD2_154_M10, MAX_HEIGHT(GxEPD2_154_M10)> display(GxEPD2_154_M10(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW0154M10 152x152
  232. //GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDE0213B1, phased out
  233. //GxEPD2_BW<GxEPD2_213_B72, MAX_HEIGHT(GxEPD2_213_B72)> display(GxEPD2_213_B72(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEH0213B72
  234. //GxEPD2_BW<GxEPD2_213_B73, MAX_HEIGHT(GxEPD2_213_B73)> display(GxEPD2_213_B73(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEH0213B73
  235. //GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW0213I5F
  236. //GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  237. //GxEPD2_BW<GxEPD2_290_T5, MAX_HEIGHT(GxEPD2_290_T5)> display(GxEPD2_290_T5(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW029T5
  238. //GxEPD2_BW<GxEPD2_260, MAX_HEIGHT(GxEPD2_260)> display(GxEPD2_260(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  239. //GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  240. //GxEPD2_BW<GxEPD2_371, MAX_HEIGHT(GxEPD2_371)> display(GxEPD2_371(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  241. //GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  242. //GxEPD2_BW<GxEPD2_583, MAX_HEIGHT(GxEPD2_583)> display(GxEPD2_583(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  243. //GxEPD2_BW <GxEPD2_583_T8, MAX_HEIGHT(GxEPD2_583_T8)> display(GxEPD2_583_T8(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  244. //GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  245. //GxEPD2_BW<GxEPD2_750_T7, MAX_HEIGHT(GxEPD2_750_T7)> display(GxEPD2_750_T7(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW075T7 800x480
  246. // 3-color e-papers
  247. #define MAX_HEIGHT_3C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8))
  248. //GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT_3C(GxEPD2_154c)> display(GxEPD2_154c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW0154Z04 no longer available
  249. //GxEPD2_3C<GxEPD2_154_Z90c, MAX_HEIGHT_3C(GxEPD2_154_Z90c)> display(GxEPD2_154_Z90c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEH0154Z90
  250. //GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  251. //GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  252. //GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT_3C(GxEPD2_270c)> display(GxEPD2_270c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  253. //GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT_3C(GxEPD2_420c)> display(GxEPD2_420c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  254. //GxEPD2_3C<GxEPD2_583c, MAX_HEIGHT_3C(GxEPD2_583c)> display(GxEPD2_583c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  255. //GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
  256. //GxEPD2_3C<GxEPD2_750c_Z08, MAX_HEIGHT_3C(GxEPD2_750c_Z08)> display(GxEPD2_750c_Z08(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEW075Z08 800x480
  257. //GxEPD2_3C<GxEPD2_750c_Z90, MAX_HEIGHT_3C(GxEPD2_750c_Z90)> display(GxEPD2_750c_Z90(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEH075Z90 880x528
  258. // 7-color e-paper
  259. #define MAX_HEIGHT_7C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2)) // 2 pixel per byte
  260. //GxEPD2_7C<GxEPD2_565c, MAX_HEIGHT_7C(GxEPD2_565c)> display(GxEPD2_565c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // Waveshare 5.65" 7-color
  261. // ***** for mapping of Waveshare Universal e-Paper Raw Panel Driver Shield for Arduino / NUCLEO *****
  262. // the RST line is not connected through level converter, but has a pull up resistor and a pull down diode to the Arduino pin; this is safe for 5V Arduino
  263. // NOTE: the 11-pinholes for pin connectors are not through level converter, and the VCC pin is ~4.2V, only FCP connector pins are through level converter
  264. // NOTE: the VCC pin on the 11-pinholes for pin connectors shouldn't be used, it seems to get back-fed from Arduino data pins through protection diodes of the level converter
  265. // NOTE: the VCC pin should be fed from Arduino 5V pin for use on any 5V Arduino (did they forget to add this connection or add a jumper?)
  266. // select one and adapt to your mapping
  267. //GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEP015OC1 no longer available
  268. //GxEPD2_BW<GxEPD2_154_D67, MAX_HEIGHT(GxEPD2_154_D67)> display(GxEPD2_154_D67(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEH0154D67
  269. //GxEPD2_BW<GxEPD2_154_T8, MAX_HEIGHT(GxEPD2_154_T8)> display(GxEPD2_154_T8(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW0154T8 152x152
  270. //GxEPD2_BW<GxEPD2_154_M09, MAX_HEIGHT(GxEPD2_154_M09)> display(GxEPD2_154_M09(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW0154M09 200x200
  271. //GxEPD2_BW<GxEPD2_154_M10, MAX_HEIGHT(GxEPD2_154_M10)> display(GxEPD2_154_M10(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW0154M10 152x152
  272. //GxEPD2_BW<GxEPD2_213, MAX_HEIGHT(GxEPD2_213)> display(GxEPD2_213(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDE0213B1, phased out
  273. //GxEPD2_BW<GxEPD2_213_B72, MAX_HEIGHT(GxEPD2_213_B72)> display(GxEPD2_213_B72(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEH0213B72
  274. //GxEPD2_BW<GxEPD2_213_B73, MAX_HEIGHT(GxEPD2_213_B73)> display(GxEPD2_213_B73(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEH0213B73
  275. //GxEPD2_BW<GxEPD2_213_flex, MAX_HEIGHT(GxEPD2_213_flex)> display(GxEPD2_213_flex(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW0213I5F
  276. //GxEPD2_BW<GxEPD2_290, MAX_HEIGHT(GxEPD2_290)> display(GxEPD2_290(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  277. //GxEPD2_BW<GxEPD2_290_T5, MAX_HEIGHT(GxEPD2_290_T5)> display(GxEPD2_290_T5(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW029T5
  278. //GxEPD2_BW<GxEPD2_260, MAX_HEIGHT(GxEPD2_260)> display(GxEPD2_260(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  279. //GxEPD2_BW<GxEPD2_270, MAX_HEIGHT(GxEPD2_270)> display(GxEPD2_270(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  280. //GxEPD2_BW<GxEPD2_371, MAX_HEIGHT(GxEPD2_371)> display(GxEPD2_371(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  281. //GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  282. //GxEPD2_BW<GxEPD2_583, MAX_HEIGHT(GxEPD2_583)> display(GxEPD2_583(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  283. //GxEPD2_BW <GxEPD2_583_T8, MAX_HEIGHT(GxEPD2_583_T8)> display(GxEPD2_583_T8(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  284. //GxEPD2_BW<GxEPD2_750, MAX_HEIGHT(GxEPD2_750)> display(GxEPD2_750(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  285. //GxEPD2_BW<GxEPD2_750_T7, MAX_HEIGHT(GxEPD2_750_T7)> display(GxEPD2_750_T7(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW075T7 800x480
  286. // 3-color e-papers
  287. #define MAX_HEIGHT_3C(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8))
  288. //GxEPD2_3C<GxEPD2_154c, MAX_HEIGHT_3C(GxEPD2_154c)> display(GxEPD2_154c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW0154Z04 no longer available
  289. //GxEPD2_3C<GxEPD2_154_Z90c, MAX_HEIGHT_3C(GxEPD2_154_Z90c)> display(GxEPD2_154_Z90c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEH0154Z90
  290. //GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  291. //GxEPD2_3C<GxEPD2_290c, MAX_HEIGHT_3C(GxEPD2_290c)> display(GxEPD2_290c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  292. //GxEPD2_3C<GxEPD2_270c, MAX_HEIGHT_3C(GxEPD2_270c)> display(GxEPD2_270c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  293. //GxEPD2_3C<GxEPD2_420c, MAX_HEIGHT_3C(GxEPD2_420c)> display(GxEPD2_420c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  294. //GxEPD2_3C<GxEPD2_583c, MAX_HEIGHT_3C(GxEPD2_583c)> display(GxEPD2_583c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  295. //GxEPD2_3C<GxEPD2_750c, MAX_HEIGHT_3C(GxEPD2_750c)> display(GxEPD2_750c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7));
  296. //GxEPD2_3C<GxEPD2_750c_Z08, MAX_HEIGHT_3C(GxEPD2_750c_Z08)> display(GxEPD2_750c_Z08(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW075Z08 800x480
  297. //GxEPD2_3C<GxEPD2_750c_Z90, MAX_HEIGHT_3C(GxEPD2_750c_Z90)> display(GxEPD2_750c_Z90(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); //GDEH075Z90 880x528
  298. // 7-color e-paper
  299. //GxEPD2_7C<GxEPD2_565c, MAX_HEIGHT_7C(GxEPD2_565c)> display(GxEPD2_565c(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // Waveshare 5.65" 7-color
  300. // Waveshare 12.48 b/w SPI display board and frame or Good Display 12.48 b/w panel GDEW1248T3
  301. // general constructor for use with standard SPI pins, default SCK, MISO and MOSI, for UNO on UNO connectors
  302. //GxEPD2_BW < GxEPD2_1248, MAX_HEIGHT(GxEPD2_1248)>
  303. //display(GxEPD2_1248(/*cs_m1=*/ 2, /*cs_s1=*/ 3, /*cs_m2=*/ A4, /*cs_s2=*/ A0, /*dc1=*/ 6, /*dc2=*/ A3, /*rst1=*/ 5, /*rst2=*/ A2,
  304. // /*busy_m1=*/ 4, /*busy_s1=*/ 7, /*busy_m2=*/ A1, /*busy_s2=*/ A5));
  305. #endif
  306. #include "GxEPD2_boards_added.h"
  307. //#include "GxEPD2_more_boards_added.h" // private
  308. #if !defined(__AVR) && !defined(_BOARD_GENERIC_STM32F103C_H_)
  309. // note 16.11.2019: the compiler may exclude code based on constant if statements (display.epd2.panel == constant),
  310. // therefore bitmaps may get optimized out by the linker
  311. // comment out unused bitmaps to reduce code space used
  312. #include "bitmaps/Bitmaps152x152.h" // 1.54" b/w
  313. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  314. #include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  315. #include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  316. #include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  317. #include "bitmaps/Bitmaps152x296.h" // 2.6" b/w
  318. #include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  319. #include "bitmaps/Bitmaps240x416.h" // 3.71" b/w
  320. #include "bitmaps/Bitmaps400x300.h" // 4.2" b/w
  321. #include "bitmaps/Bitmaps648x480.h" // 5.38" b/w
  322. #include "bitmaps/Bitmaps640x384.h" // 7.5" b/w
  323. #include "bitmaps/Bitmaps800x480.h" // 7.5" b/w
  324. // 3-color
  325. #include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  326. #include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  327. #include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  328. #include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  329. #include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r
  330. #if defined(ESP8266) || defined(ESP32)
  331. #include "bitmaps/Bitmaps3c800x480.h" // 7.5" b/w/r
  332. #include "bitmaps/Bitmaps3c880x528.h" // 7.5" b/w/r
  333. #include "bitmaps/WS_Bitmaps800x600.h" // 6.0" grey
  334. #include "bitmaps/WS_Bitmaps7c192x143.h" // 5.65" 7-color
  335. #endif
  336. #if defined(ESP32)
  337. #include "bitmaps/Bitmaps1304x984.h" // 12.48" b/w
  338. #endif
  339. #else
  340. // select only one to fit in code space
  341. #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
  342. //#include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
  343. //#include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
  344. //#include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
  345. //#include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
  346. ////#include "bitmaps/Bitmaps400x300.h" // 4.2" b/w // not enough code space
  347. ////#include "bitmaps/Bitmaps640x384.h" // 7.5" b/w // not enough code space
  348. // 3-color
  349. //#include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
  350. //#include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
  351. //#include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
  352. //#include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
  353. ////#include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r // not enough code space
  354. #endif
  355. void setup()
  356. {
  357. Serial.begin(115200);
  358. Serial.println();
  359. Serial.println("setup");
  360. delay(100);
  361. display.init(115200);
  362. // first update should be full refresh
  363. helloWorld();
  364. delay(1000);
  365. // partial refresh mode can be used to full screen,
  366. // effective if display panel hasFastPartialUpdate
  367. helloFullScreenPartialMode();
  368. delay(1000);
  369. helloArduino();
  370. delay(1000);
  371. helloEpaper();
  372. delay(1000);
  373. //helloValue(123.9, 1);
  374. //delay(1000);
  375. showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  376. delay(1000);
  377. drawBitmaps();
  378. #if !defined(__AVR) // takes too long!
  379. if (display.epd2.panel == GxEPD2::ACeP565)
  380. {
  381. //draw7colorlines();
  382. //delay(2000);
  383. draw7colors();
  384. delay(4000);
  385. }
  386. #endif
  387. if (display.epd2.hasPartialUpdate)
  388. {
  389. showPartialUpdate();
  390. delay(1000);
  391. } // else // on GDEW0154Z04 only full update available, doesn't look nice
  392. //drawCornerTest();
  393. //showBox(16, 16, 48, 32, false);
  394. //showBox(16, 56, 48, 32, true);
  395. display.powerOff();
  396. deepSleepTest();
  397. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  398. drawBitmaps1304x984();
  399. display.powerOff();
  400. #endif
  401. Serial.println("setup done");
  402. }
  403. void loop()
  404. {
  405. }
  406. // note for partial update window and setPartialWindow() method:
  407. // partial update window size and position is on byte boundary in physical x direction
  408. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  409. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  410. const char HelloWorld[] = "Hello World!";
  411. const char HelloArduino[] = "Hello Arduino!";
  412. const char HelloEpaper[] = "Hello E-Paper!";
  413. void helloWorld()
  414. {
  415. //Serial.println("helloWorld");
  416. display.setRotation(1);
  417. display.setFont(&FreeMonoBold9pt7b);
  418. display.setTextColor(GxEPD_BLACK);
  419. int16_t tbx, tby; uint16_t tbw, tbh;
  420. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  421. // center bounding box by transposition of origin:
  422. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  423. uint16_t y = ((display.height() - tbh) / 2) - tby;
  424. display.setFullWindow();
  425. display.firstPage();
  426. do
  427. {
  428. display.fillScreen(GxEPD_WHITE);
  429. display.setCursor(x, y);
  430. display.print(HelloWorld);
  431. }
  432. while (display.nextPage());
  433. //Serial.println("helloWorld done");
  434. }
  435. void helloWorldForDummies()
  436. {
  437. //Serial.println("helloWorld");
  438. const char text[] = "Hello World!";
  439. // most e-papers have width < height (portrait) as native orientation, especially the small ones
  440. // in GxEPD2 rotation 0 is used for native orientation (most TFT libraries use 0 fix for portrait orientation)
  441. // set rotation to 1 (rotate right 90 degrees) to have enough space on small displays (landscape)
  442. display.setRotation(1);
  443. // select a suitable font in Adafruit_GFX
  444. display.setFont(&FreeMonoBold9pt7b);
  445. // on e-papers black on white is more pleasant to read
  446. display.setTextColor(GxEPD_BLACK);
  447. // Adafruit_GFX has a handy method getTextBounds() to determine the boundary box for a text for the actual font
  448. int16_t tbx, tby; uint16_t tbw, tbh; // boundary box window
  449. display.getTextBounds(text, 0, 0, &tbx, &tby, &tbw, &tbh); // it works for origin 0, 0, fortunately (negative tby!)
  450. // center bounding box by transposition of origin:
  451. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  452. uint16_t y = ((display.height() - tbh) / 2) - tby;
  453. // full window mode is the initial mode, set it anyway
  454. display.setFullWindow();
  455. // here we use paged drawing, even if the processor has enough RAM for full buffer
  456. // so this can be used with any supported processor board.
  457. // the cost in code overhead and execution time penalty is marginal
  458. // tell the graphics class to use paged drawing mode
  459. display.firstPage();
  460. do
  461. {
  462. // this part of code is executed multiple times, as many as needed,
  463. // in case of full buffer it is executed once
  464. // IMPORTANT: each iteration needs to draw the same, to avoid strange effects
  465. // use a copy of values that might change, don't read e.g. from analog or pins in the loop!
  466. display.fillScreen(GxEPD_WHITE); // set the background to white (fill the buffer with value for white)
  467. display.setCursor(x, y); // set the postition to start printing text
  468. display.print(text); // print some text
  469. // end of part executed multiple times
  470. }
  471. // tell the graphics class to transfer the buffer content (page) to the controller buffer
  472. // the graphics class will command the controller to refresh to the screen when the last page has been transferred
  473. // returns true if more pages need be drawn and transferred
  474. // returns false if the last page has been transferred and the screen refreshed for panels without fast partial update
  475. // returns false for panels with fast partial update when the controller buffer has been written once more, to make the differential buffers equal
  476. // (for full buffered with fast partial update the (full) buffer is just transferred again, and false returned)
  477. while (display.nextPage());
  478. //Serial.println("helloWorld done");
  479. }
  480. void helloFullScreenPartialMode()
  481. {
  482. //Serial.println("helloFullScreenPartialMode");
  483. const char fullscreen[] = "full screen update";
  484. const char fpm[] = "fast partial mode";
  485. const char spm[] = "slow partial mode";
  486. const char npm[] = "no partial mode";
  487. display.setPartialWindow(0, 0, display.width(), display.height());
  488. display.setRotation(1);
  489. display.setFont(&FreeMonoBold9pt7b);
  490. display.setTextColor(GxEPD_BLACK);
  491. const char* updatemode;
  492. if (display.epd2.hasFastPartialUpdate)
  493. {
  494. updatemode = fpm;
  495. }
  496. else if (display.epd2.hasPartialUpdate)
  497. {
  498. updatemode = spm;
  499. }
  500. else
  501. {
  502. updatemode = npm;
  503. }
  504. // do this outside of the loop
  505. int16_t tbx, tby; uint16_t tbw, tbh;
  506. // center update text
  507. display.getTextBounds(fullscreen, 0, 0, &tbx, &tby, &tbw, &tbh);
  508. uint16_t utx = ((display.width() - tbw) / 2) - tbx;
  509. uint16_t uty = ((display.height() / 4) - tbh / 2) - tby;
  510. // center update mode
  511. display.getTextBounds(updatemode, 0, 0, &tbx, &tby, &tbw, &tbh);
  512. uint16_t umx = ((display.width() - tbw) / 2) - tbx;
  513. uint16_t umy = ((display.height() * 3 / 4) - tbh / 2) - tby;
  514. // center HelloWorld
  515. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  516. uint16_t hwx = ((display.width() - tbw) / 2) - tbx;
  517. uint16_t hwy = ((display.height() - tbh) / 2) - tby;
  518. display.firstPage();
  519. do
  520. {
  521. display.fillScreen(GxEPD_WHITE);
  522. display.setCursor(hwx, hwy);
  523. display.print(HelloWorld);
  524. display.setCursor(utx, uty);
  525. display.print(fullscreen);
  526. display.setCursor(umx, umy);
  527. display.print(updatemode);
  528. }
  529. while (display.nextPage());
  530. //Serial.println("helloFullScreenPartialMode done");
  531. }
  532. void helloArduino()
  533. {
  534. //Serial.println("helloArduino");
  535. display.setRotation(1);
  536. display.setFont(&FreeMonoBold9pt7b);
  537. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  538. int16_t tbx, tby; uint16_t tbw, tbh;
  539. // align with centered HelloWorld
  540. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  541. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  542. // height might be different
  543. display.getTextBounds(HelloArduino, 0, 0, &tbx, &tby, &tbw, &tbh);
  544. uint16_t y = ((display.height() / 4) - tbh / 2) - tby; // y is base line!
  545. // make the window big enough to cover (overwrite) descenders of previous text
  546. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  547. uint16_t wy = (display.height() / 4) - wh / 2;
  548. display.setPartialWindow(0, wy, display.width(), wh);
  549. display.firstPage();
  550. do
  551. {
  552. display.fillScreen(GxEPD_WHITE);
  553. //display.drawRect(x, y - tbh, tbw, tbh, GxEPD_BLACK);
  554. display.setCursor(x, y);
  555. display.print(HelloArduino);
  556. }
  557. while (display.nextPage());
  558. delay(1000);
  559. //Serial.println("helloArduino done");
  560. }
  561. void helloEpaper()
  562. {
  563. //Serial.println("helloEpaper");
  564. display.setRotation(1);
  565. display.setFont(&FreeMonoBold9pt7b);
  566. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  567. int16_t tbx, tby; uint16_t tbw, tbh;
  568. // align with centered HelloWorld
  569. display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
  570. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  571. // height might be different
  572. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  573. uint16_t y = (display.height() * 3 / 4) + tbh / 2; // y is base line!
  574. // make the window big enough to cover (overwrite) descenders of previous text
  575. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  576. uint16_t wy = (display.height() * 3 / 4) - wh / 2;
  577. display.setPartialWindow(0, wy, display.width(), wh);
  578. display.firstPage();
  579. do
  580. {
  581. display.fillScreen(GxEPD_WHITE);
  582. display.setCursor(x, y);
  583. display.print(HelloEpaper);
  584. }
  585. while (display.nextPage());
  586. //Serial.println("helloEpaper done");
  587. }
  588. #if defined(ESP8266) || defined(ESP32)
  589. #include <StreamString.h>
  590. #define PrintString StreamString
  591. #else
  592. class PrintString : public Print, public String
  593. {
  594. public:
  595. size_t write(uint8_t data) override
  596. {
  597. return concat(char(data));
  598. };
  599. };
  600. #endif
  601. void helloValue(double v, int digits)
  602. {
  603. //Serial.println("helloValue");
  604. display.setRotation(1);
  605. display.setFont(&FreeMonoBold9pt7b);
  606. display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
  607. PrintString valueString;
  608. valueString.print(v, digits);
  609. int16_t tbx, tby; uint16_t tbw, tbh;
  610. display.getTextBounds(valueString, 0, 0, &tbx, &tby, &tbw, &tbh);
  611. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  612. uint16_t y = (display.height() * 3 / 4) + tbh / 2; // y is base line!
  613. // show what happens, if we use the bounding box for partial window
  614. uint16_t wx = (display.width() - tbw) / 2;
  615. uint16_t wy = (display.height() * 3 / 4) - tbh / 2;
  616. display.setPartialWindow(wx, wy, tbw, tbh);
  617. display.firstPage();
  618. do
  619. {
  620. display.fillScreen(GxEPD_WHITE);
  621. display.setCursor(x, y);
  622. display.print(valueString);
  623. }
  624. while (display.nextPage());
  625. delay(2000);
  626. // make the partial window big enough to cover the previous text
  627. uint16_t ww = tbw; // remember window width
  628. display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
  629. // adjust, because HelloEpaper was aligned, not centered (could calculate this to be precise)
  630. ww = max(ww, uint16_t(tbw + 12)); // 12 seems ok
  631. wx = (display.width() - tbw) / 2;
  632. // make the window big enough to cover (overwrite) descenders of previous text
  633. uint16_t wh = FreeMonoBold9pt7b.yAdvance;
  634. wy = (display.height() * 3 / 4) - wh / 2;
  635. display.setPartialWindow(wx, wy, ww, wh);
  636. // alternately use the whole width for partial window
  637. //display.setPartialWindow(0, wy, display.width(), wh);
  638. display.firstPage();
  639. do
  640. {
  641. display.fillScreen(GxEPD_WHITE);
  642. display.setCursor(x, y);
  643. display.print(valueString);
  644. }
  645. while (display.nextPage());
  646. //Serial.println("helloValue done");
  647. }
  648. void deepSleepTest()
  649. {
  650. //Serial.println("deepSleepTest");
  651. const char hibernating[] = "hibernating ...";
  652. const char wokeup[] = "woke up";
  653. const char from[] = "from deep sleep";
  654. const char again[] = "again";
  655. display.setRotation(1);
  656. display.setFont(&FreeMonoBold9pt7b);
  657. display.setTextColor(GxEPD_BLACK);
  658. int16_t tbx, tby; uint16_t tbw, tbh;
  659. // center text
  660. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  661. uint16_t x = ((display.width() - tbw) / 2) - tbx;
  662. uint16_t y = ((display.height() - tbh) / 2) - tby;
  663. display.setFullWindow();
  664. display.firstPage();
  665. do
  666. {
  667. display.fillScreen(GxEPD_WHITE);
  668. display.setCursor(x, y);
  669. display.print(hibernating);
  670. }
  671. while (display.nextPage());
  672. display.hibernate();
  673. delay(5000);
  674. display.getTextBounds(wokeup, 0, 0, &tbx, &tby, &tbw, &tbh);
  675. uint16_t wx = (display.width() - tbw) / 2;
  676. uint16_t wy = (display.height() / 3) + tbh / 2; // y is base line!
  677. display.getTextBounds(from, 0, 0, &tbx, &tby, &tbw, &tbh);
  678. uint16_t fx = (display.width() - tbw) / 2;
  679. uint16_t fy = (display.height() * 2 / 3) + tbh / 2; // y is base line!
  680. display.firstPage();
  681. do
  682. {
  683. display.fillScreen(GxEPD_WHITE);
  684. display.setCursor(wx, wy);
  685. display.print(wokeup);
  686. display.setCursor(fx, fy);
  687. display.print(from);
  688. }
  689. while (display.nextPage());
  690. delay(5000);
  691. display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
  692. uint16_t hx = (display.width() - tbw) / 2;
  693. uint16_t hy = (display.height() / 3) + tbh / 2; // y is base line!
  694. display.getTextBounds(again, 0, 0, &tbx, &tby, &tbw, &tbh);
  695. uint16_t ax = (display.width() - tbw) / 2;
  696. uint16_t ay = (display.height() * 2 / 3) + tbh / 2; // y is base line!
  697. display.firstPage();
  698. do
  699. {
  700. display.fillScreen(GxEPD_WHITE);
  701. display.setCursor(hx, hy);
  702. display.print(hibernating);
  703. display.setCursor(ax, ay);
  704. display.print(again);
  705. }
  706. while (display.nextPage());
  707. display.hibernate();
  708. //Serial.println("deepSleepTest done");
  709. }
  710. void showBox(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
  711. {
  712. //Serial.println("showBox");
  713. display.setRotation(1);
  714. if (partial)
  715. {
  716. display.setPartialWindow(x, y, w, h);
  717. }
  718. else
  719. {
  720. display.setFullWindow();
  721. }
  722. display.firstPage();
  723. do
  724. {
  725. display.fillScreen(GxEPD_WHITE);
  726. display.fillRect(x, y, w, h, GxEPD_BLACK);
  727. }
  728. while (display.nextPage());
  729. //Serial.println("showBox done");
  730. }
  731. void drawCornerTest()
  732. {
  733. display.setFullWindow();
  734. display.setFont(&FreeMonoBold9pt7b);
  735. display.setTextColor(GxEPD_BLACK);
  736. for (uint16_t r = 0; r <= 4; r++)
  737. {
  738. display.setRotation(r);
  739. display.firstPage();
  740. do
  741. {
  742. display.fillScreen(GxEPD_WHITE);
  743. display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
  744. display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
  745. display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
  746. display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
  747. display.setCursor(display.width() / 2, display.height() / 2);
  748. display.print(display.getRotation());
  749. }
  750. while (display.nextPage());
  751. delay(2000);
  752. }
  753. }
  754. void showFont(const char name[], const GFXfont* f)
  755. {
  756. display.setFullWindow();
  757. display.setRotation(0);
  758. display.setTextColor(GxEPD_BLACK);
  759. display.firstPage();
  760. do
  761. {
  762. drawFont(name, f);
  763. }
  764. while (display.nextPage());
  765. }
  766. void drawFont(const char name[], const GFXfont* f)
  767. {
  768. //display.setRotation(0);
  769. display.fillScreen(GxEPD_WHITE);
  770. display.setTextColor(GxEPD_BLACK);
  771. display.setFont(f);
  772. display.setCursor(0, 0);
  773. display.println();
  774. display.println(name);
  775. display.println(" !\"#$%&'()*+,-./");
  776. display.println("0123456789:;<=>?");
  777. display.println("@ABCDEFGHIJKLMNO");
  778. display.println("PQRSTUVWXYZ[\\]^_");
  779. if (display.epd2.hasColor)
  780. {
  781. display.setTextColor(GxEPD_RED);
  782. }
  783. display.println("`abcdefghijklmno");
  784. display.println("pqrstuvwxyz{|}~ ");
  785. }
  786. // note for partial update window and setPartialWindow() method:
  787. // partial update window size and position is on byte boundary in physical x direction
  788. // the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
  789. // see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
  790. // showPartialUpdate() purposely uses values that are not multiples of 8 to test this
  791. void showPartialUpdate()
  792. {
  793. // some useful background
  794. helloWorld();
  795. // use asymmetric values for test
  796. uint16_t box_x = 10;
  797. uint16_t box_y = 15;
  798. uint16_t box_w = 70;
  799. uint16_t box_h = 20;
  800. uint16_t cursor_y = box_y + box_h - 6;
  801. float value = 13.95;
  802. uint16_t incr = display.epd2.hasFastPartialUpdate ? 1 : 3;
  803. display.setFont(&FreeMonoBold9pt7b);
  804. display.setTextColor(GxEPD_BLACK);
  805. // show where the update box is
  806. for (uint16_t r = 0; r < 4; r++)
  807. {
  808. display.setRotation(r);
  809. display.setPartialWindow(box_x, box_y, box_w, box_h);
  810. display.firstPage();
  811. do
  812. {
  813. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  814. //display.fillScreen(GxEPD_BLACK);
  815. }
  816. while (display.nextPage());
  817. delay(2000);
  818. display.firstPage();
  819. do
  820. {
  821. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  822. }
  823. while (display.nextPage());
  824. delay(1000);
  825. }
  826. //return;
  827. // show updates in the update box
  828. for (uint16_t r = 0; r < 4; r++)
  829. {
  830. display.setRotation(r);
  831. display.setPartialWindow(box_x, box_y, box_w, box_h);
  832. for (uint16_t i = 1; i <= 10; i += incr)
  833. {
  834. display.firstPage();
  835. do
  836. {
  837. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  838. display.setCursor(box_x, cursor_y);
  839. display.print(value * i, 2);
  840. }
  841. while (display.nextPage());
  842. delay(500);
  843. }
  844. delay(1000);
  845. display.firstPage();
  846. do
  847. {
  848. display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  849. }
  850. while (display.nextPage());
  851. delay(1000);
  852. }
  853. }
  854. void drawBitmaps()
  855. {
  856. display.setFullWindow();
  857. #ifdef _GxBitmaps152x152_H_
  858. drawBitmaps152x152();
  859. #endif
  860. #ifdef _GxBitmaps104x212_H_
  861. drawBitmaps104x212();
  862. #endif
  863. #ifdef _GxBitmaps128x250_H_
  864. drawBitmaps128x250();
  865. #endif
  866. #ifdef _GxBitmaps128x296_H_
  867. drawBitmaps128x296();
  868. #endif
  869. #ifdef _GxBitmaps176x264_H_
  870. drawBitmaps176x264();
  871. #endif
  872. #ifdef _GxBitmaps400x300_H_
  873. drawBitmaps400x300();
  874. #endif
  875. #ifdef _GxBitmaps640x384_H_
  876. drawBitmaps640x384();
  877. #endif
  878. #ifdef _GxBitmaps648x480_H_
  879. drawBitmaps648x480();
  880. #endif
  881. #ifdef _GxBitmaps800x480_H_
  882. drawBitmaps800x480();
  883. #endif
  884. #ifdef _WS_Bitmaps800x600_H_
  885. drawBitmaps800x600();
  886. #endif
  887. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  888. drawBitmaps1304x984();
  889. #endif
  890. // 3-color
  891. #ifdef _GxBitmaps3c104x212_H_
  892. drawBitmaps3c104x212();
  893. #endif
  894. #ifdef _GxBitmaps3c128x296_H_
  895. drawBitmaps3c128x296();
  896. #endif
  897. #ifdef _GxBitmaps152x296_H_
  898. drawBitmaps152x296();
  899. #endif
  900. #ifdef _GxBitmaps3c176x264_H_
  901. drawBitmaps3c176x264();
  902. #endif
  903. #ifdef _GxBitmaps240x416_H_
  904. drawBitmaps240x416();
  905. #endif
  906. #ifdef _GxBitmaps3c400x300_H_
  907. drawBitmaps3c400x300();
  908. #endif
  909. #ifdef _GxBitmaps3c800x480_H_
  910. drawBitmaps3c800x480();
  911. #endif
  912. #ifdef _GxBitmaps3c880x528_H_
  913. drawBitmaps3c880x528();
  914. #endif
  915. #if defined(_WS_Bitmaps7c192x143_H_)
  916. drawBitmaps7c192x143();
  917. #endif
  918. if ((display.epd2.WIDTH >= 200) && (display.epd2.HEIGHT >= 200))
  919. {
  920. // show these after the specific bitmaps
  921. #ifdef _GxBitmaps200x200_H_
  922. drawBitmaps200x200();
  923. #endif
  924. // 3-color
  925. #ifdef _GxBitmaps3c200x200_H_
  926. drawBitmaps3c200x200();
  927. #endif
  928. }
  929. }
  930. #ifdef _GxBitmaps152x152_H_
  931. void drawBitmaps152x152()
  932. {
  933. #if !defined(__AVR)
  934. const unsigned char* bitmaps[] =
  935. {
  936. Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
  937. };
  938. #else
  939. const unsigned char* bitmaps[] =
  940. {
  941. Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
  942. };
  943. #endif
  944. if ((display.epd2.WIDTH == 152) && (display.epd2.HEIGHT == 152))
  945. {
  946. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  947. {
  948. display.firstPage();
  949. do
  950. {
  951. display.fillScreen(GxEPD_WHITE);
  952. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  953. }
  954. while (display.nextPage());
  955. delay(2000);
  956. }
  957. }
  958. }
  959. #endif
  960. #ifdef _GxBitmaps200x200_H_
  961. void drawBitmaps200x200()
  962. {
  963. #if defined(ARDUINO_AVR_PRO)
  964. const unsigned char* bitmaps[] =
  965. {
  966. logo200x200
  967. };
  968. #elif defined(__AVR)
  969. const unsigned char* bitmaps[] =
  970. {
  971. logo200x200, //first200x200
  972. };
  973. #elif defined(_BOARD_GENERIC_STM32F103C_H_) || defined(STM32F1xx)
  974. const unsigned char* bitmaps[] =
  975. {
  976. logo200x200, first200x200, second200x200, third200x200, //fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  977. };
  978. #else
  979. const unsigned char* bitmaps[] =
  980. {
  981. logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
  982. };
  983. #endif
  984. if ((display.epd2.WIDTH == 200) && (display.epd2.HEIGHT == 200) && !display.epd2.hasColor)
  985. {
  986. bool m = display.mirror(true);
  987. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  988. {
  989. display.firstPage();
  990. do
  991. {
  992. display.fillScreen(GxEPD_WHITE);
  993. display.drawInvertedBitmap(0, 0, bitmaps[i], 200, 200, GxEPD_BLACK);
  994. }
  995. while (display.nextPage());
  996. delay(2000);
  997. }
  998. display.mirror(m);
  999. }
  1000. //else
  1001. {
  1002. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  1003. display.clearScreen(); // use default for white
  1004. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  1005. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  1006. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1007. {
  1008. display.drawImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1009. delay(2000);
  1010. }
  1011. }
  1012. bool mirror_y = (display.epd2.panel != GxEPD2::GDE0213B1);
  1013. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1014. {
  1015. int16_t x = -60;
  1016. int16_t y = -60;
  1017. for (uint16_t j = 0; j < 10; j++)
  1018. {
  1019. display.writeScreenBuffer(); // use default for white
  1020. display.writeImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1021. display.refresh(true);
  1022. if (display.epd2.hasFastPartialUpdate)
  1023. {
  1024. // for differential update: set previous buffer equal to current buffer in controller
  1025. display.epd2.writeScreenBufferAgain(); // use default for white
  1026. display.epd2.writeImageAgain(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
  1027. }
  1028. delay(2000);
  1029. x += display.epd2.WIDTH / 4;
  1030. y += display.epd2.HEIGHT / 4;
  1031. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  1032. }
  1033. if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
  1034. break; // comment out for full show
  1035. }
  1036. display.writeScreenBuffer(); // use default for white
  1037. display.writeImage(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  1038. display.writeImage(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
  1039. display.refresh(true);
  1040. // for differential update: set previous buffer equal to current buffer in controller
  1041. display.epd2.writeScreenBufferAgain(); // use default for white
  1042. display.epd2.writeImageAgain(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
  1043. 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);
  1044. delay(2000);
  1045. }
  1046. #endif
  1047. #ifdef _GxBitmaps104x212_H_
  1048. void drawBitmaps104x212()
  1049. {
  1050. #if !defined(__AVR)
  1051. const unsigned char* bitmaps[] =
  1052. {
  1053. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  1054. };
  1055. #else
  1056. const unsigned char* bitmaps[] =
  1057. {
  1058. WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
  1059. };
  1060. #endif
  1061. if (display.epd2.panel == GxEPD2::GDEW0213I5F)
  1062. {
  1063. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1064. {
  1065. display.firstPage();
  1066. do
  1067. {
  1068. display.fillScreen(GxEPD_WHITE);
  1069. display.drawBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1070. }
  1071. while (display.nextPage());
  1072. delay(2000);
  1073. }
  1074. }
  1075. }
  1076. #endif
  1077. #ifdef _GxBitmaps128x250_H_
  1078. void drawBitmaps128x250()
  1079. {
  1080. #if !defined(__AVR)
  1081. const unsigned char* bitmaps[] =
  1082. {
  1083. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  1084. };
  1085. #else
  1086. const unsigned char* bitmaps[] =
  1087. {
  1088. Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
  1089. };
  1090. #endif
  1091. if ((display.epd2.panel == GxEPD2::GDE0213B1) || (display.epd2.panel == GxEPD2::GDEH0213B72))
  1092. {
  1093. bool m = display.mirror(true);
  1094. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1095. {
  1096. display.firstPage();
  1097. do
  1098. {
  1099. display.fillScreen(GxEPD_WHITE);
  1100. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1101. }
  1102. while (display.nextPage());
  1103. delay(2000);
  1104. }
  1105. display.mirror(m);
  1106. }
  1107. }
  1108. #endif
  1109. #ifdef _GxBitmaps128x296_H_
  1110. void drawBitmaps128x296()
  1111. {
  1112. #if !defined(__AVR)
  1113. const unsigned char* bitmaps[] =
  1114. {
  1115. Bitmap128x296_1, logo128x296, first128x296, second128x296, third128x296
  1116. };
  1117. #else
  1118. const unsigned char* bitmaps[] =
  1119. {
  1120. Bitmap128x296_1, logo128x296 //, first128x296, second128x296, third128x296
  1121. };
  1122. #endif
  1123. if (display.epd2.panel == GxEPD2::GDEH029A1)
  1124. {
  1125. bool m = display.mirror(true);
  1126. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1127. {
  1128. display.firstPage();
  1129. do
  1130. {
  1131. display.fillScreen(GxEPD_WHITE);
  1132. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1133. }
  1134. while (display.nextPage());
  1135. delay(2000);
  1136. }
  1137. display.mirror(m);
  1138. }
  1139. }
  1140. #endif
  1141. #ifdef _GxBitmaps152x296_H_
  1142. void drawBitmaps152x296()
  1143. {
  1144. #if !defined(__AVR)
  1145. const unsigned char* bitmaps[] =
  1146. {
  1147. Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
  1148. };
  1149. #else
  1150. const unsigned char* bitmaps[] =
  1151. {
  1152. Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
  1153. };
  1154. #endif
  1155. if (display.epd2.panel == GxEPD2::GDEW026T0)
  1156. {
  1157. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1158. {
  1159. display.firstPage();
  1160. do
  1161. {
  1162. display.fillScreen(GxEPD_WHITE);
  1163. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1164. }
  1165. while (display.nextPage());
  1166. delay(2000);
  1167. }
  1168. }
  1169. }
  1170. #endif
  1171. #ifdef _GxBitmaps176x264_H_
  1172. void drawBitmaps176x264()
  1173. {
  1174. #if !defined(__AVR)
  1175. const unsigned char* bitmaps[] =
  1176. {
  1177. Bitmap176x264_1, Bitmap176x264_2, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  1178. };
  1179. #else
  1180. const unsigned char* bitmaps[] =
  1181. {
  1182. Bitmap176x264_1, Bitmap176x264_2 //, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
  1183. };
  1184. #endif
  1185. if (display.epd2.panel == GxEPD2::GDEW027W3)
  1186. {
  1187. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1188. {
  1189. display.firstPage();
  1190. do
  1191. {
  1192. display.fillScreen(GxEPD_WHITE);
  1193. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1194. }
  1195. while (display.nextPage());
  1196. delay(2000);
  1197. }
  1198. }
  1199. }
  1200. #endif
  1201. #ifdef _GxBitmaps240x416_H_
  1202. void drawBitmaps240x416()
  1203. {
  1204. #if !defined(__AVR)
  1205. const unsigned char* bitmaps[] =
  1206. {
  1207. Bitmap240x416_1, Bitmap240x416_2, Bitmap240x416_3
  1208. };
  1209. #else
  1210. const unsigned char* bitmaps[] =
  1211. {
  1212. Bitmap240x460_1, Bitmap240x460_2, Bitmap240x460_3
  1213. };
  1214. #endif
  1215. if (display.epd2.panel == GxEPD2::GDEW0371W7)
  1216. {
  1217. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1218. {
  1219. display.firstPage();
  1220. do
  1221. {
  1222. display.fillScreen(GxEPD_WHITE);
  1223. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1224. }
  1225. while (display.nextPage());
  1226. delay(2000);
  1227. }
  1228. }
  1229. }
  1230. #endif
  1231. #ifdef _GxBitmaps400x300_H_
  1232. void drawBitmaps400x300()
  1233. {
  1234. #if !defined(__AVR)
  1235. const unsigned char* bitmaps[] =
  1236. {
  1237. Bitmap400x300_1, Bitmap400x300_2
  1238. };
  1239. #else
  1240. const unsigned char* bitmaps[] = {}; // not enough code space
  1241. #endif
  1242. if (display.epd2.panel == GxEPD2::GDEW042T2)
  1243. {
  1244. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1245. {
  1246. display.firstPage();
  1247. do
  1248. {
  1249. display.fillScreen(GxEPD_WHITE);
  1250. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1251. }
  1252. while (display.nextPage());
  1253. delay(2000);
  1254. }
  1255. }
  1256. }
  1257. #endif
  1258. #ifdef _GxBitmaps640x384_H_
  1259. void drawBitmaps640x384()
  1260. {
  1261. #if !defined(__AVR)
  1262. const unsigned char* bitmaps[] =
  1263. {
  1264. Bitmap640x384_1, Bitmap640x384_2
  1265. };
  1266. #else
  1267. const unsigned char* bitmaps[] = {}; // not enough code space
  1268. #endif
  1269. if ((display.epd2.panel == GxEPD2::GDEW075T8) || (display.epd2.panel == GxEPD2::GDEW075Z09))
  1270. {
  1271. for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
  1272. {
  1273. display.firstPage();
  1274. do
  1275. {
  1276. display.fillScreen(GxEPD_WHITE);
  1277. display.drawInvertedBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1278. }
  1279. while (display.nextPage());
  1280. delay(2000);
  1281. }
  1282. }
  1283. }
  1284. #endif
  1285. #ifdef _GxBitmaps648x480_H_
  1286. void drawBitmaps648x480()
  1287. {
  1288. #if !defined(__AVR)
  1289. const unsigned char* bitmaps[] =
  1290. {
  1291. Bitmap648x480_1, Bitmap648x480_2, Bitmap648x480_3
  1292. };
  1293. #else
  1294. const unsigned char* bitmaps[] = {}; // not enough code space
  1295. #endif
  1296. if (display.epd2.panel == GxEPD2::GDEW0583T8)
  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.drawBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1305. }
  1306. while (display.nextPage());
  1307. delay(2000);
  1308. }
  1309. }
  1310. }
  1311. #endif
  1312. #ifdef _GxBitmaps800x480_H_
  1313. void drawBitmaps800x480()
  1314. {
  1315. #if !defined(__AVR)
  1316. const unsigned char* bitmaps[] =
  1317. {
  1318. Bitmap800x480_1, Bitmap800x480_2, Bitmap800x480_3, Bitmap800x480_4
  1319. };
  1320. #else
  1321. const unsigned char* bitmaps[] = {}; // not enough code space
  1322. #endif
  1323. if ((display.epd2.panel == GxEPD2::GDEW075T7) || (display.epd2.panel == GxEPD2::GDEW075Z08))
  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], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1332. display.drawBitmap(0, 0, bitmaps[i], display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1333. }
  1334. while (display.nextPage());
  1335. delay(2000);
  1336. }
  1337. if (display.epd2.panel == GxEPD2::GDEW075T7)
  1338. {
  1339. // avoid ghosting caused by OTP waveform
  1340. display.clearScreen();
  1341. display.refresh(false); // full update
  1342. }
  1343. }
  1344. }
  1345. #endif
  1346. #ifdef _WS_Bitmaps800x600_H_
  1347. void drawBitmaps800x600()
  1348. {
  1349. #if defined(ESP8266) || defined(ESP32)
  1350. if (display.epd2.panel == GxEPD2::ED060SCT)
  1351. {
  1352. // Serial.print("sizeof(WS_zoo_800x600) is "); Serial.println(sizeof(WS_zoo_800x600));
  1353. display.drawNative(WS_zoo_800x600, 0, 0, 0, 800, 600, false, false, true);
  1354. delay(2000);
  1355. // Serial.print("sizeof(WS_pic_1200x825) is "); Serial.println(sizeof(WS_pic_1200x825));
  1356. // display.drawNative((const uint8_t*)WS_pic_1200x825, 0, 0, 0, 1200, 825, false, false, true);
  1357. // delay(2000);
  1358. // Serial.print("sizeof(WS_acaa_1024x731) is "); Serial.println(sizeof(WS_acaa_1024x731));
  1359. // display.drawNative(WS_acaa_1024x731, 0, 0, 0, 1024, 731, false, false, true);
  1360. // delay(2000);
  1361. }
  1362. #endif
  1363. }
  1364. #endif
  1365. #if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
  1366. void drawBitmaps1304x984()
  1367. {
  1368. if (display.epd2.panel == GxEPD2::GDEW1248T3)
  1369. {
  1370. display.drawImage(Bitmap1304x984, 0, 0, display.epd2.WIDTH, display.epd2.HEIGHT, false, false, true);
  1371. }
  1372. }
  1373. #endif
  1374. struct bitmap_pair
  1375. {
  1376. const unsigned char* black;
  1377. const unsigned char* red;
  1378. };
  1379. #ifdef _GxBitmaps3c200x200_H_
  1380. void drawBitmaps3c200x200()
  1381. {
  1382. bitmap_pair bitmap_pairs[] =
  1383. {
  1384. //{Bitmap3c200x200_black, Bitmap3c200x200_red},
  1385. {WS_Bitmap3c200x200_black, WS_Bitmap3c200x200_red}
  1386. };
  1387. if (display.epd2.panel == GxEPD2::GDEW0154Z04)
  1388. {
  1389. display.firstPage();
  1390. do
  1391. {
  1392. display.fillScreen(GxEPD_WHITE);
  1393. // Bitmap3c200x200_black has 2 bits per pixel
  1394. // taken from Adafruit_GFX.cpp, modified
  1395. int16_t byteWidth = (display.epd2.WIDTH + 7) / 8; // Bitmap scanline pad = whole byte
  1396. uint8_t byte = 0;
  1397. for (int16_t j = 0; j < display.epd2.HEIGHT; j++)
  1398. {
  1399. for (int16_t i = 0; i < display.epd2.WIDTH; i++)
  1400. {
  1401. if (i & 3) byte <<= 2;
  1402. else
  1403. {
  1404. #if defined(__AVR) || defined(ESP8266) || defined(ESP32)
  1405. byte = pgm_read_byte(&Bitmap3c200x200_black[j * byteWidth * 2 + i / 4]);
  1406. #else
  1407. byte = Bitmap3c200x200_black[j * byteWidth * 2 + i / 4];
  1408. #endif
  1409. }
  1410. if (!(byte & 0x80))
  1411. {
  1412. display.drawPixel(i, j, GxEPD_BLACK);
  1413. }
  1414. }
  1415. }
  1416. display.drawInvertedBitmap(0, 0, Bitmap3c200x200_red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1417. }
  1418. while (display.nextPage());
  1419. delay(2000);
  1420. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1421. {
  1422. display.firstPage();
  1423. do
  1424. {
  1425. display.fillScreen(GxEPD_WHITE);
  1426. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1427. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1428. }
  1429. while (display.nextPage());
  1430. delay(2000);
  1431. }
  1432. }
  1433. if (display.epd2.hasColor)
  1434. {
  1435. display.clearScreen(); // use default for white
  1436. int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
  1437. int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
  1438. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1439. {
  1440. display.drawImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1441. delay(2000);
  1442. }
  1443. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1444. {
  1445. int16_t x = -60;
  1446. int16_t y = -60;
  1447. for (uint16_t j = 0; j < 10; j++)
  1448. {
  1449. display.writeScreenBuffer(); // use default for white
  1450. display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
  1451. display.refresh();
  1452. delay(1000);
  1453. x += display.epd2.WIDTH / 4;
  1454. y += display.epd2.HEIGHT / 4;
  1455. if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
  1456. }
  1457. }
  1458. display.writeScreenBuffer(); // use default for white
  1459. display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, 0, 0, 200, 200, false, false, true);
  1460. 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);
  1461. display.refresh();
  1462. delay(2000);
  1463. }
  1464. }
  1465. #endif
  1466. #ifdef _GxBitmaps3c104x212_H_
  1467. void drawBitmaps3c104x212()
  1468. {
  1469. #if !defined(__AVR)
  1470. bitmap_pair bitmap_pairs[] =
  1471. {
  1472. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1473. {Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1474. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1475. };
  1476. #else
  1477. bitmap_pair bitmap_pairs[] =
  1478. {
  1479. {Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
  1480. //{Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
  1481. {WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
  1482. };
  1483. #endif
  1484. if (display.epd2.panel == GxEPD2::GDEW0213Z16)
  1485. {
  1486. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1487. {
  1488. display.firstPage();
  1489. do
  1490. {
  1491. display.fillScreen(GxEPD_WHITE);
  1492. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1493. if (bitmap_pairs[i].red == WS_Bitmap3c104x212_red)
  1494. {
  1495. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1496. }
  1497. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1498. }
  1499. while (display.nextPage());
  1500. delay(2000);
  1501. }
  1502. }
  1503. }
  1504. #endif
  1505. #ifdef _GxBitmaps3c128x296_H_
  1506. void drawBitmaps3c128x296()
  1507. {
  1508. #if !defined(__AVR)
  1509. bitmap_pair bitmap_pairs[] =
  1510. {
  1511. {Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1512. {Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1513. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1514. };
  1515. #else
  1516. bitmap_pair bitmap_pairs[] =
  1517. {
  1518. //{Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
  1519. //{Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
  1520. {WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
  1521. };
  1522. #endif
  1523. if (display.epd2.panel == GxEPD2::GDEW029Z10)
  1524. {
  1525. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1526. {
  1527. display.firstPage();
  1528. do
  1529. {
  1530. display.fillScreen(GxEPD_WHITE);
  1531. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1532. if (bitmap_pairs[i].red == WS_Bitmap3c128x296_red)
  1533. {
  1534. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1535. }
  1536. else display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1537. }
  1538. while (display.nextPage());
  1539. delay(2000);
  1540. }
  1541. }
  1542. }
  1543. #endif
  1544. #ifdef _GxBitmaps3c176x264_H_
  1545. void drawBitmaps3c176x264()
  1546. {
  1547. bitmap_pair bitmap_pairs[] =
  1548. {
  1549. {Bitmap3c176x264_black, Bitmap3c176x264_red}
  1550. };
  1551. if (display.epd2.panel == GxEPD2::GDEW027C44)
  1552. {
  1553. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1554. {
  1555. display.firstPage();
  1556. do
  1557. {
  1558. display.fillScreen(GxEPD_WHITE);
  1559. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1560. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1561. }
  1562. while (display.nextPage());
  1563. delay(2000);
  1564. }
  1565. }
  1566. }
  1567. #endif
  1568. #ifdef _GxBitmaps3c400x300_H_
  1569. void drawBitmaps3c400x300()
  1570. {
  1571. #if !defined(__AVR)
  1572. bitmap_pair bitmap_pairs[] =
  1573. {
  1574. {Bitmap3c400x300_1_black, Bitmap3c400x300_1_red},
  1575. {Bitmap3c400x300_2_black, Bitmap3c400x300_2_red},
  1576. {WS_Bitmap3c400x300_black, WS_Bitmap3c400x300_red}
  1577. };
  1578. #else
  1579. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1580. #endif
  1581. if (display.epd2.panel == GxEPD2::GDEW042Z15)
  1582. {
  1583. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1584. {
  1585. display.firstPage();
  1586. do
  1587. {
  1588. display.fillScreen(GxEPD_WHITE);
  1589. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1590. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1591. }
  1592. while (display.nextPage());
  1593. delay(2000);
  1594. }
  1595. }
  1596. }
  1597. #endif
  1598. #ifdef _GxBitmaps3c800x480_H_
  1599. void drawBitmaps3c800x480()
  1600. {
  1601. #if !defined(__AVR)
  1602. bitmap_pair bitmap_pairs[] =
  1603. {
  1604. {Bitmap3c800x480_1_black, Bitmap3c800x480_1_red}
  1605. };
  1606. #else
  1607. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1608. #endif
  1609. if (display.epd2.panel == GxEPD2::GDEW075Z08)
  1610. {
  1611. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1612. {
  1613. display.firstPage();
  1614. do
  1615. {
  1616. display.fillScreen(GxEPD_WHITE);
  1617. display.drawBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
  1618. display.drawBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
  1619. }
  1620. while (display.nextPage());
  1621. delay(2000);
  1622. }
  1623. }
  1624. }
  1625. #endif
  1626. #ifdef _GxBitmaps3c880x528_H_
  1627. void drawBitmaps3c880x528()
  1628. {
  1629. #if !defined(__AVR)
  1630. bitmap_pair bitmap_pairs[] =
  1631. {
  1632. {Bitmap3c880x528_black, Bitmap3c880x528_red}
  1633. };
  1634. #else
  1635. bitmap_pair bitmap_pairs[] = {}; // not enough code space
  1636. #endif
  1637. if (display.epd2.panel == GxEPD2::GDEH075Z90)
  1638. {
  1639. bool m = display.mirror(true);
  1640. for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
  1641. {
  1642. display.firstPage();
  1643. do
  1644. {
  1645. display.fillScreen(GxEPD_WHITE);
  1646. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, 880, 528, GxEPD_BLACK);
  1647. display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, 880, 528, GxEPD_RED);
  1648. }
  1649. while (display.nextPage());
  1650. delay(2000);
  1651. }
  1652. display.mirror(m);
  1653. }
  1654. }
  1655. #endif
  1656. #if defined(_WS_Bitmaps7c192x143_H_)
  1657. void drawBitmaps7c192x143()
  1658. {
  1659. if (display.epd2.panel == GxEPD2::ACeP565)
  1660. {
  1661. display.drawNative(WS_Bitmap7c192x143, 0, (display.epd2.WIDTH - 192) / 2, (display.epd2.HEIGHT - 143) / 2, 192, 143, false, false, true);
  1662. delay(5000);
  1663. }
  1664. }
  1665. #endif
  1666. void draw7colors()
  1667. {
  1668. display.setRotation(0);
  1669. uint16_t h = display.height() / 7;
  1670. display.firstPage();
  1671. do
  1672. {
  1673. display.fillRect(0, 0, display.width(), h, GxEPD_BLACK);
  1674. display.fillRect(0, h, display.width(), h, GxEPD_WHITE);
  1675. display.fillRect(0, 2 * h, display.width(), h, GxEPD_GREEN);
  1676. display.fillRect(0, 3 * h, display.width(), h, GxEPD_BLUE);
  1677. display.fillRect(0, 4 * h, display.width(), h, GxEPD_RED);
  1678. display.fillRect(0, 5 * h, display.width(), h, GxEPD_YELLOW);
  1679. display.fillRect(0, 6 * h, display.width(), h, GxEPD_ORANGE);
  1680. }
  1681. while (display.nextPage());
  1682. }
  1683. void draw7colorlines()
  1684. {
  1685. display.setRotation(0);
  1686. uint16_t h = 2;
  1687. display.firstPage();
  1688. do
  1689. {
  1690. uint16_t y = 0;
  1691. do
  1692. {
  1693. display.fillRect(0, y, display.width(), h, GxEPD_BLACK); y += h;
  1694. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1695. display.fillRect(0, y, display.width(), h, GxEPD_GREEN); y += h;
  1696. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1697. display.fillRect(0, y, display.width(), h, GxEPD_BLUE); y += h;
  1698. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1699. display.fillRect(0, y, display.width(), h, GxEPD_RED); y += h;
  1700. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1701. display.fillRect(0, y, display.width(), h, GxEPD_YELLOW); y += h;
  1702. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1703. display.fillRect(0, y, display.width(), h, GxEPD_ORANGE); y += h;
  1704. display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
  1705. }
  1706. while ((y + 12 * h) < display.height());
  1707. //display.drawPixel(0, y, GxEPD_BLACK); display.drawPixel(10, y, GxEPD_GREEN);
  1708. //display.drawPixel(20, y, GxEPD_BLUE); display.drawPixel(30, y, GxEPD_RED);
  1709. //display.drawPixel(40, y, GxEPD_YELLOW); display.drawPixel(50, y, GxEPD_ORANGE);
  1710. display.fillRect(0, y, 2, 2, GxEPD_BLACK); display.fillRect(10, y, 2, 2, GxEPD_GREEN);
  1711. display.fillRect(20, y, 2, 2, GxEPD_BLUE); display.fillRect(30, y, 2, 2, GxEPD_RED);
  1712. display.fillRect(40, y, 2, 2, GxEPD_YELLOW); display.fillRect(50, y, 2, 2, GxEPD_ORANGE);
  1713. }
  1714. while (display.nextPage());
  1715. }