129 lines
4.5 KiB
C++
129 lines
4.5 KiB
C++
/***************************************************
|
|
Adafruit invests time and resources providing this open source code,
|
|
please support Adafruit and open-source hardware by purchasing
|
|
products from Adafruit!
|
|
|
|
Written by Limor Fried/Ladyada for Adafruit Industries.
|
|
MIT license, all text above must be included in any redistribution
|
|
****************************************************/
|
|
|
|
#include "Adafruit_ThinkInk.h"
|
|
|
|
#ifdef ESP8266
|
|
#define SRAM_CS 16
|
|
#define EPD_CS 0
|
|
#define EPD_DC 15
|
|
#endif
|
|
#ifdef ESP32
|
|
#define SRAM_CS 32
|
|
#define EPD_CS 15
|
|
#define EPD_DC 33
|
|
#endif
|
|
#if defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined(ARDUINO_FEATHER_M4) || defined (__AVR_ATmega328P__) || defined(ARDUINO_NRF52840_FEATHER)
|
|
#define SRAM_CS 6
|
|
#define EPD_CS 9
|
|
#define EPD_DC 10
|
|
#endif
|
|
#ifdef TEENSYDUINO
|
|
#define SRAM_CS 3
|
|
#define EPD_CS 4
|
|
#define EPD_DC 10
|
|
#endif
|
|
#ifdef ARDUINO_STM32_FEATHER
|
|
#define TFT_DC PB4
|
|
#define TFT_CS PA15
|
|
#define STMPE_CS PC7
|
|
#endif
|
|
#ifdef ARDUINO_NRF52832_FEATHER
|
|
#define SRAM_CS 30
|
|
#define EPD_CS 31
|
|
#define EPD_DC 11
|
|
#endif
|
|
#ifdef ARDUINO_ADAFRUIT_FEATHER_RP2040
|
|
#define SRAM_CS 8
|
|
#define EPD_CS 9
|
|
#define EPD_DC 10
|
|
#endif
|
|
|
|
#define EPD_RESET -1 // can set to -1 and share with microcontroller Reset!
|
|
#define EPD_BUSY -1 // can set to -1 to not use a pin (will wait a fixed delay)
|
|
|
|
// Uncomment the following line if you are using 2.13" Monochrome EPD with SSD1680
|
|
ThinkInk_213_Mono_BN display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
|
|
//ThinkInk_213_Mono_B74 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
|
|
|
|
// Uncomment the following line if you are using 2.13" Tri-Color EPD with SSD1680
|
|
//ThinkInk_213_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
|
|
|
|
// Uncomment the following line if you are using 2.13" EPD with SSD1675
|
|
// ThinkInk_213_Mono_B72 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
|
|
|
|
// Uncomment the following line if you are using 2.13" EPD with SSD1675B
|
|
//ThinkInk_213_Mono_B73 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
|
|
|
|
// Uncomment the following line if you are using 2.13" EPD with UC8151D
|
|
//ThinkInk_213_Mono_M21 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
|
|
|
|
//Uncomment the following line if you are using 2.13" EPD with IL0373
|
|
//ThinkInk_213_Tricolor_Z16 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
|
|
//#define FLEXIBLE_213
|
|
|
|
// Uncomment the following line if you are using 2.9" Tri-Color EPD with IL0373
|
|
//ThinkInk_290_Tricolor_Z10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
|
|
|
|
// Uncomment the following line if you are using 2.9" Grayscale EPD with IL0373
|
|
//ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
|
|
//#define FLEXIBLE_290
|
|
|
|
// Uncomment the following line if you are using 2.9" Monochrome EPD with UC8151D
|
|
//ThinkInk_290_Mono_M06 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
|
|
|
|
// Uncomment the following line if you are using 2.9" Tri-Color EPD with UC8151D
|
|
//ThinkInk_290_Tricolor_Z13 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
|
|
|
|
#define COLOR1 EPD_BLACK
|
|
#define COLOR2 EPD_RED
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
//while (!Serial) { delay(10); }
|
|
Serial.println("2.13 inch EInk Featherwing test");
|
|
|
|
display.begin();
|
|
|
|
#if defined(FLEXIBLE_213) || defined(FLEXIBLE_290)
|
|
// The flexible displays have different buffers and invert settings!
|
|
display.setBlackBuffer(1, false);
|
|
display.setColorBuffer(1, false);
|
|
#endif
|
|
|
|
// large block of text
|
|
display.clearBuffer();
|
|
testdrawtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ", COLOR1);
|
|
display.display();
|
|
|
|
delay(5000);
|
|
|
|
display.clearBuffer();
|
|
for (int16_t i=0; i<display.width(); i+=4) {
|
|
display.drawLine(0, 0, i, display.height()-1, COLOR1);
|
|
}
|
|
|
|
for (int16_t i=0; i<display.height(); i+=4) {
|
|
display.drawLine(display.width()-1, 0, 0, i, COLOR2); // on grayscale this will be mid-gray
|
|
}
|
|
display.display();
|
|
|
|
}
|
|
|
|
void loop() {
|
|
//don't do anything!
|
|
}
|
|
|
|
|
|
void testdrawtext(const char *text, uint16_t color) {
|
|
display.setCursor(0, 0);
|
|
display.setTextColor(color);
|
|
display.setTextWrap(true);
|
|
display.print(text);
|
|
}
|