Skip to content

Instantly share code, notes, and snippets.

@sidoh
Created November 29, 2017 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sidoh/0cb230508da8a05666795910e6bb589f to your computer and use it in GitHub Desktop.
Save sidoh/0cb230508da8a05666795910e6bb589f to your computer and use it in GitHub Desktop.
#include <GxEPD.h>
// select the display class to use, only one
//#include <GxGDEP015OC1/GxGDEP015OC1.cpp> // 1.54" b/w
// #include <GxGDEW0154Z04/GxGDEW0154Z04.cpp> // 1.54" b/w/r
// #include <GxGDEW0154Z04_Fast.cpp> // 1.54" b/w/r
//#include <GxGDE0213B1/GxGDE0213B1.cpp> // 2.13" b/w
//#include <GxGDEW0213Z16/GxGDEW0213Z16.cpp> // 2.13" b/w/r
// #include <GxGDEH029A1/GxGDEH029A1.cpp> // 2.9" b/w
//#include <GxGDEW029Z10/GxGDEW029Z10.cpp> // 2.9" b/w/r
//#include <GxGDEW027C44/GxGDEW027C44.cpp> // 2.7" b/w/r
//#include <GxGDEW042T2/GxGDEW042T2.cpp> // 4.2" b/w
//#include <GxGDEW075T8/GxGDEW075T8.cpp> // 7.5" b/w
//#include <GxGDEW075Z09/GxGDEW075Z09.cpp> // 7.5" b/w/r
#include <GxGDEW042Z15.h>
// uncomment next line for drawBitmap() test
// #include GxEPD_BitmapExamples
#include <BitmapExamples.h>
// FreeFonts from Adafruit_GFX
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>
#include <Fonts/FreeMonoBold24pt7b.h>
#include <Fonts/FreeSans9pt7b.h>
#include <Fonts/FreeSans18pt7b.h>
#include <Fonts/FreeSans24pt7b.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
// generic/common.h
//static const uint8_t SS = 15;
//static const uint8_t MOSI = 13;
//static const uint8_t MISO = 12;
//static const uint8_t SCK = 14;
// pins_arduino.h
//static const uint8_t D8 = 15;
//static const uint8_t D7 = 13;
//static const uint8_t D6 = 12;
//static const uint8_t D5 = 14;
// GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1);
GxIO_Class io(SPI, SS, D2, D1, D4); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
// GxGDEP015OC1(GxIO& io, uint8_t rst = 2, uint8_t busy = 4);
GxEPD_Class display(io); // default selection of D4(=2), D2(=4)
void showFont(const char name[], const GFXfont* f);
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println("setup");
display.init();
display.eraseDisplay(false);
display.update();
// display.drawRect(0, 0, 100, 100, GxEPD_BLACK);
// display.update();
// display.drawBitmap(BitmapExample2, 0, 0, 200, 200, GxEPD_WHITE);
// display.update();
display.setRotation(1);
display.setFont(&FreeSans18pt7b);
display.setTextColor(GxEPD_BLACK);
display.setCursor(0, 20);
display.println("TEST ");
display.setTextColor(GxEPD_RED);
display.println("TEST ");
display.update();
Serial.println("setup done");
}
int i = 0;
void loop() {
// showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
// display.setFont(&FreeSans9pt7b);
// display.setTextColor(GxEPD_BLACK);
// display.setCursor(0, 20);
//
// String s = "";
//
// for (int x = 0; x < 100; x++) {
// display.fillScreen(GxEPD_WHITE);
// display.drawCircle(2*x,2*x,20,GxEPD_BLACK);
// display.println("abc");
// display.update();
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment