Skip to content

Commit 99dfd57

Browse files
authored
Merge pull request #44 from adafruit/154z90
154z90
2 parents b5b6fcf + ac77977 commit 99dfd57

File tree

6 files changed

+65
-13
lines changed

6 files changed

+65
-13
lines changed

examples/ThinkInk_tricolor/ThinkInk_tricolor.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
#define SRAM_CS 6 // can set to -1 to not use a pin (uses a lot of RAM!)
1616
#define EPD_RESET 8 // can set to -1 and share with chip Reset (can't deep sleep)
1717

18-
// 1.54" Tricolor EPD with SSD1680 chipset
18+
// 1.54" 152x152 Tricolor EPD with ILI0373 chipset
1919
//ThinkInk_154_Tricolor_Z17 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2020

21-
// 1.54" Tricolor EPD with SSD1680 chipset
21+
// 1.54" 152x152 Tricolor EPD with SSD1680 chipset
2222
//ThinkInk_154_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2323

24+
// 1.54" 200x200 Tricolor EPD with SSD1681 chipset
25+
//ThinkInk_154_Tricolor_Z90 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
26+
2427
// 2.13" Tricolor EPD with SSD1680 chipset
2528
//ThinkInk_213_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2629

src/Adafruit_EPD.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void Adafruit_EPD::begin(bool reset) {
158158
sram.write8(0, K640_SEQUENTIAL_MODE, MCPSRAM_WRSR);
159159
}
160160

161-
Serial.println("set pins");
161+
// Serial.println("set pins");
162162
// set pin directions
163163
pinMode(_dc_pin, OUTPUT);
164164
pinMode(_cs_pin, OUTPUT);
@@ -176,16 +176,16 @@ void Adafruit_EPD::begin(bool reset) {
176176
return;
177177
}
178178

179-
Serial.println("hard reset");
179+
// Serial.println("hard reset");
180180
if (reset) {
181181
hardwareReset();
182182
}
183183

184-
Serial.println("busy");
184+
// Serial.println("busy");
185185
if (_busy_pin >= 0) {
186186
pinMode(_busy_pin, INPUT);
187187
}
188-
Serial.println("done!");
188+
// Serial.println("done!");
189189
}
190190

191191
/**************************************************************************/
@@ -313,7 +313,6 @@ void Adafruit_EPD::writeSRAMFramebufferToEPD(uint16_t SRAM_buffer_addr,
313313
uint8_t EPDlocation,
314314
bool invertdata) {
315315
uint8_t c;
316-
317316
// use SRAM
318317
sram.csLow();
319318
// send read command
@@ -327,10 +326,17 @@ void Adafruit_EPD::writeSRAMFramebufferToEPD(uint16_t SRAM_buffer_addr,
327326
c = writeRAMCommand(EPDlocation);
328327

329328
dcHigh();
330-
for (uint16_t i = 0; i < buffer_size; i++) {
329+
for (uint32_t i = 0; i < buffer_size; i++) {
331330
c = SPItransfer(c);
332-
// Serial.print("0x"); Serial.print((byte)c, HEX); Serial.print(", ");
333-
// if (i % 32 == 31) Serial.println();
331+
/*
332+
Serial.print("0x"); Serial.print((byte)c, HEX); Serial.print(", ");
333+
if (i % 32 == 31) {
334+
Serial.println();
335+
Serial.print("$");
336+
Serial.print(i, HEX);
337+
Serial.print(": ");
338+
}
339+
*/
334340
}
335341
csHigh();
336342
sram.csHigh();
@@ -358,8 +364,14 @@ void Adafruit_EPD::display(bool sleep) {
358364
setRAMAddress(0, 0);
359365

360366
if (use_sram) {
367+
#ifdef EPD_DEBUG
368+
Serial.println(" Write SRAM buff to EPD");
369+
#endif
361370
writeSRAMFramebufferToEPD(buffer1_addr, buffer1_size, 0);
362371
} else {
372+
#ifdef EPD_DEBUG
373+
Serial.println(" Write RAM buff to EPD");
374+
#endif
363375
writeRAMFramebufferToEPD(buffer1, buffer1_size, 0);
364376
}
365377

src/Adafruit_ThinkInk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "panels/ThinkInk_154_Tricolor_RW.h"
77
#include "panels/ThinkInk_154_Tricolor_Z17.h"
8+
#include "panels/ThinkInk_154_Tricolor_Z90.h"
89
#include "panels/ThinkInk_213_Tricolor_RW.h"
910
#include "panels/ThinkInk_213_Tricolor_Z16.h"
1011
#include "panels/ThinkInk_270_Tricolor_C44.h"

src/drivers/Adafruit_SSD1681.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Adafruit_SSD1681::Adafruit_SSD1681(int width, int height, int8_t SID,
4141
height += 8 - (height % 8);
4242
}
4343

44-
buffer1_size = width * height / 8;
44+
buffer1_size = ((uint32_t)width * (uint32_t)height) / 8;
4545
buffer2_size = buffer1_size;
4646

4747
if (SRCS >= 0) {
@@ -79,7 +79,7 @@ Adafruit_SSD1681::Adafruit_SSD1681(int width, int height, int8_t DC, int8_t RST,
7979
height += 8 - (height % 8);
8080
}
8181

82-
buffer1_size = width * height / 8;
82+
buffer1_size = ((uint32_t)width * (uint32_t)height) / 8;
8383
buffer2_size = buffer1_size;
8484

8585
if (SRCS >= 0) {

src/panels/ThinkInk_154_Tricolor_RW.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ThinkInk_154_Tricolor_RW : public Adafruit_SSD1680 {
99
ThinkInk_154_Tricolor_RW(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST,
1010
int8_t CS, int8_t SRCS, int8_t MISO,
1111
int8_t BUSY = -1)
12-
: Adafruit_SSD1680(250, 152, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){};
12+
: Adafruit_SSD1680(152, 152, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){};
1313

1414
ThinkInk_154_Tricolor_RW(int8_t DC, int8_t RST, int8_t CS, int8_t SRCS,
1515
int8_t BUSY = -1, SPIClass *spi = &SPI)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#ifndef _THINKINK_154_TRICOLOR_Z90_H
2+
#define _THINKINK_154_TRICOLOR_Z90_H
3+
4+
// This file is #included by Adafruit_ThinkInk.h and does not need to
5+
// #include anything else to pick up the EPD header or ink mode enum.
6+
7+
class ThinkInk_154_Tricolor_Z90 : public Adafruit_SSD1681 {
8+
public:
9+
ThinkInk_154_Tricolor_Z90(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST,
10+
int8_t CS, int8_t SRCS, int8_t MISO,
11+
int8_t BUSY = -1)
12+
: Adafruit_SSD1681(200, 200, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){};
13+
14+
ThinkInk_154_Tricolor_Z90(int8_t DC, int8_t RST, int8_t CS, int8_t SRCS,
15+
int8_t BUSY = -1, SPIClass *spi = &SPI)
16+
: Adafruit_SSD1681(200, 200, DC, RST, CS, SRCS, BUSY, spi){};
17+
18+
void begin(thinkinkmode_t mode = THINKINK_MONO) {
19+
Adafruit_SSD1681::begin(true);
20+
21+
inkmode = mode; // Preserve ink mode for ImageReader or others
22+
23+
layer_colors[EPD_WHITE] = 0b00;
24+
layer_colors[EPD_BLACK] = 0b01;
25+
layer_colors[EPD_RED] = 0b10;
26+
layer_colors[EPD_GRAY] = 0b10;
27+
layer_colors[EPD_LIGHT] = 0b00;
28+
layer_colors[EPD_DARK] = 0b01;
29+
30+
default_refresh_delay = 13000;
31+
setRotation(3);
32+
powerDown();
33+
}
34+
};
35+
36+
#endif // _THINKINK_154_TRI

0 commit comments

Comments
 (0)