Skip to content

Commit 92e5db8

Browse files
authored
Merge pull request #45 from adafruit/ucfixes
turns out this chip does not like being powered down twice in a row.
2 parents 8173e79 + 72d330e commit 92e5db8

File tree

7 files changed

+95
-3
lines changed

7 files changed

+95
-3
lines changed

examples/ThinkInk_mono/ThinkInk_mono.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,14 @@ ThinkInk_213_Mono_B72 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
4545
// 2.9" Monochrome displays with 296x128 pixels and UC8151D chipset
4646
//ThinkInk_290_Mono_M06 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
4747

48+
4849
// 4.2" Monochrome displays with 400x300 pixels and SSD1619 chipset
4950
//ThinkInk_420_Mono_BN display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
5051

52+
// 4.2" Monochrome displays with 400x300 pixels and UC8276 chipset
53+
//ThinkInk_420_Mono_M06 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
54+
55+
5156
void setup() {
5257
Serial.begin(115200);
5358
while (!Serial) { delay(10); }

examples/ThinkInk_tricolor/ThinkInk_tricolor.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636
// 2.7" Tricolor Featherwing or Breakout with EK79686 chipset
3737
//ThinkInk_270_Tricolor_Z70 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
3838

39-
// 2.9" Tricolor Featherwing or Breakout:
39+
// 2.9" Tricolor Featherwing or Breakout with IL0373 chipset
4040
ThinkInk_290_Tricolor_Z10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
41+
// 2.9" Tricolor Featherwing or Breakout with UC8151D chipset
42+
//ThinkInk_290_Tricolor_Z13 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
4143

4244
//ThinkInk_420_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
4345
//ThinkInk_420_Tricolor_Z21 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);

src/Adafruit_ThinkInk.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "panels/ThinkInk_270_Tricolor_Z70.h"
1313
#include "panels/ThinkInk_290_Tricolor_RH.h"
1414
#include "panels/ThinkInk_290_Tricolor_Z10.h"
15+
#include "panels/ThinkInk_290_Tricolor_Z13.h"
1516
#include "panels/ThinkInk_420_Tricolor_RW.h"
1617
#include "panels/ThinkInk_420_Tricolor_Z21.h"
1718

@@ -31,5 +32,6 @@
3132
#include "panels/ThinkInk_290_Mono_BN.h"
3233
#include "panels/ThinkInk_290_Mono_M06.h"
3334
#include "panels/ThinkInk_420_Mono_BN.h"
35+
#include "panels/ThinkInk_420_Mono_M06.h"
3436

3537
#endif // _ADAFRUIT_THINKINK_H_

src/drivers/Adafruit_UC8151D.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ void Adafruit_UC8151D::begin(bool reset) {
103103
Adafruit_EPD::begin(reset);
104104
setBlackBuffer(1, true); // black defaults to inverted
105105
setColorBuffer(0, true); // red defaults to inverted
106-
107-
powerDown();
108106
}
109107

110108
/**************************************************************************/

src/drivers/Adafruit_UC8151D.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ const uint8_t uc8151d_monofull_init_code[] {
5555
UC8151D_CDI, 1, 0x97,
5656
0xFE};
5757

58+
const uint8_t uc8151d_trifull_init_code[] {
59+
UC8151D_PON, 0,
60+
0xFF, 10,
61+
UC8151D_PSR, 2, 0x0F, 0x89,
62+
0x61, 3, 0x80, 0x01, 0x28,
63+
UC8151D_CDI, 1, 0x77,
64+
0xFE};
65+
66+
5867
const uint8_t uc8151d_partial_init_code[] {
5968
UC8151D_PWR, 5, 0x03, 0x00, 0x2B, 0x2B, 0x03, //POWER SETTING
6069
UC8151D_BTST, 3, 0x17, 0x17, 0x17, //boost soft start
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#ifndef _THINKINK_290_TRI_Z13_H
2+
#define _THINKINK_290_TRI_Z13_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_Z13 : public Adafruit_UC8151D {
8+
public:
9+
ThinkInk_290_Tricolor_Z13(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_UC8151D(296, 128, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){};
13+
14+
ThinkInk_290_Tricolor_Z13(int8_t DC, int8_t RST, int8_t CS, int8_t SRCS,
15+
int8_t BUSY = -1, SPIClass *spi = &SPI)
16+
: Adafruit_UC8151D(296, 128, DC, RST, CS, SRCS, BUSY, spi){};
17+
18+
void begin(thinkinkmode_t mode = THINKINK_MONO) {
19+
Adafruit_UC8151D::begin(true);
20+
21+
setColorBuffer(0, true);
22+
setBlackBuffer(1, true);
23+
24+
inkmode = mode; // Preserve ink mode for ImageReader or others
25+
26+
_epd_init_code = uc8151d_trifull_init_code;
27+
28+
layer_colors[EPD_WHITE] = 0b00;
29+
layer_colors[EPD_BLACK] = 0b10;
30+
layer_colors[EPD_RED] = 0b01;
31+
layer_colors[EPD_GRAY] = 0b01;
32+
layer_colors[EPD_LIGHT] = 0b00;
33+
layer_colors[EPD_DARK] = 0b01;
34+
35+
default_refresh_delay = 1000;
36+
setRotation(0);
37+
powerDown();
38+
}
39+
};
40+
41+
#endif // _THINKINK_290_TRI_Z13_H

src/panels/ThinkInk_420_Mono_M06.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#ifndef _THINKINK_420_MONO_M06_H
2+
#define _THINKINK_420_MONO_M06_H
3+
4+
#include "Adafruit_EPD.h"
5+
6+
class ThinkInk_420_Mono_M06 : public Adafruit_UC8276 {
7+
private:
8+
public:
9+
ThinkInk_420_Mono_M06(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST,
10+
int8_t CS, int8_t SRCS, int8_t MISO, int8_t BUSY = -1)
11+
: Adafruit_UC8276(300, 400, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){};
12+
13+
ThinkInk_420_Mono_M06(int8_t DC, int8_t RST, int8_t CS, int8_t SRCS,
14+
int8_t BUSY = -1, SPIClass *spi = &SPI)
15+
: Adafruit_UC8276(300, 400, DC, RST, CS, SRCS, BUSY, spi){};
16+
17+
void begin(thinkinkmode_t mode = THINKINK_MONO) {
18+
Adafruit_EPD::begin(true);
19+
setColorBuffer(1, true); // layer 1 uninverted
20+
setBlackBuffer(1, true); // only one buffer
21+
22+
layer_colors[EPD_WHITE] = 0b00;
23+
layer_colors[EPD_BLACK] = 0b01;
24+
layer_colors[EPD_RED] = 0b10;
25+
layer_colors[EPD_GRAY] = 0b10;
26+
layer_colors[EPD_LIGHT] = 0b00;
27+
layer_colors[EPD_DARK] = 0b01;
28+
29+
default_refresh_delay = 13000;
30+
setRotation(1);
31+
powerDown();
32+
};
33+
};
34+
35+
#endif // _THINKINK_420_MONO

0 commit comments

Comments
 (0)