Skip to content

Commit eb01cf9

Browse files
authored
Merge branch 'master' into morepanels
2 parents 41f2164 + a7c5335 commit eb01cf9

36 files changed

+1346
-240
lines changed

examples/EPDTest/EPDTest.ino

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,41 @@
1616
#define EPD_RESET 5 // can set to -1 and share with microcontroller Reset!
1717
#define EPD_BUSY 7 // can set to -1 to not use a pin (will wait a fixed delay)
1818

19-
/* Uncomment the following line if you are using 1.54" tricolor EPD */
19+
// Uncomment the following line if you are using 1.54" EPD with IL0373
2020
//Adafruit_IL0373 display(152, 152, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
21-
22-
/* Uncomment the following line if you are using 1.54" monochrome EPD */
21+
// Uncomment the following line if you are using 1.54" EPD with SSD1680
22+
//Adafruit_SSD1680 display(152, 152, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
23+
// Uncomment the following line if you are using 1.54" EPD with SSD1608
2324
//Adafruit_SSD1608 display(200, 200, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
25+
// Uncomment the following line if you are using 1.54" EPD with SSD1681
26+
//Adafruit_SSD1681 display(200, 200, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
27+
// 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);
2429

25-
/* Uncomment the following line if you are using 2.13" tricolor EPD */
26-
Adafruit_IL0373 display(212, 104, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
27-
//#define FLEXIBLE_213
2830

29-
/* Uncomment the following line if you are using 2.13" monochrome 250*122 EPD */
31+
//Uncomment the following line if you are using 2.13" EPD with SSD1680
32+
//Adafruit_SSD1680 display(250, 122, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
33+
34+
// Uncomment the following line if you are using 2.13" EPD with SSD1675
3035
//Adafruit_SSD1675 display(250, 122, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
3136

37+
// Uncomment the following line if you are using 2.13" EPD with SSD1675B
38+
//Adafruit_SSD1675B display(250, 122, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
39+
40+
// Uncomment the following line if you are using 2.13" EPD with UC8151D
41+
//Adafruit_UC8151D display(212, 104, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
42+
43+
//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);
45+
//#define FLEXIBLE_213
46+
47+
3248
/* Uncomment the following line if you are using 2.7" tricolor or grayscale EPD */
3349
//Adafruit_IL91874 display(264, 176, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS);
3450

51+
// 2.7" tricolor with Adafruit_EK79686
52+
//Adafruit_EK79686 display(264, 176, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS);
53+
3554
/* Uncomment the following line if you are using 2.9" EPD */
3655
//Adafruit_IL0373 display(296, 128, EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
3756
//#define FLEXIBLE_290

examples/ThinkInk_gray4/ThinkInk_gray4.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#define EPD_CS 9 // can be any pin, but required!
1414
#define EPD_BUSY 7 // can set to -1 to not use a pin (will wait a fixed delay)
1515
#define SRAM_CS 6 // can set to -1 to not use a pin (uses a lot of RAM!)
16-
#define EPD_RESET 5 // can set to -1 and share with chip Reset (can't deep sleep)
16+
#define EPD_RESET 8 // can set to -1 and share with chip Reset (can't deep sleep)
1717

1818
//ThinkInk_154_Grayscale4_T8 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
1919
//ThinkInk_213_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);

examples/ThinkInk_mono/ThinkInk_mono.ino

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,40 @@
1212
#define EPD_CS 9
1313
#define EPD_DC 10
1414
#define SRAM_CS 6
15-
#define EPD_RESET 5 // can set to -1 and share with microcontroller Reset!
15+
#define EPD_RESET 8 // can set to -1 and share with microcontroller Reset!
1616
#define EPD_BUSY 7 // can set to -1 to not use a pin (will wait a fixed delay)
1717

18+
// 1.54" Monochrome displays with 200x200 pixels and SSD1681 chipset
1819
//ThinkInk_154_Mono_D67 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
20+
21+
// 1.54" Monochrome displays with 200x200 pixels and SSD1608 chipset
1922
//ThinkInk_154_Mono_D27 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
20-
//ThinkInk_213_Mono_B72 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
23+
24+
// 1.54" Monochrome displays with 152x152 pixels and UC8151D chipset
25+
//ThinkInk_154_Mono_M10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
26+
27+
28+
// 2.13" Monochrome displays with 250x122 pixels and SSD1675 chipset
29+
ThinkInk_213_Mono_B72 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
30+
31+
// 2.13" Monochrome displays with 250x122 pixels and SSD1675B chipset
2132
//ThinkInk_213_Mono_B73 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
33+
34+
// 2.13" Monochrome displays with 250x122 pixels and SSD1680 chipset
2235
//ThinkInk_213_Mono_BN display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
36+
37+
// 2.13" Monochrome displays with 212x104 pixels and UC8151D chipset
38+
//ThinkInk_213_Mono_M21 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
39+
40+
41+
// 2.9" 4-level Grayscale (use mono) displays with 296x128 pixels and IL0373 chipset
42+
//ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
43+
44+
// 2.9" Monochrome displays with 296x128 pixels and UC8151D chipset
45+
//ThinkInk_290_Mono_M06 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
46+
47+
// 4.2" Monochrome displays with 400x300 pixels and SSD1619 chipset
2348
//ThinkInk_420_Mono_BN display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
24-
ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2549

2650
void setup() {
2751
Serial.begin(115200);
@@ -76,4 +100,4 @@ void testdrawtext(char *text, uint16_t color) {
76100
display.setTextColor(color);
77101
display.setTextWrap(true);
78102
display.print(text);
79-
}
103+
}

examples/ThinkInk_partial/ThinkInk_partial.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#define EPD_CS 9
1313
#define EPD_DC 10
1414
#define SRAM_CS 6
15-
#define EPD_RESET 5 // can set to -1 and share with microcontroller Reset!
15+
#define EPD_RESET 8 // can set to -1 and share with microcontroller Reset!
1616
#define EPD_BUSY 7 // can set to -1 to not use a pin (will wait a fixed delay)
1717

1818
//ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);

examples/ThinkInk_tricolor/ThinkInk_tricolor.ino

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,29 @@
1313
#define EPD_CS 9 // can be any pin, but required!
1414
#define EPD_BUSY 7 // can set to -1 to not use a pin (will wait a fixed delay)
1515
#define SRAM_CS 6 // can set to -1 to not use a pin (uses a lot of RAM!)
16-
#define EPD_RESET 5 // can set to -1 and share with chip Reset (can't deep sleep)
16+
#define EPD_RESET 8 // can set to -1 and share with chip Reset (can't deep sleep)
1717

18+
// 1.54" Tricolor EPD with SSD1680 chipset
1819
//ThinkInk_154_Tricolor_Z17 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
20+
21+
// 1.54" Tricolor EPD with SSD1680 chipset
1922
//ThinkInk_154_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
23+
24+
// 2.13" Tricolor EPD with SSD1680 chipset
2025
//ThinkInk_213_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
26+
27+
// 2.13" Tricolor EPD with IL0373 chipset
2128
//ThinkInk_213_Tricolor_Z16 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
29+
30+
// 2.7" Tricolor Featherwing or Breakout with IL91874 chipset
2231
//ThinkInk_270_Tricolor_C44 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
32+
33+
// 2.7" Tricolor Featherwing or Breakout with EK79686 chipset
34+
//ThinkInk_270_Tricolor_Z70 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
35+
2336
// 2.9" Tricolor Featherwing or Breakout:
2437
ThinkInk_290_Tricolor_Z10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
38+
2539
//ThinkInk_420_Tricolor_RW display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2640
//ThinkInk_420_Tricolor_Z21 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2741

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Adafruit EPD
2-
version=4.0.1
2+
version=4.0.5
33
author=Adafruit
44
maintainer=Adafruit <[email protected]>
55
sentence=ePaper display driver

src/Adafruit_EPD.cpp

Lines changed: 83 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,61 @@ void Adafruit_EPD::drawPixel(int16_t x, int16_t y, uint16_t color) {
281281
}
282282
}
283283

284+
void Adafruit_EPD::writeRAMFramebufferToEPD(uint8_t *framebuffer,
285+
uint32_t framebuffer_size,
286+
uint8_t EPDlocation,
287+
bool invertdata) {
288+
// write image
289+
writeRAMCommand(EPDlocation);
290+
dcHigh();
291+
// Serial.printf("Writing from RAM location %04x: \n", &framebuffer);
292+
293+
for (uint16_t i = 0; i < framebuffer_size; i++) {
294+
uint8_t d = framebuffer[i];
295+
if (invertdata)
296+
d = ~d;
297+
298+
/*
299+
Serial.printf("%02x", d);
300+
if ((i+1) % (WIDTH/8) == 0)
301+
Serial.println();
302+
*/
303+
304+
SPItransfer(d);
305+
}
306+
// Serial.println();
307+
csHigh();
308+
return;
309+
}
310+
311+
void Adafruit_EPD::writeSRAMFramebufferToEPD(uint16_t SRAM_buffer_addr,
312+
uint32_t buffer_size,
313+
uint8_t EPDlocation,
314+
bool invertdata) {
315+
uint8_t c;
316+
317+
// use SRAM
318+
sram.csLow();
319+
// send read command
320+
SPItransfer(MCPSRAM_READ);
321+
// send address
322+
SPItransfer(SRAM_buffer_addr >> 8);
323+
SPItransfer(SRAM_buffer_addr & 0xFF);
324+
325+
// first data byte from SRAM will be transfered in at the same time
326+
// as the EPD command is transferred out
327+
c = writeRAMCommand(EPDlocation);
328+
329+
dcHigh();
330+
for (uint16_t i = 0; i < buffer_size; i++) {
331+
c = SPItransfer(c);
332+
// Serial.print("0x"); Serial.print((byte)c, HEX); Serial.print(", ");
333+
// if (i % 32 == 31) Serial.println();
334+
}
335+
csHigh();
336+
sram.csHigh();
337+
}
338+
284339
/**************************************************************************/
285340
/*!
286341
@brief Transfer the data stored in the buffer(s) to the display
@@ -303,78 +358,30 @@ void Adafruit_EPD::display(bool sleep) {
303358
setRAMAddress(0, 0);
304359

305360
if (use_sram) {
306-
sram.csLow();
307-
// send read command
308-
SPItransfer(MCPSRAM_READ);
309-
// send address
310-
SPItransfer(buffer1_addr >> 8);
311-
SPItransfer(buffer1_addr & 0xFF);
312-
313-
// first data byte from SRAM will be transfered in at the same time
314-
// as the EPD command is transferred out
315-
c = writeRAMCommand(0);
316-
317-
dcHigh();
318-
for (uint16_t i = 0; i < buffer1_size; i++) {
319-
c = SPItransfer(c);
320-
// Serial.print("0x"); Serial.print((byte)c, HEX); Serial.print(", ");
321-
// if (i % 32 == 31) Serial.println();
322-
}
323-
csHigh();
324-
sram.csHigh();
361+
writeSRAMFramebufferToEPD(buffer1_addr, buffer1_size, 0);
325362
} else {
326-
// write image
327-
writeRAMCommand(0);
328-
dcHigh();
329-
for (uint16_t i = 0; i < buffer1_size; i++) {
330-
SPItransfer(buffer1[i]);
331-
}
332-
csHigh();
363+
writeRAMFramebufferToEPD(buffer1, buffer1_size, 0);
333364
}
334365

335-
if (buffer2_size == 0) {
336-
update();
337-
return;
338-
}
339-
340-
// oh there's another buffer eh?
341-
delay(2);
366+
if (buffer2_size != 0) {
367+
// oh there's another buffer eh?
368+
delay(2);
342369

343-
// Set X & Y ram counters
344-
setRAMAddress(0, 0);
370+
// Set X & Y ram counters
371+
setRAMAddress(0, 0);
345372

346-
if (use_sram) {
347-
sram.csLow();
348-
// send read command
349-
SPItransfer(MCPSRAM_READ);
350-
// send address
351-
SPItransfer(buffer2_addr >> 8);
352-
SPItransfer(buffer2_addr & 0xFF);
353-
354-
// first data byte from SRAM will be transfered in at the same time
355-
// as the EPD command is transferred out
356-
c = writeRAMCommand(1);
357-
358-
dcHigh();
359-
for (uint16_t i = 0; i < buffer2_size; i++) {
360-
c = SPItransfer(c);
361-
}
362-
csHigh();
363-
sram.csHigh();
364-
} else {
365-
writeRAMCommand(1);
366-
dcHigh();
367-
368-
for (uint16_t i = 0; i < buffer2_size; i++) {
369-
SPItransfer(buffer2[i]);
373+
if (use_sram) {
374+
writeSRAMFramebufferToEPD(buffer2_addr, buffer2_size, 1);
375+
} else {
376+
writeRAMFramebufferToEPD(buffer2, buffer2_size, 1);
370377
}
371-
csHigh();
372378
}
373379

374380
#ifdef EPD_DEBUG
375381
Serial.println(" Update");
376382
#endif
377383
update();
384+
partialsSinceLastFullUpdate = 0;
378385

379386
if (sleep) {
380387
#ifdef EPD_DEBUG
@@ -441,33 +448,29 @@ void Adafruit_EPD::setColorBuffer(int8_t index, bool inverted) {
441448
/**************************************************************************/
442449
void Adafruit_EPD::clearBuffer() {
443450
if (use_sram) {
444-
if (buffer1_size != 0) {
445-
if (blackInverted) {
446-
sram.erase(buffer1_addr, buffer1_size, 0xFF);
447-
} else {
448-
sram.erase(buffer1_addr, buffer1_size, 0x00);
449-
}
451+
if (blackInverted) {
452+
sram.erase(blackbuffer_addr, buffer1_size, 0xFF);
453+
} else {
454+
sram.erase(blackbuffer_addr, buffer1_size, 0x00);
450455
}
451-
if (buffer2_size != 0) {
452-
if (colorInverted) {
453-
sram.erase(buffer2_addr, buffer2_size, 0xFF);
454-
} else {
455-
sram.erase(buffer2_addr, buffer2_size, 0x00);
456-
}
456+
if (colorInverted) {
457+
sram.erase(colorbuffer_addr, buffer2_size, 0xFF);
458+
} else {
459+
sram.erase(colorbuffer_addr, buffer2_size, 0x00);
457460
}
458461
} else {
459-
if (buffer1) {
462+
if (black_buffer) {
460463
if (blackInverted) {
461-
memset(buffer1, 0xFF, buffer1_size);
464+
memset(black_buffer, 0xFF, buffer1_size);
462465
} else {
463-
memset(buffer1, 0x00, buffer1_size);
466+
memset(black_buffer, 0x00, buffer1_size);
464467
}
465468
}
466-
if (buffer2) {
469+
if (color_buffer) {
467470
if (colorInverted) {
468-
memset(buffer2, 0xFF, buffer2_size);
471+
memset(color_buffer, 0xFF, buffer2_size);
469472
} else {
470-
memset(buffer2, 0x00, buffer2_size);
473+
memset(color_buffer, 0x00, buffer2_size);
471474
}
472475
}
473476
}
@@ -493,9 +496,9 @@ void Adafruit_EPD::EPD_commandList(const uint8_t *init_code) {
493496
uint8_t buf[64];
494497

495498
while (init_code[0] != 0xFE) {
496-
char cmd = init_code[0];
499+
uint8_t cmd = init_code[0];
497500
init_code++;
498-
int num_args = init_code[0];
501+
uint8_t num_args = init_code[0];
499502
init_code++;
500503
if (cmd == 0xFF) {
501504
busy_wait();

0 commit comments

Comments
 (0)