Skip to content

Commit eb4a32a

Browse files
committed
add 4.2" with UC8276
1 parent 597e2ff commit eb4a32a

File tree

4 files changed

+39
-26
lines changed

4 files changed

+39
-26
lines changed

examples/ThinkInk_tricolor/ThinkInk_tricolor.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
// 2.9" Tricolor Featherwing or Breakout:
2424
ThinkInk_290_Tricolor_Z10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2525
//ThinkInk_420_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
26+
//ThinkInk_420_Tricolor_Z21 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
27+
2628

2729
void setup() {
2830
Serial.begin(115200);

src/Adafruit_ThinkInk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ typedef enum {
1111
#include "panels/ThinkInk_270_Tricolor_C44.h"
1212
#include "panels/ThinkInk_290_Tricolor_Z10.h"
1313
#include "panels/ThinkInk_420_Tricolor_RW.h"
14+
#include "panels/ThinkInk_420_Tricolor_Z21.h"
1415

1516
#include "panels/ThinkInk_154_Grayscale4_T8.h"
1617
#include "panels/ThinkInk_213_Grayscale4_T5.h"

src/drivers/Adafruit_UC8276.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,6 @@
1717
#define UC8276_WRITE_VCOM 0x50
1818
#define UC8276_GET_STATUS 0x71
1919

20-
/*
21-
#define UC8276_GATE_VOLTAGE 0x03
22-
#define UC8276_PROGOTP_INITIAL 0x08
23-
#define UC8276_PROGREG_INITIAL 0x09
24-
#define UC8276_READREG_INITIAL 0x0A
25-
#define UC8276_BOOST_SOFTSTART 0x0C
26-
#define UC8276_DATA_MODE 0x11
27-
#define UC8276_SW_RESET 0x12
28-
#define UC8276_TEMP_CONTROL 0x18
29-
#define UC8276_TEMP_WRITE 0x1A
30-
31-
#define UC8276_DISP_CTRL1 0x21
32-
#define UC8276_DISP_CTRL2 0x22
33-
34-
#define UC8276_READ_OTP 0x2D
35-
#define UC8276_READ_STATUS 0x2F
36-
#define UC8276_WRITE_LUT 0x32
37-
#define UC8276_WRITE_BORDER 0x3C
38-
#define UC8276_SET_RAMXPOS 0x44
39-
#define UC8276_SET_RAMYPOS 0x45
40-
#define UC8276_SET_RAMXCOUNT 0x4E
41-
#define UC8276_SET_RAMYCOUNT 0x4F
42-
#define UC8276_SET_ANALOGBLOCK 0x74
43-
#define UC8276_SET_DIGITALBLOCK 0x7E
44-
*/
45-
4620
/**************************************************************************/
4721
/*!
4822
@brief Class for interfacing with UC8276 EPD drivers
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#ifndef _THINKINK_420_TRICOLOR_Z21_H
2+
#define _THINKINK_420_TRICOLOR_Z21_H
3+
4+
#include "Adafruit_EPD.h"
5+
6+
class ThinkInk_420_Tricolor_Z21 : public Adafruit_UC8276 {
7+
private:
8+
public:
9+
ThinkInk_420_Tricolor_Z21(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_UC8276(300, 400, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){};
13+
14+
ThinkInk_420_Tricolor_Z21(int8_t DC, int8_t RST, int8_t CS, int8_t SRCS,
15+
int8_t BUSY = -1, SPIClass *spi = &SPI)
16+
: Adafruit_UC8276(300, 400, DC, RST, CS, SRCS, BUSY, spi){};
17+
18+
void begin(thinkinkmode_t mode = THINKINK_TRICOLOR) {
19+
Adafruit_EPD::begin(true);
20+
setBlackBuffer(0, true);
21+
setColorBuffer(1, false);
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(1);
32+
powerDown();
33+
};
34+
};
35+
36+
#endif // _THINKINK_420_TRI

0 commit comments

Comments
 (0)