first commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
name=GxEPD_ParticleExample
|
||||
dependencies.GxEPD=3.0.8
|
||||
@@ -0,0 +1,508 @@
|
||||
// GxEPD_Example : test example for e-Paper displays from Waveshare and from Dalian Good Display Inc.
|
||||
//
|
||||
// Created by Jean-Marc Zingg based on demo code from Good Display,
|
||||
// available on http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html
|
||||
//
|
||||
// The e-paper displays are available from:
|
||||
//
|
||||
// https://www.aliexpress.com/store/product/Wholesale-1-54inch-E-Ink-display-module-with-embedded-controller-200x200-Communicate-via-SPI-interface-Supports/216233_32824535312.html
|
||||
//
|
||||
// http://www.buy-lcd.com/index.php?route=product/product&path=2897_8363&product_id=35120
|
||||
// or https://www.aliexpress.com/store/product/E001-1-54-inch-partial-refresh-Small-size-dot-matrix-e-paper-display/600281_32815089163.html
|
||||
//
|
||||
#include <Adafruit_GFX_RK.h>
|
||||
#include <GxEPD.h>
|
||||
|
||||
// Supporting Arduino Forum Topics:
|
||||
// Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0
|
||||
// Good Dispay ePaper for Arduino: https://forum.arduino.cc/index.php?topic=436411.0
|
||||
|
||||
// mapping suggestion from Waveshare SPI e-Paper to Particle Photon
|
||||
// A5 MOSI
|
||||
// A4 MISO
|
||||
// A3 SCK
|
||||
// A2 SS
|
||||
// BUSY -> D4, RST -> A0, DC -> A1, CS -> A2, CLK -> A3, DIN -> A5, GND -> GND, 3.3V -> 3.3V
|
||||
// NOTE: it looks like MISO can't be used as general input pin for BUSY.
|
||||
|
||||
// select the display class to use, only one
|
||||
//#include <GxGDEP015OC1/GxGDEP015OC1.h> // 1.54" b/w
|
||||
//#include <GxGDEW0154Z04/GxGDEW0154Z04.h> // 1.54" b/w/r 200x200
|
||||
//#include <GxGDEW0154Z17/GxGDEW0154Z17.h> // 1.54" b/w/r 152x152
|
||||
//#include <GxGDEW0213I5F/GxGDEW0213I5F.h> // 2.13" b/w 104x212 flexible
|
||||
//#include <GxGDE0213B1/GxGDE0213B1.h> // 2.13" b/w
|
||||
#include <GxGDEH0213B72/GxGDEH0213B72.h> // 2.13" b/w new panel
|
||||
//#include <GxGDEW0213Z16/GxGDEW0213Z16.h> // 2.13" b/w/r
|
||||
//#include <GxGDEH029A1/GxGDEH029A1.h> // 2.9" b/w
|
||||
//#include <GxGDEW029T5/GxGDEW029T5.h> // 2.9" b/w IL0373
|
||||
//#include <GxGDEW029Z10/GxGDEW029Z10.h> // 2.9" b/w/r
|
||||
//#include <GxGDEW027C44/GxGDEW027C44.h> // 2.7" b/w/r
|
||||
//#include <GxGDEW027W3/GxGDEW027W3.h> // 2.7" b/w
|
||||
//#include <GxGDEW042T2/GxGDEW042T2.h> // 4.2" b/w
|
||||
//#include <GxGDEW042Z15/GxGDEW042Z15.h> // 4.2" b/w/r
|
||||
//#include <GxGDEW0583T7/GxGDEW0583T7.h> // 5.83" b/w
|
||||
//#include <GxGDEW075T8/GxGDEW075T8.h> // 7.5" b/w
|
||||
//#include <GxGDEW075Z09/GxGDEW075Z09.h> // 7.5" b/w/r
|
||||
|
||||
#include GxEPD_BitmapExamples
|
||||
|
||||
// FreeFonts from Adafruit_GFX
|
||||
#include <FreeMonoBold9pt7b.h>
|
||||
#include <FreeMonoBold12pt7b.h>
|
||||
#include <FreeMonoBold18pt7b.h>
|
||||
#include <FreeMonoBold24pt7b.h>
|
||||
|
||||
|
||||
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
|
||||
#include <GxIO/GxIO.h>
|
||||
|
||||
GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ A1, /*RST=*/ A0);
|
||||
GxEPD_Class display(io, /*RST=*/ A0, /*BUSY=*/ D4);
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println();
|
||||
Serial.println("setup");
|
||||
|
||||
display.init(115200); // enable diagnostic output on Serial
|
||||
|
||||
Serial.println("setup done");
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
showBitmapExample();
|
||||
delay(2000);
|
||||
#if !defined(__AVR)
|
||||
//drawCornerTest();
|
||||
showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
|
||||
showFont("FreeMonoBold12pt7b", &FreeMonoBold12pt7b);
|
||||
//showFont("FreeMonoBold18pt7b", &FreeMonoBold18pt7b);
|
||||
//showFont("FreeMonoBold24pt7b", &FreeMonoBold24pt7b);
|
||||
#else
|
||||
display.drawCornerTest();
|
||||
delay(2000);
|
||||
display.drawPaged(showFontCallback);
|
||||
#endif
|
||||
delay(10000);
|
||||
}
|
||||
|
||||
#if defined(_GxGDEP015OC1_H_)
|
||||
void showBitmapExample()
|
||||
{
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
delay(5000);
|
||||
showBoat();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW0154Z04_H_)
|
||||
#define HAS_RED_COLOR
|
||||
void showBitmapExample()
|
||||
{
|
||||
#if !defined(__AVR)
|
||||
display.drawPicture(BitmapWaveshare_black, BitmapWaveshare_red, sizeof(BitmapWaveshare_black), sizeof(BitmapWaveshare_red), GxEPD::bm_normal);
|
||||
delay(5000);
|
||||
#endif
|
||||
display.drawExamplePicture(BitmapExample1, BitmapExample2, sizeof(BitmapExample1), sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW0154Z17_H_)
|
||||
#define HAS_RED_COLOR
|
||||
void showBitmapExample()
|
||||
{
|
||||
display.drawExamplePicture(BitmapExample1, BitmapExample2, sizeof(BitmapExample1), sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
display.drawExamplePicture(BitmapExample3, BitmapExample4, sizeof(BitmapExample1), sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
//display.drawBitmap(BitmapExample2, sizeof(BitmapExample2));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDE0213B1_H_)
|
||||
void showBitmapExample()
|
||||
{
|
||||
display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawBitmap(BitmapExample2, sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
#if !defined(__AVR)
|
||||
display.drawBitmap(first, sizeof(first));
|
||||
delay(5000);
|
||||
display.drawBitmap(second, sizeof(second));
|
||||
delay(5000);
|
||||
display.drawBitmap(third, sizeof(third));
|
||||
delay(5000);
|
||||
#endif
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
delay(5000);
|
||||
showBoat();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEH0213B72_H_)
|
||||
void showBitmapExample()
|
||||
{
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
#if !defined(__AVR)
|
||||
display.drawExampleBitmap(BitmapExample3, sizeof(BitmapExample3));
|
||||
delay(5000);
|
||||
display.drawExampleBitmap(logo, sizeof(logo));
|
||||
delay(5000);
|
||||
display.drawExampleBitmap(first, sizeof(first));
|
||||
delay(5000);
|
||||
display.drawExampleBitmap(second, sizeof(second));
|
||||
delay(5000);
|
||||
display.drawExampleBitmap(third, sizeof(third));
|
||||
delay(5000);
|
||||
#endif
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
delay(5000);
|
||||
showBoat();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW0213I5F_H_)
|
||||
void showBitmapExample()
|
||||
{
|
||||
display.drawBitmap(BitmapExample1, sizeof(BitmapExample1), GxEPD::bm_invert);
|
||||
delay(5000);
|
||||
display.drawBitmap(BitmapExample2, sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
#if !defined(__AVR)
|
||||
display.drawBitmap(BitmapExample3, sizeof(BitmapExample3));
|
||||
delay(5000);
|
||||
display.drawBitmap(BitmapExample4, sizeof(BitmapExample4));
|
||||
delay(5000);
|
||||
#endif
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
delay(5000);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW0213Z16_H_)
|
||||
#define HAS_RED_COLOR
|
||||
void showBitmapExample()
|
||||
{
|
||||
display.drawPicture(BitmapWaveshare_black, BitmapWaveshare_red, sizeof(BitmapWaveshare_black), sizeof(BitmapWaveshare_red));
|
||||
delay(5000);
|
||||
display.drawExamplePicture(BitmapExample1, BitmapExample2, sizeof(BitmapExample1), sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
#if !defined(__AVR)
|
||||
display.drawExamplePicture(BitmapExample3, BitmapExample4, sizeof(BitmapExample3), sizeof(BitmapExample4));
|
||||
delay(5000);
|
||||
#endif
|
||||
display.drawExampleBitmap(BitmapWaveshare_black, sizeof(BitmapWaveshare_black));
|
||||
delay(2000);
|
||||
// example bitmaps for b/w/r are normal on b/w, but inverted on red
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2), GxEPD::bm_invert);
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEH029A1_H_)
|
||||
void showBitmapExample()
|
||||
{
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
delay(5000);
|
||||
showBoat();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW029T5_H_)
|
||||
void showBitmapExample()
|
||||
{
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
display.drawExampleBitmap(BitmapExample3, sizeof(BitmapExample3));
|
||||
delay(5000);
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
delay(5000);
|
||||
// showBoat();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW029Z10_H_)
|
||||
#define HAS_RED_COLOR
|
||||
void showBitmapExample()
|
||||
{
|
||||
#if defined(__AVR)
|
||||
display.drawExamplePicture(BitmapExample1, BitmapExample2, sizeof(BitmapExample1), sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
#else
|
||||
display.drawPicture(BitmapWaveshare_black, BitmapWaveshare_red, sizeof(BitmapWaveshare_black), sizeof(BitmapWaveshare_red));
|
||||
delay(5000);
|
||||
display.drawExamplePicture(BitmapExample1, BitmapExample2, sizeof(BitmapExample1), sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
display.drawExamplePicture(BitmapExample3, BitmapExample4, sizeof(BitmapExample3), sizeof(BitmapExample4));
|
||||
delay(5000);
|
||||
display.drawExampleBitmap(BitmapWaveshare_black, sizeof(BitmapWaveshare_black));
|
||||
delay(2000);
|
||||
// example bitmaps for b/w/r are normal on b/w, but inverted on red
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2), GxEPD::bm_invert);
|
||||
delay(2000);
|
||||
#endif
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW027C44_H_)
|
||||
#define HAS_RED_COLOR
|
||||
void showBitmapExample()
|
||||
{
|
||||
// draw black and red bitmap
|
||||
display.drawPicture(BitmapExample1, BitmapExample2, sizeof(BitmapExample1), sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
return;
|
||||
display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawBitmap(0, 0, BitmapExample1, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW027W3_H_)
|
||||
void showBitmapExample()
|
||||
{
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
#if !defined(__AVR)
|
||||
display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample3, sizeof(BitmapExample3));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample4, sizeof(BitmapExample4));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample5, sizeof(BitmapExample5));
|
||||
delay(2000);
|
||||
#endif
|
||||
display.drawExampleBitmap(BitmapWaveshare, sizeof(BitmapWaveshare));
|
||||
delay(5000);
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW042T2_H_) || defined(_GxGDEW042T2_FPU_H_)
|
||||
void showBitmapExample()
|
||||
{
|
||||
#if defined(__AVR)
|
||||
display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
#else
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW042Z15_H_)
|
||||
#define HAS_RED_COLOR
|
||||
void showBitmapExample()
|
||||
{
|
||||
#if defined(__AVR)
|
||||
display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
#else
|
||||
// draw black and red bitmap
|
||||
display.drawPicture(BitmapExample1, BitmapExample2, sizeof(BitmapExample1), sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
display.drawPicture(BitmapExample3, BitmapExample4, sizeof(BitmapExample3), sizeof(BitmapExample4));
|
||||
delay(5000);
|
||||
display.drawPicture(BitmapWaveshare_black, BitmapWaveshare_red, sizeof(BitmapWaveshare_black), sizeof(BitmapWaveshare_red));
|
||||
delay(5000);
|
||||
display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW0583T7_H_)
|
||||
void showBitmapExample()
|
||||
{
|
||||
#if defined(__AVR)
|
||||
//display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
#else
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW075T8_H_)
|
||||
void showBitmapExample()
|
||||
{
|
||||
#if defined(__AVR)
|
||||
display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
#else
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW075Z09_H_)
|
||||
#define HAS_RED_COLOR
|
||||
void showBitmapExample()
|
||||
{
|
||||
#if defined(__AVR)
|
||||
display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
#elif defined(ARDUINO_GENERIC_STM32F103C)
|
||||
display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
#elif defined(ARDUINO_GENERIC_STM32F103V)
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawExamplePicture_3C(BitmapPicture_3C, sizeof(BitmapPicture_3C));
|
||||
#else
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2));
|
||||
delay(5000);
|
||||
display.drawExamplePicture_3C(BitmapPicture_3C, sizeof(BitmapPicture_3C));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void showFont(const char name[], const GFXfont* f)
|
||||
{
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.setTextColor(GxEPD_BLACK);
|
||||
display.setFont(f);
|
||||
display.setCursor(0, 0);
|
||||
display.println();
|
||||
display.println(name);
|
||||
display.println(" !\"#$%&'()*+,-./");
|
||||
display.println("0123456789:;<=>?");
|
||||
display.println("@ABCDEFGHIJKLMNO");
|
||||
display.println("PQRSTUVWXYZ[\\]^_");
|
||||
#if defined(HAS_RED_COLOR)
|
||||
display.setTextColor(GxEPD_RED);
|
||||
#endif
|
||||
display.println("`abcdefghijklmno");
|
||||
display.println("pqrstuvwxyz{|}~ ");
|
||||
display.update();
|
||||
delay(5000);
|
||||
}
|
||||
|
||||
void showFontCallback()
|
||||
{
|
||||
const char* name = "FreeMonoBold9pt7b";
|
||||
const GFXfont* f = &FreeMonoBold9pt7b;
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.setTextColor(GxEPD_BLACK);
|
||||
display.setFont(f);
|
||||
display.setCursor(0, 0);
|
||||
display.println();
|
||||
display.println(name);
|
||||
display.println(" !\"#$%&'()*+,-./");
|
||||
display.println("0123456789:;<=>?");
|
||||
display.println("@ABCDEFGHIJKLMNO");
|
||||
display.println("PQRSTUVWXYZ[\\]^_");
|
||||
#if defined(HAS_RED_COLOR)
|
||||
display.setTextColor(GxEPD_RED);
|
||||
#endif
|
||||
display.println("`abcdefghijklmno");
|
||||
display.println("pqrstuvwxyz{|}~ ");
|
||||
}
|
||||
|
||||
void drawCornerTest()
|
||||
{
|
||||
display.drawCornerTest();
|
||||
delay(5000);
|
||||
uint8_t rotation = display.getRotation();
|
||||
for (uint16_t r = 0; r < 4; r++)
|
||||
{
|
||||
display.setRotation(r);
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
|
||||
display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
|
||||
display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
|
||||
display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
|
||||
display.update();
|
||||
delay(5000);
|
||||
}
|
||||
display.setRotation(rotation); // restore
|
||||
}
|
||||
|
||||
#if defined(_GxGDEP015OC1_H_) || defined(_GxGDE0213B1_H_) || defined(_GxGDEH0213B72_H_) || defined(_GxGDEH029A1_H_)
|
||||
#include "IMG_0001.h"
|
||||
void showBoat()
|
||||
{
|
||||
// thanks to bytecrusher: http://forum.arduino.cc/index.php?topic=487007.msg3367378#msg3367378
|
||||
uint16_t x = (display.width() - 64) / 2;
|
||||
uint16_t y = 5;
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(gImage_IMG_0001, x, y, 64, 180, GxEPD_BLACK);
|
||||
display.update();
|
||||
delay(500);
|
||||
uint16_t forward = GxEPD::bm_invert | GxEPD::bm_flip_x;
|
||||
uint16_t reverse = GxEPD::bm_invert | GxEPD::bm_flip_x | GxEPD::bm_flip_y;
|
||||
for (; y + 180 + 5 <= display.height(); y += 5)
|
||||
{
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(gImage_IMG_0001, x, y, 64, 180, GxEPD_BLACK, forward);
|
||||
display.updateWindow(0, 0, display.width(), display.height());
|
||||
delay(500);
|
||||
}
|
||||
delay(1000);
|
||||
for (; y >= 5; y -= 5)
|
||||
{
|
||||
display.fillScreen(GxEPD_WHITE);
|
||||
display.drawExampleBitmap(gImage_IMG_0001, x, y, 64, 180, GxEPD_BLACK, reverse);
|
||||
display.updateWindow(0, 0, display.width(), display.height());
|
||||
delay(1000);
|
||||
}
|
||||
display.update();
|
||||
delay(1000);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,104 @@
|
||||
#ifndef _GxBootExample_H_
|
||||
#define _GxBootExample_H_
|
||||
|
||||
#if defined(ESP8266) || defined(ESP32)
|
||||
#include <pgmspace.h>
|
||||
#else
|
||||
#include <avr/pgmspace.h>
|
||||
#endif
|
||||
|
||||
// 180 x 64 (Boot)
|
||||
const unsigned char gImage_IMG_0001[1440] PROGMEM = { /* 0X01,0X01,0XB4,0X00,0X40,0X00, */
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XC0,0X1F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X80,0X07,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0X00,0X01,0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,0X01,0X80,0X3F,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFC,0X01,0XE0,0X1F,0XFF,0XFF,0XFF,0XFF,0XF8,0X10,0XF8,0X0F,0XFF,0XFF,
|
||||
0XFF,0XFF,0XF8,0X70,0XF8,0X0F,0XFF,0XFF,0XFF,0XFF,0XF0,0X70,0XF8,0X0F,0XFF,0XFF,
|
||||
0XFF,0XFF,0XF0,0XF0,0XF8,0X07,0XFF,0XFF,0XFF,0XF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XFF,0XFF,0XFF,0XFE,0X18,0X03,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0X18,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X08,0X07,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0X08,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X1F,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0X80,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X80,0X7F,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
name=GxEPD_ParticlePartialUpdateExample
|
||||
dependencies.GxEPD=3.0.8
|
||||
@@ -0,0 +1,350 @@
|
||||
// PartialUpdateExample : example for Waveshare 1.54", 2.31" and 2.9" e-Paper and the same e-papers from Dalian Good Display Inc.
|
||||
//
|
||||
// Created by Jean-Marc Zingg based on demo code from Good Display for GDEP015OC1.
|
||||
//
|
||||
// The e-paper displays are available from:
|
||||
//
|
||||
// https://www.aliexpress.com/store/product/Wholesale-1-54inch-E-Ink-display-module-with-embedded-controller-200x200-Communicate-via-SPI-interface-Supports/216233_32824535312.html
|
||||
//
|
||||
// http://www.buy-lcd.com/index.php?route=product/product&path=2897_8363&product_id=35120
|
||||
// or https://www.aliexpress.com/store/product/E001-1-54-inch-partial-refresh-Small-size-dot-matrix-e-paper-display/600281_32815089163.html
|
||||
//
|
||||
#include <Adafruit_GFX_RK.h>
|
||||
#include <GxEPD.h>
|
||||
|
||||
// Supporting Arduino Forum Topics:
|
||||
// Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0
|
||||
// Good Dispay ePaper for Arduino: https://forum.arduino.cc/index.php?topic=436411.0
|
||||
|
||||
// mapping suggestion from Waveshare SPI e-Paper to Particle Photon
|
||||
// A5 MOSI
|
||||
// A4 MISO
|
||||
// A3 SCK
|
||||
// A2 SS
|
||||
// BUSY -> D4, RST -> A0, DC -> A1, CS -> A2, CLK -> A3, DIN -> A5, GND -> GND, 3.3V -> 3.3V
|
||||
// NOTE: it looks like MISO can't be used as general input pin for BUSY.
|
||||
|
||||
// Supporting Arduino Forum Topics:
|
||||
// Waveshare e-paper displays with SPI: http://forum.arduino.cc/index.php?topic=487007.0
|
||||
// Good Dispay ePaper for Arduino : https://forum.arduino.cc/index.php?topic=436411.0
|
||||
|
||||
// select the display class to use, only one
|
||||
//#include <GxGDEP015OC1/GxGDEP015OC1.h> // 1.54" b/w
|
||||
//#include <GxGDEW0213I5F/GxGDEW0213I5F.h> // 2.13" b/w 104x212 flexible
|
||||
//#include <GxGDE0213B1/GxGDE0213B1.h> // 2.13" b/w
|
||||
#include <GxGDEH0213B72/GxGDEH0213B72.h> // 2.13" b/w new panel
|
||||
//#include <GxGDEH029A1/GxGDEH029A1.h> // 2.9" b/w
|
||||
//#include <GxGDEW029T5/GxGDEW029T5.h> // 2.9" b/w IL0373
|
||||
//#include <GxGDEW027W3/GxGDEW027W3.h> // 2.7" b/w
|
||||
//#include <GxGDEW042T2/GxGDEW042T2.h> // 4.2" b/w
|
||||
// these displays do not fully support partial update
|
||||
//#include <GxGDEW0154Z17/GxGDEW0154Z17.h> // 1.54" b/w/r 152x152
|
||||
//#include <GxGDEW0213Z16/GxGDEW0213Z16.h> // 2.13" b/w/r
|
||||
//#include <GxGDEW029Z10/GxGDEW029Z10.h> // 2.9" b/w/r
|
||||
//#include <GxGDEW027C44/GxGDEW027C44.h> // 2.7" b/w/r
|
||||
//#include <GxGDEW042Z15/GxGDEW042Z15.h> // 4.2" b/w/r
|
||||
//#include <GxGDEW0583T7/GxGDEW0583T7.h> // 5.83" b/w
|
||||
//#include <GxGDEW075T8/GxGDEW075T8.h> // 7.5" b/w
|
||||
//#include <GxGDEW075Z09/GxGDEW075Z09.h> // 7.5" b/w/r
|
||||
|
||||
// FreeFonts from Adafruit_GFX
|
||||
#include <FreeMonoBold9pt7b.h>
|
||||
|
||||
#include GxEPD_BitmapExamples
|
||||
|
||||
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
|
||||
#include <GxIO/GxIO.h>
|
||||
|
||||
GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ A1, /*RST=*/ A0);
|
||||
GxEPD_Class display(io, /*RST=*/ A0, /*BUSY=*/ D4);
|
||||
|
||||
//#define DEMO_DELAY 3*60 // seconds
|
||||
//#define DEMO_DELAY 1*60 // seconds
|
||||
#define DEMO_DELAY 30
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println();
|
||||
Serial.println("setup");
|
||||
display.init(115200); // enable diagnostic output on Serial
|
||||
Serial.println("setup done");
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
#if defined(__AVR) || false
|
||||
showPartialUpdatePaged();
|
||||
#elif defined(_GxGDEW075Z09_H_) && (defined(ESP8266) || defined(ARDUINO_ARCH_STM32F1))
|
||||
showPartialUpdatePaged();
|
||||
#elif defined(_GxGDEW075Z09_H_)
|
||||
showPartialUpdate_75Z09();
|
||||
#else
|
||||
showPartialUpdate();
|
||||
#endif
|
||||
delay(DEMO_DELAY * 1000);
|
||||
}
|
||||
|
||||
#if !defined(__AVR)
|
||||
|
||||
void showPartialUpdate()
|
||||
{
|
||||
// use asymmetric values for test
|
||||
uint16_t box_x = 10;
|
||||
uint16_t box_y = 15;
|
||||
uint16_t box_w = 70;
|
||||
uint16_t box_h = 20;
|
||||
uint16_t cursor_y = box_y + box_h - 6;
|
||||
float value = 13.95;
|
||||
display.setFont(&FreeMonoBold9pt7b);
|
||||
display.setTextColor(GxEPD_BLACK);
|
||||
display.setRotation(0);
|
||||
// draw background
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.update();
|
||||
delay(2000);
|
||||
|
||||
// partial update to full screen to preset for partial update of box window
|
||||
// (this avoids strange background effects)
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);
|
||||
|
||||
// show where the update box is
|
||||
for (uint16_t r = 0; r < 4; r++)
|
||||
{
|
||||
display.setRotation(r);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
delay(1000);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
}
|
||||
// show updates in the update box
|
||||
for (uint16_t r = 0; r < 4; r++)
|
||||
{
|
||||
// reset the background
|
||||
display.setRotation(0);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);
|
||||
display.setRotation(r);
|
||||
for (uint16_t i = 1; i <= 10; i++)
|
||||
{
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.setCursor(box_x, cursor_y);
|
||||
display.print(value * i, 2);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
delay(2000);
|
||||
}
|
||||
delay(2000);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
}
|
||||
// should have checked this, too
|
||||
box_x = GxEPD_HEIGHT - box_x - box_w - 1; // not valid for all corners
|
||||
// should show on right side of long side
|
||||
// reset the background
|
||||
display.setRotation(0);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);
|
||||
// show where the update box is
|
||||
for (uint16_t r = 0; r < 4; r++)
|
||||
{
|
||||
display.setRotation(r);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
delay(1000);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
}
|
||||
// show updates in the update box
|
||||
for (uint16_t r = 0; r < 4; r++)
|
||||
{
|
||||
// reset the background
|
||||
display.setRotation(0);
|
||||
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
|
||||
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);
|
||||
display.setRotation(r);
|
||||
if (box_x >= display.width()) continue; // avoid delay
|
||||
for (uint16_t i = 1; i <= 10; i++)
|
||||
{
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.setCursor(box_x, cursor_y);
|
||||
display.print(value * i, 2);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
delay(2000);
|
||||
}
|
||||
delay(2000);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
}
|
||||
display.setRotation(0);
|
||||
display.powerDown();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_GxGDEW075Z09_H_) && !(defined(ESP8266) || defined(ARDUINO_ARCH_STM32F1))
|
||||
|
||||
void showPartialUpdate_75Z09()
|
||||
{
|
||||
// use asymmetric values for test
|
||||
uint16_t box_x = 10;
|
||||
uint16_t box_y = 15;
|
||||
uint16_t box_w = 70;
|
||||
uint16_t box_h = 20;
|
||||
uint16_t cursor_y = box_y + box_h - 6;
|
||||
float value = 13.95;
|
||||
display.setFont(&FreeMonoBold9pt7b);
|
||||
display.setTextColor(GxEPD_BLACK);
|
||||
display.setRotation(0);
|
||||
// draw background, partial update to full screen to preset for partial update of box window
|
||||
// (updateWindow() would clear display if partial update not set, to avoid strange background effect)
|
||||
display.drawExamplePicture_3C(BitmapPicture_3C, sizeof(BitmapPicture_3C), GxEPD::bm_partial_update);
|
||||
// show where the update box is
|
||||
for (uint16_t r = 0; r < 4; r++)
|
||||
{
|
||||
display.setRotation(r);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
delay(1000);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
}
|
||||
// show updates in the update box
|
||||
for (uint16_t r = 0; r < 4; r++)
|
||||
{
|
||||
// reset the background
|
||||
display.setRotation(0);
|
||||
display.drawExamplePicture_3C(BitmapPicture_3C, sizeof(BitmapPicture_3C), GxEPD::bm_partial_update);
|
||||
display.setRotation(r);
|
||||
for (uint16_t i = 1; i <= 10; i++)
|
||||
{
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.setCursor(box_x, cursor_y);
|
||||
display.print(value * i, 2);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
delay(2000);
|
||||
}
|
||||
delay(2000);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
}
|
||||
// should have checked this, too
|
||||
box_x = GxEPD_HEIGHT - box_x - box_w - 1; // not valid for all corners
|
||||
// should show on right side of long side
|
||||
// reset the background
|
||||
display.setRotation(0);
|
||||
display.drawExamplePicture_3C(BitmapPicture_3C, sizeof(BitmapPicture_3C), GxEPD::bm_partial_update);
|
||||
// show where the update box is
|
||||
for (uint16_t r = 0; r < 4; r++)
|
||||
{
|
||||
display.setRotation(r);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
delay(1000);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
}
|
||||
// show updates in the update box
|
||||
for (uint16_t r = 0; r < 4; r++)
|
||||
{
|
||||
// reset the background
|
||||
display.setRotation(0);
|
||||
display.drawExamplePicture_3C(BitmapPicture_3C, sizeof(BitmapPicture_3C), GxEPD::bm_partial_update);
|
||||
display.setRotation(r);
|
||||
if (box_x >= display.width()) continue; // avoid delay
|
||||
for (uint16_t i = 1; i <= 10; i++)
|
||||
{
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.setCursor(box_x, cursor_y);
|
||||
display.print(value * i, 2);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
delay(2000);
|
||||
}
|
||||
delay(2000);
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.updateWindow(box_x, box_y, box_w, box_h, true);
|
||||
}
|
||||
display.setRotation(0);
|
||||
display.powerDown();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__AVR) || defined(_GxGDEW075Z09_H_) && (defined(ESP8266) || defined(ARDUINO_ARCH_STM32F1)) || false
|
||||
|
||||
// modified to avoid float; reduces program size ~2k (for GxGDEW042T2)
|
||||
|
||||
void showBlackBoxCallback(uint32_t v)
|
||||
{
|
||||
uint16_t box_x = 10;
|
||||
uint16_t box_y = 15;
|
||||
uint16_t box_w = 70;
|
||||
uint16_t box_h = 20;
|
||||
display.fillRect(box_x, box_y, box_w, box_h, v);
|
||||
}
|
||||
|
||||
void showValueBoxCallback(const uint32_t v)
|
||||
{
|
||||
uint16_t box_x = 10;
|
||||
uint16_t box_y = 15;
|
||||
uint16_t box_w = 70;
|
||||
uint16_t box_h = 20;
|
||||
uint16_t cursor_y = box_y + box_h - 6;
|
||||
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
display.setCursor(box_x, cursor_y);
|
||||
display.print(v / 100);
|
||||
display.print(v % 100 > 9 ? "." : ".0");
|
||||
display.print(v % 100);
|
||||
}
|
||||
|
||||
void showPartialUpdatePaged()
|
||||
{
|
||||
uint16_t box_x = 10;
|
||||
uint16_t box_y = 15;
|
||||
uint16_t box_w = 70;
|
||||
uint16_t box_h = 20;
|
||||
uint16_t cursor_y = box_y + box_h - 6;
|
||||
uint32_t value = 1395;
|
||||
display.setFont(&FreeMonoBold9pt7b);
|
||||
display.setTextColor(GxEPD_BLACK);
|
||||
display.setRotation(0);
|
||||
// draw background
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
|
||||
delay(2000);
|
||||
|
||||
// partial update to full screen to preset for partial update of box window
|
||||
// (this avoids strange background effects)
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1), GxEPD::bm_default | GxEPD::bm_partial_update);
|
||||
delay(1000);
|
||||
|
||||
// show where the update box is
|
||||
for (uint16_t r = 0; r < 4; r++)
|
||||
{
|
||||
display.setRotation(r);
|
||||
display.drawPagedToWindow(showBlackBoxCallback, box_x, box_y, box_w, box_h, GxEPD_BLACK);
|
||||
delay(1000);
|
||||
display.drawPagedToWindow(showBlackBoxCallback, box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
}
|
||||
|
||||
// show updates in the update box
|
||||
for (uint16_t r = 0; r < 4; r++)
|
||||
{
|
||||
// reset the background
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1), GxEPD::bm_default | GxEPD::bm_partial_update);
|
||||
display.setRotation(r);
|
||||
for (uint16_t i = 1; i <= 10; i++)
|
||||
{
|
||||
uint32_t v = value * i;
|
||||
display.drawPagedToWindow(showValueBoxCallback, box_x, box_y, box_w, box_h, v);
|
||||
delay(500);
|
||||
}
|
||||
delay(1000);
|
||||
display.drawPagedToWindow(showBlackBoxCallback, box_x, box_y, box_w, box_h, GxEPD_WHITE);
|
||||
}
|
||||
// reset the background
|
||||
display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1), GxEPD::bm_default | GxEPD::bm_partial_update);
|
||||
display.setRotation(0);
|
||||
display.powerDown();
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user