Skip to content

Commit f647376

Browse files
committed
2.13 BN type
1 parent 36df61c commit f647376

File tree

4 files changed

+75
-39
lines changed

4 files changed

+75
-39
lines changed

src/Adafruit_ThinkInk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ typedef enum {
1717
#include "panels/ThinkInk_154_Mono_D27.h"
1818
#include "panels/ThinkInk_213_Mono_B72.h"
1919
#include "panels/ThinkInk_213_Mono_B73.h"
20+
#include "panels/ThinkInk_213_Mono_BN.h"

src/drivers/Adafruit_SSD1680.cpp

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@
33

44
#define BUSY_WAIT 500
55

6+
7+
// clang-format off
8+
9+
const uint8_t ssd1680_default_init_code[] {
10+
SSD1680_SW_RESET, 0, // soft reset
11+
0xFF, 20, // busy wait
12+
SSD1680_DATA_MODE, 1, 0x03, // Ram data entry mode
13+
SSD1680_WRITE_BORDER, 1, 0x05, // border color
14+
15+
SSD1680_WRITE_VCOM, 1, 0x36, // Vcom Voltage
16+
SSD1680_GATE_VOLTAGE, 1, 0x17, // Set gate voltage
17+
SSD1680_SOURCE_VOLTAGE, 3, 0x41, 0x00, 0x32, // Set source voltage
18+
19+
SSD1680_SET_RAMXCOUNT, 1, 1,
20+
SSD1680_SET_RAMYCOUNT, 2, 0, 0,
21+
0xFE};
22+
23+
// clang-format on
24+
25+
626
/**************************************************************************/
727
/*!
828
@brief constructor if using external SRAM chip and software SPI
@@ -58,8 +78,8 @@ Adafruit_SSD1680::Adafruit_SSD1680(int width, int height, int8_t SID,
5878
*/
5979
/**************************************************************************/
6080
Adafruit_SSD1680::Adafruit_SSD1680(int width, int height, int8_t DC, int8_t RST,
61-
int8_t CS, int8_t SRCS, int8_t BUSY)
62-
: Adafruit_EPD(width, height, DC, RST, CS, SRCS, BUSY) {
81+
int8_t CS, int8_t SRCS, int8_t BUSY, SPIClass *spi)
82+
: Adafruit_EPD(width, height, DC, RST, CS, SRCS, BUSY, spi) {
6383
if ((height % 8) != 0) {
6484
height += 8 - (height % 8);
6585
}
@@ -140,23 +160,21 @@ void Adafruit_SSD1680::powerUp() {
140160
delay(100);
141161
busy_wait();
142162

143-
// soft reset
144-
EPD_command(SSD1680_SW_RESET);
145-
busy_wait();
163+
const uint8_t *init_code = ssd1680_default_init_code;
146164

147-
// Set display size and driver output control
148-
buf[0] = (WIDTH - 1);
149-
buf[1] = (WIDTH - 1) >> 8;
150-
buf[2] = 0x00;
151-
EPD_command(SSD1680_DRIVER_CONTROL, buf, 3);
165+
if (_epd_init_code != NULL) {
166+
init_code = _epd_init_code;
167+
}
168+
EPD_commandList(init_code);
152169

153-
// Ram data entry mode
154-
buf[0] = 0x03;
155-
EPD_command(SSD1680_DATA_MODE, buf, 1);
170+
uint8_t height = HEIGHT;
171+
if ((height % 8) != 0) {
172+
height += 8 - (height % 8);
173+
}
156174

157175
// Set ram X start/end postion
158176
buf[0] = 0x01;
159-
buf[1] = HEIGHT / 8;
177+
buf[1] = height / 8;
160178
EPD_command(SSD1680_SET_RAMXPOS, buf, 2);
161179

162180
// Set ram Y start/end postion
@@ -166,23 +184,6 @@ void Adafruit_SSD1680::powerUp() {
166184
buf[3] = (WIDTH - 1) >> 8;
167185
EPD_command(SSD1680_SET_RAMYPOS, buf, 4);
168186

169-
// border color
170-
buf[0] = 0x05;
171-
EPD_command(SSD1680_WRITE_BORDER, buf, 1);
172-
173-
// Vcom Voltage
174-
buf[0] = 0x36;
175-
EPD_command(SSD1680_WRITE_VCOM, buf, 1);
176-
177-
// Set gate voltage
178-
buf[0] = 0x17;
179-
EPD_command(SSD1680_GATE_VOLTAGE, buf, 1);
180-
181-
// Set source voltage
182-
buf[0] = 0x41;
183-
buf[1] = 0x00;
184-
buf[2] = 0x32;
185-
EPD_command(SSD1680_SOURCE_VOLTAGE, buf, 3);
186187

187188
// Set LUT
188189
/*
@@ -191,14 +192,13 @@ void Adafruit_SSD1680::powerUp() {
191192
EPD_command(SSD1680_WRITE_LUT, LUT_DATA, 70);
192193
*/
193194

194-
// set RAM x address count
195-
buf[0] = 1;
196-
EPD_command(SSD1680_SET_RAMXCOUNT, buf, 1);
197195

198-
// set RAM y address count
199-
buf[0] = 0;
200-
buf[1] = 0;
201-
EPD_command(SSD1680_SET_RAMYCOUNT, buf, 2);
196+
// Set display size and driver output control
197+
buf[0] = (WIDTH - 1);
198+
buf[1] = (WIDTH - 1) >> 8;
199+
buf[2] = 0x00;
200+
EPD_command(SSD1680_DRIVER_CONTROL, buf, 3);
201+
202202
}
203203

204204
/**************************************************************************/

src/drivers/Adafruit_SSD1680.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Adafruit_SSD1680 : public Adafruit_EPD {
4545
int8_t RST, int8_t CS, int8_t SRCS, int8_t MISO,
4646
int8_t BUSY = -1);
4747
Adafruit_SSD1680(int width, int height, int8_t DC, int8_t RST, int8_t CS,
48-
int8_t SRCS, int8_t BUSY = -1);
48+
int8_t SRCS, int8_t BUSY = -1, SPIClass *spi = &SPI);
4949

5050
void begin(bool reset = true);
5151
void powerUp();

src/panels/ThinkInk_213_Mono_BN.h

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

0 commit comments

Comments
 (0)