-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- fixed GxEPD2_MinimumExample.ino to draw black on white (white on white was invisible) - added example GxEPD2_HelloWorld.ino - updated wiring info and constructor parameters for the actual Waveshare e-Paper ESP8266 Driver Board - added some missing explicit initializers (nobody noticed as compilers usually initialize simple members)
- Loading branch information
Showing
9 changed files
with
140 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// GxEPD2_HelloWorld.ino by Jean-Marc Zingg | ||
|
||
// uncomment next line to use class GFX of library GFX_Root instead of Adafruit_GFX | ||
#include <GFX.h> | ||
|
||
#define ENABLE_GxEPD2_GFX 0 | ||
#include <GxEPD2_BW.h> // including both doesn't hurt | ||
#include <GxEPD2_3C.h> // including both doesn't hurt | ||
#include <Fonts/FreeMonoBold9pt7b.h> | ||
|
||
// copy constructor for your e-paper from GxEPD2_Example.ino, and for AVR needed #defines | ||
#define MAX_DISPLAY_BUFFER_SIZE 800 // | ||
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8)) | ||
//GxEPD2_BW<GxEPD2_154, MAX_HEIGHT(GxEPD2_154)> display(GxEPD2_154(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEP015OC1 no longer available | ||
//GxEPD2_BW<GxEPD2_154_D67, MAX_HEIGHT(GxEPD2_154_D67)> display(GxEPD2_154_D67(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7)); // GDEH0154D67 | ||
|
||
// e.g. for Wemos D1 mini: | ||
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 | ||
|
||
void setup() | ||
{ | ||
display.init(); | ||
helloWorld(); | ||
display.hibernate(); | ||
} | ||
|
||
const char HelloWorld[] = "Hello World!"; | ||
|
||
void helloWorld() | ||
{ | ||
display.setRotation(1); | ||
display.setFont(&FreeMonoBold9pt7b); | ||
display.setTextColor(GxEPD_BLACK); | ||
int16_t tbx, tby; uint16_t tbw, tbh; | ||
display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh); | ||
// center bounding box by transposition of origin: | ||
uint16_t x = ((display.width() - tbw) / 2) - tbx; | ||
uint16_t y = ((display.height() - tbh) / 2) - tby; | ||
display.setFullWindow(); | ||
display.firstPage(); | ||
do | ||
{ | ||
display.fillScreen(GxEPD_WHITE); | ||
display.setCursor(x, y); | ||
display.print(HelloWorld); | ||
} | ||
while (display.nextPage()); | ||
} | ||
|
||
void loop() {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters