Skip to content

Commit e9f5952

Browse files
committed
really fix busywait, add two more size variants
1 parent 59c5488 commit e9f5952

File tree

5 files changed

+96
-7
lines changed

5 files changed

+96
-7
lines changed

examples/ThinkInk_mono/ThinkInk_mono.ino

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
//ThinkInk_154_Mono_D67 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
1919
//ThinkInk_154_Mono_D27 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2020

21+
// 1.54" Monochrome displays with 152x152 pixels and UC8151D chipset
22+
ThinkInk_154_Mono_M10 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
23+
2124
// 2.13" Monochrome displays with 250x122 pixels and SSD1675 chipset
2225
ThinkInk_213_Mono_B72 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2326

@@ -27,11 +30,14 @@ ThinkInk_213_Mono_B72 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2730
// 2.13" Monochrome displays with 250x122 pixels and SSD1680 chipset
2831
//ThinkInk_213_Mono_BN display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
2932

33+
// 2.13" Monochrome displays with 212x104 pixels and UC8151D chipset
34+
//ThinkInk_213_Mono_M21 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
35+
3036
// 2.9" 4-level Grayscale (use mono) displays with 296x128 pixels and IL0373 chipset
3137
//ThinkInk_290_Grayscale4_T5 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
3238

3339
// 2.9" Monochrome displays with 296x128 pixels and UC8151D chipset
34-
ThinkInk_290_Mono_M06 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
40+
//ThinkInk_290_Mono_M06 display(EPD_DC, EPD_RESET, EPD_CS, SRAM_CS, EPD_BUSY);
3541

3642
// 4.2" Monochrome displays with 400x300 pixels and SSD1619 chipset
3743
//ThinkInk_420_Mono_BN 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
@@ -23,9 +23,11 @@ typedef enum {
2323

2424
#include "panels/ThinkInk_154_Mono_D27.h"
2525
#include "panels/ThinkInk_154_Mono_D67.h"
26+
#include "panels/ThinkInk_154_Mono_M10.h"
2627
#include "panels/ThinkInk_213_Mono_B72.h"
2728
#include "panels/ThinkInk_213_Mono_B73.h"
2829
#include "panels/ThinkInk_213_Mono_BN.h"
30+
#include "panels/ThinkInk_213_Mono_M21.h"
2931
#include "panels/ThinkInk_290_Mono_M06.h"
3032
#include "panels/ThinkInk_420_Mono_BN.h"
3133

src/drivers/Adafruit_UC8151D.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,14 @@ Adafruit_UC8151D::Adafruit_UC8151D(int width, int height, int8_t DC, int8_t RST,
9999
*/
100100
/**************************************************************************/
101101
void Adafruit_UC8151D::busy_wait(void) {
102-
Serial.print("Waiting...");
103102
if (_busy_pin >= 0) {
104-
EPD_command(UC8151D_FLG);
105-
106-
if (digitalRead(_busy_pin)) {
103+
do {
104+
EPD_command(UC8151D_FLG);
107105
delay(10);
108-
}
106+
} while (!digitalRead(_busy_pin));
109107
} else {
110108
delay(BUSY_WAIT);
111109
}
112-
Serial.println("OK!");
113110
}
114111

115112
/**************************************************************************/

src/panels/ThinkInk_154_Mono_M10.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#ifndef _THINKINK_154_MONO_M10_H
2+
#define _THINKINK_154_MONO_M10_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_154_Mono_M10 : public Adafruit_UC8151D {
8+
public:
9+
ThinkInk_154_Mono_M10(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_UC8151D(152, 152, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){};
12+
13+
ThinkInk_154_Mono_M10(int8_t DC, int8_t RST, int8_t CS, int8_t SRCS,
14+
int8_t BUSY = -1, SPIClass *spi = &SPI)
15+
: Adafruit_UC8151D(152, 152, 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+
inkmode = mode; // Preserve ink mode for ImageReader or others
23+
24+
layer_colors[EPD_WHITE] = 0b00;
25+
layer_colors[EPD_BLACK] = 0b01;
26+
layer_colors[EPD_RED] = 0b01;
27+
layer_colors[EPD_GRAY] = 0b01;
28+
layer_colors[EPD_LIGHT] = 0b00;
29+
layer_colors[EPD_DARK] = 0b01;
30+
31+
default_refresh_delay = 1000;
32+
setRotation(1);
33+
powerDown();
34+
}
35+
36+
thinkinkmode_t getMode(void) { return inkmode; }
37+
38+
private:
39+
thinkinkmode_t inkmode; // Ink mode passed to begin()
40+
};
41+
42+
#endif // _THINKINK_154_MONO_M10_H

src/panels/ThinkInk_213_Mono_M21.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#ifndef _THINKINK_213_MONO_M21_H
2+
#define _THINKINK_213_MONO_M21_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_213_Mono_M21 : public Adafruit_UC8151D {
8+
public:
9+
ThinkInk_213_Mono_M21(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_UC8151D(212, 104, SID, SCLK, DC, RST, CS, SRCS, MISO, BUSY){};
12+
13+
ThinkInk_213_Mono_M21(int8_t DC, int8_t RST, int8_t CS, int8_t SRCS,
14+
int8_t BUSY = -1, SPIClass *spi = &SPI)
15+
: Adafruit_UC8151D(212, 104, 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+
inkmode = mode; // Preserve ink mode for ImageReader or others
23+
24+
layer_colors[EPD_WHITE] = 0b00;
25+
layer_colors[EPD_BLACK] = 0b01;
26+
layer_colors[EPD_RED] = 0b01;
27+
layer_colors[EPD_GRAY] = 0b01;
28+
layer_colors[EPD_LIGHT] = 0b00;
29+
layer_colors[EPD_DARK] = 0b01;
30+
31+
default_refresh_delay = 1000;
32+
setRotation(0);
33+
powerDown();
34+
}
35+
36+
thinkinkmode_t getMode(void) { return inkmode; }
37+
38+
private:
39+
thinkinkmode_t inkmode; // Ink mode passed to begin()
40+
};
41+
42+
#endif // _THINKINK_213_MONO_M21_H

0 commit comments

Comments
 (0)