will look later

This commit is contained in:
ladyada 2024-06-17 11:02:26 -04:00
parent 7ceba0d332
commit cae2506c50
6 changed files with 54 additions and 45 deletions

View file

@ -31,8 +31,11 @@
// EPD_CS, SRAM_CS, EPD_BUSY, EPD_SPI);
// 2.9" Grayscale Featherwing or Breakout:
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" 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
// ThinkInk_420_Grayscale4_T2 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;
}
if (num_args > sizeof(buf)) {
Serial.println("ERROR - buf not large enough!");
while (1)
delay(10);
Serial.println("ERROR - buf not large enough, trying to send manually");
return EPD_command(cmd, init_code, num_args);
}
for (int i = 0; i < num_args; i++) {

View file

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

View file

@ -139,7 +139,7 @@ void Adafruit_SSD1680::update() {
uint8_t buf[1];
// display update sequence
buf[0] = 0xF4;
buf[0] = 0xC7;
EPD_command(SSD1680_DISP_CTRL2, buf, 1);
EPD_command(SSD1680_MASTER_ACTIVATE);
@ -169,6 +169,10 @@ void Adafruit_SSD1680::powerUp() {
}
EPD_commandList(init_code);
if (_epd_lut_code) {
EPD_commandList(_epd_lut_code);
}
uint8_t height = HEIGHT;
if ((height % 8) != 0) {
height += 8 - (height % 8);

View file

@ -31,7 +31,7 @@
#define SSD1680_SET_RAMXCOUNT 0x4E
#define SSD1680_SET_RAMYCOUNT 0x4F
#define SSD1680_SET_ANALOGBLOCKCTRL 0x74
#define SSD1680_SET_DIGITBLOCKCTRL 0x74
#define SSD1680_SET_DIGITBLOCKCTRL 0x7E
/**************************************************************************/
/*!

View file

@ -4,7 +4,9 @@
// 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[153] = {
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,
@ -23,6 +25,8 @@ const uint8_t ti_290t94_gray4_lut_code[153] = {
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[] {
@ -44,15 +48,19 @@ static const uint8_t ti_290t94_monofull_init_code[] {
};
static const uint8_t ti_290t94_grayfull_init_code[] {
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, 0x01, //data entry mode
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,
@ -60,29 +68,12 @@ static const uint8_t ti_290t94_grayfull_init_code[] {
SSD1680_GATE_VOLTAGE, 1, 0x17, //VGH
SSD1680_SOURCE_VOLTAGE, 3, 0x41, 0x0, 0x32, // VSH1, VSH2, VSL
// 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,
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
};
@ -104,7 +95,20 @@ public:
inkmode = mode; // Preserve ink mode for ImageReader or others
if (mode == THINKINK_MONO) {
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;
@ -119,7 +123,6 @@ public:
default_refresh_delay = 500;
}
setRotation(0);
powerDown();
}