Skip to content

Commit 7a20f80

Browse files
authored
Merge pull request #66 from adafruit/z29tricolor
Z29tricolor
2 parents 43a47c0 + d7079af commit 7a20f80

File tree

5 files changed

+48
-3
lines changed

5 files changed

+48
-3
lines changed

examples/ThinkInk_tricolor/ThinkInk_tricolor.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
ThinkInk_290_Tricolor_Z10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
4141
// 2.9" Tricolor Featherwing or Breakout with UC8151D chipset
4242
//ThinkInk_290_Tricolor_Z13 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
43+
// 2.9" Tricolor Featherwing or Breakout with SSD1680 chipset and negative offset
44+
//ThinkInk_290_Tricolor_Z94 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
4345

4446
//ThinkInk_420_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
4547
//ThinkInk_420_Tricolor_Z21 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);

src/Adafruit_ThinkInk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "panels/ThinkInk_290_Tricolor_RH.h"
1414
#include "panels/ThinkInk_290_Tricolor_Z10.h"
1515
#include "panels/ThinkInk_290_Tricolor_Z13.h"
16+
#include "panels/ThinkInk_290_Tricolor_Z94.h"
1617
#include "panels/ThinkInk_420_Tricolor_RW.h"
1718
#include "panels/ThinkInk_420_Tricolor_Z21.h"
1819

src/drivers/Adafruit_SSD1680.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ void Adafruit_SSD1680::powerUp() {
175175
}
176176

177177
// Set ram X start/end postion
178-
buf[0] = 0x01;
179-
buf[1] = height / 8;
178+
buf[0] = _xram_offset;
179+
buf[1] = height / 8 - 1 + _xram_offset;
180180
EPD_command(SSD1680_SET_RAMXPOS, buf, 2);
181181

182182
// Set ram Y start/end postion
@@ -252,7 +252,7 @@ void Adafruit_SSD1680::setRAMAddress(uint16_t x, uint16_t y) {
252252
uint8_t buf[2];
253253

254254
// set RAM x address count
255-
buf[0] = 1;
255+
buf[0] = _xram_offset;
256256
EPD_command(SSD1680_SET_RAMXCOUNT, buf, 1);
257257

258258
// set RAM y address count

src/drivers/Adafruit_SSD1680.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class Adafruit_SSD1680 : public Adafruit_EPD {
5353
uint8_t writeRAMCommand(uint8_t index);
5454
void setRAMAddress(uint16_t x, uint16_t y);
5555
void busy_wait();
56+
57+
int8_t _xram_offset = 1;
5658
};
5759

5860
#endif
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#ifndef _THINKINK_290_TRICOLOR_Z94_H
2+
#define _THINKINK_290_TRICOLOR_Z94_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_290_Tricolor_Z94 : public Adafruit_SSD1680 {
8+
public:
9+
ThinkInk_290_Tricolor_Z94(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_SSD1680(296, 128, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){};
13+
14+
ThinkInk_290_Tricolor_Z94(int8_t DC, int8_t RST, int8_t CS, int8_t SRCS,
15+
int8_t BUSY = -1, SPIClass *spi = &SPI)
16+
: Adafruit_SSD1680(296, 128, DC, RST, CS, SRCS, BUSY, spi){};
17+
18+
void begin(thinkinkmode_t mode = THINKINK_TRICOLOR) {
19+
_xram_offset = 0;
20+
21+
Adafruit_SSD1680::begin(true);
22+
setBlackBuffer(0, true);
23+
setColorBuffer(1, false);
24+
25+
inkmode = mode; // Preserve ink mode for ImageReader or others
26+
27+
layer_colors[EPD_WHITE] = 0b00;
28+
layer_colors[EPD_BLACK] = 0b01;
29+
layer_colors[EPD_RED] = 0b10;
30+
layer_colors[EPD_GRAY] = 0b10;
31+
layer_colors[EPD_LIGHT] = 0b00;
32+
layer_colors[EPD_DARK] = 0b01;
33+
34+
default_refresh_delay = 13000;
35+
setRotation(0);
36+
powerDown();
37+
}
38+
};
39+
40+
#endif // _THINKINK_290 Z94

0 commit comments

Comments
 (0)