Compare commits

...

3 commits
master ... T94

Author SHA1 Message Date
ladyada
cae2506c50 will look later 2024-06-17 11:02:26 -04:00
ladyada
7ceba0d332 actual code 2023-12-24 00:51:51 -05:00
ladyada
2db46a36d4 T94 working monochromatically 2023-12-24 00:25:38 -05:00
8 changed files with 180 additions and 36 deletions

View file

@ -11,19 +11,19 @@
#ifdef ARDUINO_ADAFRUIT_FEATHER_RP2040_THINKINK // detects if compiling for #ifdef ARDUINO_ADAFRUIT_FEATHER_RP2040_THINKINK // detects if compiling for
// Feather RP2040 ThinkInk // Feather RP2040 ThinkInk
#define EPD_DC PIN_EPD_DC // ThinkInk 24-pin connector DC #define EPD_DC PIN_EPD_DC // ThinkInk 24-pin connector DC
#define EPD_CS PIN_EPD_CS // ThinkInk 24-pin connector CS #define EPD_CS PIN_EPD_CS // ThinkInk 24-pin connector CS
#define EPD_BUSY PIN_EPD_BUSY // ThinkInk 24-pin connector Busy #define EPD_BUSY PIN_EPD_BUSY // ThinkInk 24-pin connector Busy
#define SRAM_CS -1 // use onboard RAM #define SRAM_CS -1 // use onboard RAM
#define EPD_RESET PIN_EPD_RESET // ThinkInk 24-pin connector Reset #define EPD_RESET PIN_EPD_RESET // ThinkInk 24-pin connector Reset
#define EPD_SPI &SPI1 // secondary SPI for ThinkInk #define EPD_SPI &SPI1 // secondary SPI for ThinkInk
#else #else
#define EPD_DC 10 #define EPD_DC 10
#define EPD_CS 9 #define EPD_CS 9
#define EPD_BUSY 7 // can set to -1 to not use a pin (will wait a fixed delay) #define EPD_BUSY 7 // can set to -1 to not use a pin (will wait a fixed delay)
#define SRAM_CS 6 #define SRAM_CS 6
#define EPD_RESET 8 // can set to -1 and share with microcontroller Reset! #define EPD_RESET 8 // can set to -1 and share with microcontroller Reset!
#define EPD_SPI &SPI // primary SPI #define EPD_SPI &SPI // primary SPI
#endif #endif
// ThinkInk_154_Grayscale4_T8 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, // ThinkInk_154_Grayscale4_T8 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS,
@ -31,8 +31,11 @@
// EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI); // EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);
// 2.9" Grayscale Featherwing or Breakout: // 2.9" Grayscale Featherwing or Breakout:
ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);
EPD_SPI);
// 2.9" Grayscale Featherwing or Breakout with SSD1680
ThinkInk_290_Grayscale4_T94 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);
// 4.2" Grayscale display // 4.2" Grayscale display
// ThinkInk_420_Grayscale4_T2 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, // ThinkInk_420_Grayscale4_T2 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS,
// EPD_BUSY, EPD_SPI); // EPD_BUSY, EPD_SPI);

View file

@ -11,19 +11,19 @@
#ifdef ARDUINO_ADAFRUIT_FEATHER_RP2040_THINKINK // detects if compiling for #ifdef ARDUINO_ADAFRUIT_FEATHER_RP2040_THINKINK // detects if compiling for
// Feather RP2040 ThinkInk // Feather RP2040 ThinkInk
#define EPD_DC PIN_EPD_DC // ThinkInk 24-pin connector DC #define EPD_DC PIN_EPD_DC // ThinkInk 24-pin connector DC
#define EPD_CS PIN_EPD_CS // ThinkInk 24-pin connector CS #define EPD_CS PIN_EPD_CS // ThinkInk 24-pin connector CS
#define EPD_BUSY PIN_EPD_BUSY // ThinkInk 24-pin connector Busy #define EPD_BUSY PIN_EPD_BUSY // ThinkInk 24-pin connector Busy
#define SRAM_CS -1 // use onboard RAM #define SRAM_CS -1 // use onboard RAM
#define EPD_RESET PIN_EPD_RESET // ThinkInk 24-pin connector Reset #define EPD_RESET PIN_EPD_RESET // ThinkInk 24-pin connector Reset
#define EPD_SPI &SPI1 // secondary SPI for ThinkInk #define EPD_SPI &SPI1 // secondary SPI for ThinkInk
#else #else
#define EPD_DC 10 #define EPD_DC 10
#define EPD_CS 9 #define EPD_CS 9
#define EPD_BUSY 7 // can set to -1 to not use a pin (will wait a fixed delay) #define EPD_BUSY 7 // can set to -1 to not use a pin (will wait a fixed delay)
#define SRAM_CS 6 #define SRAM_CS 6
#define EPD_RESET 8 // can set to -1 and share with microcontroller Reset! #define EPD_RESET 8 // can set to -1 and share with microcontroller Reset!
#define EPD_SPI &SPI // primary SPI #define EPD_SPI &SPI // primary SPI
#endif #endif
// 1.54" Monochrome displays with 200x200 pixels and SSD1681 chipset // 1.54" Monochrome displays with 200x200 pixels and SSD1681 chipset
@ -36,7 +36,7 @@
// ThinkInk_154_Mono_M10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI); // ThinkInk_154_Mono_M10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);
// 2.13" Monochrome displays with 250x122 pixels and SSD1675 chipset // 2.13" Monochrome displays with 250x122 pixels and SSD1675 chipset
ThinkInk_213_Mono_B72 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI); //ThinkInk_213_Mono_B72 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);
// 2.13" Monochrome displays with 250x122 pixels and SSD1675B chipset // 2.13" Monochrome displays with 250x122 pixels and SSD1675B chipset
// ThinkInk_213_Mono_B73 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI); // ThinkInk_213_Mono_B73 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);
@ -48,10 +48,11 @@ ThinkInk_213_Mono_B72 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_
// 2.13" Monochrome displays with 212x104 pixels and UC8151D chipset // 2.13" Monochrome displays with 212x104 pixels and UC8151D chipset
// ThinkInk_213_Mono_M21 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI); // ThinkInk_213_Mono_M21 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);
// 2.9" 4-level Grayscale (use mono) displays with 296x128 pixels and IL0373 // 2.9" 4-level Grayscale (use mono) displays with 296x128 pixels and IL0373 chipset
// chipset // ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);
// ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS,
// EPD_BUSY, EPD_SPI); // 2.9" 4-level Grayscale (use mono) displays with 296x128 pixels and SSD1680 chipset
ThinkInk_290_Grayscale4_T94 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);
// 2.9" Monochrome displays with 296x128 pixels and UC8151D chipset // 2.9" Monochrome displays with 296x128 pixels and UC8151D chipset
// ThinkInk_290_Mono_M06 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI); // ThinkInk_290_Mono_M06 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);

View file

@ -521,9 +521,8 @@ void Adafruit_EPD::EPD_commandList(const uint8_t *init_code) {
continue; continue;
} }
if (num_args > sizeof(buf)) { if (num_args > sizeof(buf)) {
Serial.println("ERROR - buf not large enough!"); Serial.println("ERROR - buf not large enough, trying to send manually");
while (1) return EPD_command(cmd, init_code, num_args);
delay(10);
} }
for (int i = 0; i < num_args; i++) { for (int i = 0; i < num_args; i++) {

View file

@ -20,7 +20,7 @@
#ifndef _ADAFRUIT_EPD_H_ #ifndef _ADAFRUIT_EPD_H_
#define _ADAFRUIT_EPD_H_ #define _ADAFRUIT_EPD_H_
//#define EPD_DEBUG #define EPD_DEBUG
#define RAMBUFSIZE 64 ///< size of the ram buffer #define RAMBUFSIZE 64 ///< size of the ram buffer

View file

@ -21,6 +21,7 @@
#include "panels/ThinkInk_213_Grayscale4_T5.h" #include "panels/ThinkInk_213_Grayscale4_T5.h"
#include "panels/ThinkInk_270_Grayscale4_W3.h" #include "panels/ThinkInk_270_Grayscale4_W3.h"
#include "panels/ThinkInk_290_Grayscale4_T5.h" #include "panels/ThinkInk_290_Grayscale4_T5.h"
#include "panels/ThinkInk_290_Grayscale4_T94.h"
#include "panels/ThinkInk_420_Grayscale4_T2.h" #include "panels/ThinkInk_420_Grayscale4_T2.h"
#include "panels/ThinkInk_154_Mono_D27.h" #include "panels/ThinkInk_154_Mono_D27.h"

View file

@ -139,7 +139,7 @@ void Adafruit_SSD1680::update() {
uint8_t buf[1]; uint8_t buf[1];
// display update sequence // display update sequence
buf[0] = 0xF4; buf[0] = 0xC7;
EPD_command(SSD1680_DISP_CTRL2, buf, 1); EPD_command(SSD1680_DISP_CTRL2, buf, 1);
EPD_command(SSD1680_MASTER_ACTIVATE); EPD_command(SSD1680_MASTER_ACTIVATE);
@ -169,6 +169,10 @@ void Adafruit_SSD1680::powerUp() {
} }
EPD_commandList(init_code); EPD_commandList(init_code);
if (_epd_lut_code) {
EPD_commandList(_epd_lut_code);
}
uint8_t height = HEIGHT; uint8_t height = HEIGHT;
if ((height % 8) != 0) { if ((height % 8) != 0) {
height += 8 - (height % 8); height += 8 - (height % 8);
@ -178,6 +182,7 @@ void Adafruit_SSD1680::powerUp() {
buf[0] = _xram_offset; buf[0] = _xram_offset;
buf[1] = height / 8 - 1 + _xram_offset; buf[1] = height / 8 - 1 + _xram_offset;
EPD_command(SSD1680_SET_RAMXPOS, buf, 2); EPD_command(SSD1680_SET_RAMXPOS, buf, 2);
//Serial.printf("set XRAM 0x%x 0x%x\n\r", buf[1], buf[0]);
// Set ram Y start/end postion // Set ram Y start/end postion
buf[0] = 0x00; buf[0] = 0x00;
@ -185,6 +190,7 @@ void Adafruit_SSD1680::powerUp() {
buf[2] = (WIDTH - 1); buf[2] = (WIDTH - 1);
buf[3] = (WIDTH - 1) >> 8; buf[3] = (WIDTH - 1) >> 8;
EPD_command(SSD1680_SET_RAMYPOS, buf, 4); EPD_command(SSD1680_SET_RAMYPOS, buf, 4);
//Serial.printf("set YRAM 0x00, 0x%x 0x%x\n\r", buf[3], buf[2]);
// Set LUT // Set LUT
/* /*

View file

@ -30,6 +30,8 @@
#define SSD1680_SET_RAMYPOS 0x45 #define SSD1680_SET_RAMYPOS 0x45
#define SSD1680_SET_RAMXCOUNT 0x4E #define SSD1680_SET_RAMXCOUNT 0x4E
#define SSD1680_SET_RAMYCOUNT 0x4F #define SSD1680_SET_RAMYCOUNT 0x4F
#define SSD1680_SET_ANALOGBLOCKCTRL 0x74
#define SSD1680_SET_DIGITBLOCKCTRL 0x7E
/**************************************************************************/ /**************************************************************************/
/*! /*!

View file

@ -0,0 +1,132 @@
#ifndef _THINKINK_290_GRAY4_T94_H
#define _THINKINK_290_GRAY4_T94_H
// This file is #included by Adafruit_ThinkInk.h and does not need to
// #include anything else to pick up the EPD header or ink mode enum.
const uint8_t ti_290t94_gray4_lut_code[156] = {
// gray LUT
0x32, 153,
0x40, 0x48, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x8, 0x48, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x2, 0x48, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x20, 0x48, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0xA, 0x19, 0x0, 0x3, 0x8, 0x0, 0x0,
0x14, 0x1, 0x0, 0x14, 0x1, 0x0, 0x3,
0xA, 0x3, 0x0, 0x8, 0x19, 0x0, 0x0,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x0, 0x0, 0x0,
0xFE // EOM
};
static const uint8_t ti_290t94_monofull_init_code[] {
SSD1680_SW_RESET, 0, // soft reset
0xFF, 20, // busy wait
SSD1680_DATA_MODE, 1, 0x03, // Ram data entry mode
SSD1680_WRITE_BORDER, 1, 0x05, //BorderWavefrom
SSD1680_WRITE_VCOM, 1, 0x36, // Vcom Voltage
SSD1680_GATE_VOLTAGE, 1, 0x17, // Set gate voltage
SSD1680_SOURCE_VOLTAGE, 3, 0x41, 0x00, 0x32, // Set source voltage
SSD1680_DRIVER_CONTROL, 3, 0x27, 0x01, 0x00, //Driver output control
SSD1680_DISP_CTRL1, 2, 0x00, 0x80, //Display update control
SSD1680_TEMP_CONTROL, 1, 0x80, //Read built-in temperature sensor
SSD1680_SET_RAMXCOUNT, 1, 0x00, //set RAM x address count to 0
SSD1680_SET_RAMYCOUNT, 2, 0x27, 0x01, //set RAM y address count to 0X199
0xFE // EOM
};
static const uint8_t ti_290t94_gray4_init_code[] {
SSD1680_SW_RESET, 0, // soft reset
0xFF, 20, // busy wait
SSD1680_SET_ANALOGBLOCKCTRL, 1, 0x54, //set analog block control
SSD1680_SET_DIGITBLOCKCTRL, 1, 0x3B, //set digital block control
SSD1680_DRIVER_CONTROL, 3, 0x27, 0x01, 0x00, //Driver output control
SSD1680_DATA_MODE, 1, 0x03, //data entry mode
SSD1680_SET_RAMXPOS, 2, 0x00, 0x0F, //set Ram-X address start/end position
SSD1680_SET_RAMYPOS, 4, 0x27, 0x01, 0x00, 0x00, //set Ram-Y address start/end position
SSD1680_WRITE_BORDER, 1, 0x00, //BorderWavefrom
SSD1680_WRITE_VCOM, 1, 0x1C,
0x3F, 1, 0x22, //EOPQ
SSD1680_GATE_VOLTAGE, 1, 0x17, //VGH
SSD1680_SOURCE_VOLTAGE, 3, 0x41, 0x0, 0x32, // VSH1, VSH2, VSL
SSD1680_DISP_CTRL1, 2, 0x00, 0x80, //Display update control
//SSD1680_TEMP_CONTROL, 1, 0x80, //Read built-in temperature sensor
SSD1680_SET_RAMXCOUNT, 1, 0x00, //set RAM x address count to 0
SSD1680_SET_RAMYCOUNT, 2, 0x27, 0x01, //set RAM y address count to 0X199
0xFE // EOM
};
class ThinkInk_290_Grayscale4_T94 : public Adafruit_SSD1680 {
public:
ThinkInk_290_Grayscale4_T94(int16_t SID, int16_t SCLK, int16_t DC, int16_t RST,
int16_t CS, int16_t SRCS, int16_t MISO,
int16_t BUSY = -1)
: Adafruit_SSD1680(296, 128, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){};
ThinkInk_290_Grayscale4_T94(int16_t DC, int16_t RST, int16_t CS, int16_t SRCS,
int16_t BUSY = -1, SPIClass *spi = &SPI)
: Adafruit_SSD1680(296, 128, DC, RST, CS, SRCS, BUSY, spi){};
void begin(thinkinkmode_t mode = THINKINK_MONO) {
Adafruit_SSD1680::begin(true);
setColorBuffer(0, true); // layer 0 uninverted
setBlackBuffer(0, true); // only one buffer
inkmode = mode; // Preserve ink mode for ImageReader or others
if (mode == THINKINK_GRAYSCALE4) {
_xram_offset = 0;
_epd_init_code = ti_290t94_gray4_init_code;
_epd_lut_code = ti_290t94_gray4_lut_code;
layer_colors[EPD_WHITE] = 0b00;
layer_colors[EPD_BLACK] = 0b11;
layer_colors[EPD_RED] = 0b01;
layer_colors[EPD_GRAY] = 0b10;
layer_colors[EPD_LIGHT] = 0b01;
layer_colors[EPD_DARK] = 0b10;
default_refresh_delay = 2000;
} else if (mode == THINKINK_MONO) {
_xram_offset = 0;
_epd_init_code = ti_290t94_monofull_init_code;
layer_colors[EPD_WHITE] = 0b00;
layer_colors[EPD_BLACK] = 0b01;
layer_colors[EPD_RED] = 0b01;
layer_colors[EPD_GRAY] = 0b01;
layer_colors[EPD_LIGHT] = 0b00;
layer_colors[EPD_DARK] = 0b01;
default_refresh_delay = 500;
}
setRotation(0);
powerDown();
}
};
#endif // _THINKINK_290_GRAY4_T94_H