diff --git a/README.md b/README.md index dba5656..77ddc23 100644 --- a/README.md +++ b/README.md @@ -31,3 +31,4 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md ## Acknowledgments * [PlatformIO](https://platformio.org) - Cross-platform IDE +* [GxEPD2](https://github.com/ZinggJM/GxEPD2) - E-Paper display library diff --git a/platformio.ini b/platformio.ini index 157d7ff..4cf6d1b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -23,7 +23,9 @@ build_flags = -DWIFI_SSID2="\"${sysenv.WIFI_SSID}\"" -DWIFI_PASSWD2="\"${sysenv.WIFI_PASSWD}\"" -;lib_deps = +lib_deps = + GxEPD2 + Adafruit GFX Library ; ArduinoJSON monitor_speed = 115200 diff --git a/src/main.cpp b/src/main.cpp index 3641542..808de58 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,7 +8,36 @@ #include #include +#include +#include +#include "bitmaps/Bitmaps128x250.h" + WiFiMulti wifiMulti; +GxEPD2_BW display(GxEPD2_213_B72(/*CS=TFT_CS*/ SS, /*DC=*/ TFT_DC, /*RST=*/ TFT_RST, /*BUSY=*/ -1)); // GDEH0213B72 + +void helloWorld() +{ + const char HelloWorld[] = "Hello World!"; + //Serial.println("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()); + //Serial.println("helloWorld done"); +} void setup() { @@ -17,6 +46,10 @@ void setup() // initialize LED digital pin as an output. pinMode(LED_BUILTIN, OUTPUT); + display.init(115200); + helloWorld(); + display.powerOff(); + wifiMulti.addAP(WIFI_SSID, WIFI_PASSWD); wifiMulti.addAP(WIFI_SSID2, WIFI_PASSWD2);