Skip to content

Commit ba2f88e

Browse files
authored
Merge pull request #29 from adafruit/morepanels
Morepanels
2 parents a7c5335 + 2ba1cb0 commit ba2f88e

16 files changed

+915
-88
lines changed

examples/EPDTest/EPDTest.ino

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// Uncomment the following line if you are using 1.54" EPD with SSD1681
2626
//Adafruit_SSD1681 display(200, 200, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2727
// Uncomment the following line if you are using 1.54" EPD with UC8151D
28-
Adafruit_UC8151D display(152, 152, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
28+
//Adafruit_UC8151D display(152, 152, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2929

3030

3131
//Uncomment the following line if you are using 2.13" EPD with SSD1680
@@ -41,22 +41,26 @@ Adafruit_UC8151D display(152, 152, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY)
4141
//Adafruit_UC8151D display(212, 104, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
4242

4343
//Uncomment the following line if you are using 2.13" EPD with IL0373
44-
//Adafruit_IL0373 display(212, 104, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
44+
Adafruit_IL0373 display(212, 104, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
4545
//#define FLEXIBLE_213
4646

4747

48-
/* Uncomment the following line if you are using 2.7" tricolor or grayscale EPD */
48+
//Uncomment the following line if you are using 2.7" EPD with IL91874
4949
//Adafruit_IL91874 display(264, 176, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS);
5050

51-
// 2.7" tricolor with Adafruit_EK79686
52-
//Adafruit_EK79686 display(264, 176, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS);
51+
// Uncomment the following line if you are using 2.7" EPD with EK79686
52+
//Adafruit_EK79686 display(264, 176, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
5353

54-
/* Uncomment the following line if you are using 2.9" EPD */
54+
55+
// Uncomment the following line if you are using 2.9" EPD with IL0373
5556
//Adafruit_IL0373 display(296, 128, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
5657
//#define FLEXIBLE_290
5758

58-
/* Uncomment the following line if you are using 4.2" tricolor EPD */
59-
//Adafruit_IL0398 display(300, 400, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
59+
// Uncomment the following line if you are using 2.9" EPD with SSD1680
60+
//Adafruit_SSD1680 display(296, 128, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
61+
62+
// Uncomment the following line if you are using 2.9" EPD with UC8151D
63+
//Adafruit_UC8151D display(296, 128, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
6064

6165

6266
#define COLOR1 EPD_BLACK

examples/ThinkInk_gray4/ThinkInk_gray4.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
// 2.9" Grayscale Featherwing or Breakout:
2222
ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
23+
// 4.2" Grayscale display
24+
//ThinkInk_420_Grayscale4_T2 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2325

2426
#define COLOR1 EPD_BLACK
2527
#define COLOR2 EPD_LIGHT

examples/ThinkInk_tricolor/ThinkInk_tricolor.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
ThinkInk_290_Tricolor_Z10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
3838

3939
//ThinkInk_420_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
40+
//ThinkInk_420_Tricolor_Z21 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
41+
4042

4143
void setup() {
4244
Serial.begin(115200);

src/Adafruit_EPD.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ class Adafruit_EPD : public Adafruit_GFX {
194194
void dcLow();
195195
};
196196

197+
#include "drivers/Adafruit_ACeP.h"
197198
#include "drivers/Adafruit_EK79686.h"
198199
#include "drivers/Adafruit_IL0373.h"
199200
#include "drivers/Adafruit_IL0398.h"
@@ -205,5 +206,6 @@ class Adafruit_EPD : public Adafruit_GFX {
205206
#include "drivers/Adafruit_SSD1680.h"
206207
#include "drivers/Adafruit_SSD1681.h"
207208
#include "drivers/Adafruit_UC8151D.h"
209+
#include "drivers/Adafruit_UC8276.h"
208210

209211
#endif /* _ADAFRUIT_EPD_H_ */

src/Adafruit_ThinkInk.h

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

1617
#include "panels/ThinkInk_154_Grayscale4_T8.h"
1718
#include "panels/ThinkInk_213_Grayscale4_T5.h"
1819
#include "panels/ThinkInk_270_Grayscale4_W3.h"
1920
#include "panels/ThinkInk_290_Grayscale4_T5.h"
21+
#include "panels/ThinkInk_420_Grayscale4_T2.h"
2022

2123
#include "panels/ThinkInk_154_Mono_D27.h"
2224
#include "panels/ThinkInk_154_Mono_D67.h"

src/drivers/Adafruit_ACeP.cpp

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
#include "Adafruit_ACeP.h"
2+
#include "Adafruit_EPD.h"
3+
4+
#define BUSY_WAIT 500
5+
6+
// clang-format off
7+
8+
const uint8_t acep_default_init_code[] {
9+
ACEP_PANEL_SETTING, 2, 0xEF, 0x08, // LUT from OTP
10+
ACEP_POWER_SETTING, 4, 0x37, 0x00, 0x23, 0x23, // 0x05&0x05?
11+
ACEP_POWER_OFF_SEQUENCE, 1, 0x00,
12+
ACEP_BOOSTER_SOFT_START, 3, 0xC7, 0xC7, 0x1D,
13+
ACEP_PLL, 1, 0x3C,
14+
ACEP_TSE, 1, 0x00,
15+
ACEP_CDI, 1, 0x37,
16+
ACEP_TCON, 1, 0x22,
17+
ACEP_RESOLUTION, 4, 0x02, 0x58, 0x01, 0xC0,
18+
ACEP_PWS, 1, 0xAA,
19+
0xFE};
20+
21+
// clang-format on
22+
23+
/**************************************************************************/
24+
/*!
25+
@brief constructor if using external SRAM chip and software SPI
26+
@param width the width of the display in pixels
27+
@param height the height of the display in pixels
28+
@param SID the SID pin to use
29+
@param SCLK the SCLK pin to use
30+
@param DC the data/command pin to use
31+
@param RST the reset pin to use
32+
@param CS the chip select pin to use
33+
@param SRCS the SRAM chip select pin to use
34+
@param MISO the MISO pin to use
35+
@param BUSY the busy pin to use
36+
*/
37+
/**************************************************************************/
38+
Adafruit_ACEP::Adafruit_ACEP(int width, int height, int8_t SID, int8_t SCLK,
39+
int8_t DC, int8_t RST, int8_t CS, int8_t SRCS,
40+
int8_t MISO, int8_t BUSY)
41+
: Adafruit_EPD(width, height, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY) {
42+
43+
if ((width % 8) != 0) {
44+
width += 8 - (width % 8);
45+
}
46+
buffer1_size = (uint16_t)width * (uint16_t)height / 2;
47+
buffer2_size = 0;
48+
49+
if (SRCS >= 0) {
50+
use_sram = true;
51+
buffer1_addr = 0;
52+
buffer2_addr = 0;
53+
} else {
54+
buffer1 = (uint8_t *)malloc(buffer1_size);
55+
buffer2 = NULL;
56+
}
57+
58+
singleByteTxns = true;
59+
}
60+
61+
// constructor for hardware SPI - we indicate DataCommand, ChipSelect, Reset
62+
63+
/**************************************************************************/
64+
/*!
65+
@brief constructor if using on-chip RAM and hardware SPI
66+
@param width the width of the display in pixels
67+
@param height the height of the display in pixels
68+
@param DC the data/command pin to use
69+
@param RST the reset pin to use
70+
@param CS the chip select pin to use
71+
@param SRCS the SRAM chip select pin to use
72+
@param BUSY the busy pin to use
73+
*/
74+
/**************************************************************************/
75+
Adafruit_ACEP::Adafruit_ACEP(int width, int height, int8_t DC, int8_t RST,
76+
int8_t CS, int8_t SRCS, int8_t BUSY, SPIClass *spi)
77+
: Adafruit_EPD(width, height, DC, RST, CS, SRCS, BUSY, spi) {
78+
79+
if ((height % 8) != 0) {
80+
height += 8 - (height % 8);
81+
}
82+
buffer1_size = (uint16_t)width * (uint16_t)height / 2;
83+
buffer2_size = 0;
84+
85+
if (SRCS >= 0) {
86+
use_sram = true;
87+
buffer1_addr = 0;
88+
buffer2_addr = 0;
89+
} else {
90+
buffer1 = (uint8_t *)malloc(buffer1_size);
91+
buffer2 = buffer1;
92+
}
93+
94+
singleByteTxns = true;
95+
}
96+
97+
/**************************************************************************/
98+
/*!
99+
@brief wait for busy signal to end
100+
*/
101+
/**************************************************************************/
102+
void Adafruit_ACEP::busy_wait(void) {
103+
if (_busy_pin >= 0) {
104+
while (!digitalRead(_busy_pin)) { // wait for busy high
105+
delay(10);
106+
}
107+
} else {
108+
delay(BUSY_WAIT);
109+
}
110+
}
111+
112+
/**************************************************************************/
113+
/*!
114+
@brief begin communication with and set up the display.
115+
@param reset if true the reset pin will be toggled.
116+
*/
117+
/**************************************************************************/
118+
void Adafruit_ACEP::begin(bool reset) {
119+
Adafruit_EPD::begin(reset);
120+
121+
delay(100);
122+
powerDown();
123+
}
124+
125+
/**************************************************************************/
126+
/*!
127+
@brief signal the display to update
128+
*/
129+
/**************************************************************************/
130+
void Adafruit_ACEP::update() {
131+
uint8_t buf[4];
132+
/*
133+
// clear data
134+
buf[0] = 0x02;
135+
buf[1] = 0x58;
136+
buf[2] = 0x01;
137+
buf[3] = 0xC0;
138+
EPD_command(ACEP_RESOLUTION, buf, 4);
139+
EPD_command(ACEP_DTM);
140+
for (int i=0; i< 134400/256; i++) {
141+
uint8_t block[256];
142+
memset(block, 0x77, 256);
143+
EPD_data(block, 256);
144+
}
145+
EPD_command(ACEP_POWER_ON);
146+
busy_wait();
147+
EPD_command(ACEP_DISPLAY_REFRESH);
148+
busy_wait();
149+
EPD_command(ACEP_POWER_OFF);
150+
151+
if (_busy_pin >= 0) {
152+
while (digitalRead(_busy_pin)) { // wait for busy LOW
153+
delay(10);
154+
}
155+
} else {
156+
delay(BUSY_WAIT);
157+
}*/
158+
159+
// actual data
160+
// clear data
161+
buf[0] = 0x02;
162+
buf[1] = 0x58;
163+
buf[2] = 0x01;
164+
buf[3] = 0xC0;
165+
EPD_command(ACEP_RESOLUTION, buf, 4);
166+
EPD_command(ACEP_DTM);
167+
for (int i = 0; i < 134400 / 256; i++) {
168+
uint8_t block[256];
169+
memset(block, ((i % 6) << 4) | (i % 6), 256);
170+
EPD_data(block, 256);
171+
}
172+
EPD_command(ACEP_POWER_ON);
173+
busy_wait();
174+
EPD_command(ACEP_DISPLAY_REFRESH);
175+
busy_wait();
176+
EPD_command(ACEP_POWER_OFF);
177+
}
178+
179+
/**************************************************************************/
180+
/*!
181+
@brief start up the display
182+
*/
183+
/**************************************************************************/
184+
void Adafruit_ACEP::powerUp() {
185+
uint8_t buf[5];
186+
187+
hardwareReset();
188+
delay(200);
189+
busy_wait();
190+
const uint8_t *init_code = acep_default_init_code;
191+
192+
if (_epd_init_code != NULL) {
193+
init_code = _epd_init_code;
194+
}
195+
EPD_commandList(init_code);
196+
delay(1000);
197+
buf[0] = 0x37;
198+
EPD_command(ACEP_CDI, buf, 1);
199+
}
200+
201+
/**************************************************************************/
202+
/*!
203+
@brief wind down the display
204+
*/
205+
/**************************************************************************/
206+
207+
void Adafruit_ACEP::powerDown(void) {
208+
uint8_t buf[1];
209+
210+
delay(1000);
211+
212+
// deep sleep
213+
buf[0] = 0xA5;
214+
EPD_command(ACEP_DEEP_SLEEP, buf, 1);
215+
216+
delay(100);
217+
}
218+
219+
/**************************************************************************/
220+
/*!
221+
@brief Send the specific command to start writing to EPD display RAM
222+
@param index The index for which buffer to write (0 or 1 or tri-color
223+
displays) Ignored for monochrome displays.
224+
@returns The byte that is read from SPI at the same time as sending the
225+
command
226+
*/
227+
/**************************************************************************/
228+
uint8_t Adafruit_ACEP::writeRAMCommand(uint8_t index) {
229+
return EPD_command(ACEP_DTM, false);
230+
}
231+
232+
/**************************************************************************/
233+
/*!
234+
@brief Some displays require setting the RAM address pointer
235+
@param x X address counter value
236+
@param y Y address counter value
237+
*/
238+
/**************************************************************************/
239+
void Adafruit_ACEP::setRAMAddress(uint16_t x, uint16_t y) {}

src/drivers/Adafruit_ACeP.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#ifndef LIB_ADAFRUIT_ACEP
2+
#define LIB_ADAFRUIT_ACEP
3+
4+
#include "Adafruit_EPD.h"
5+
#include <Arduino.h>
6+
7+
#define ACEP_PANEL_SETTING 0x00
8+
#define ACEP_POWER_SETTING 0x01
9+
#define ACEP_POWER_OFF 0x02
10+
#define ACEP_POWER_OFF_SEQUENCE 0x03
11+
#define ACEP_POWER_ON 0x04
12+
#define ACEP_BOOSTER_SOFT_START 0x06
13+
#define ACEP_DEEP_SLEEP 0x07
14+
#define ACEP_DTM 0x10
15+
#define ACEP_DISPLAY_REFRESH 0x12
16+
#define ACEP_PLL 0x30
17+
#define ACEP_TSE 0x41
18+
#define ACEP_CDI 0x50
19+
#define ACEP_TCON 0x60
20+
#define ACEP_RESOLUTION 0x61
21+
#define ACEP_PWS 0xE3
22+
23+
/**************************************************************************/
24+
/*!
25+
@brief Class for interfacing with ACEP EPD drivers
26+
*/
27+
/**************************************************************************/
28+
class Adafruit_ACEP : public Adafruit_EPD {
29+
public:
30+
Adafruit_ACEP(int width, int height, int8_t SID, int8_t SCLK, int8_t DC,
31+
int8_t RST, int8_t CS, int8_t SRCS, int8_t MISO,
32+
int8_t BUSY = -1);
33+
Adafruit_ACEP(int width, int height, int8_t DC, int8_t RST, int8_t CS,
34+
int8_t SRCS, int8_t BUSY = -1, SPIClass *spi = &SPI);
35+
36+
void begin(bool reset = true);
37+
void powerUp();
38+
void powerDown();
39+
void update();
40+
41+
protected:
42+
uint8_t writeRAMCommand(uint8_t index);
43+
void setRAMAddress(uint16_t x, uint16_t y);
44+
void busy_wait();
45+
};
46+
47+
#endif

0 commit comments

Comments
 (0)