Skip to content

Commit b9a81b7

Browse files
authored
Merge pull request #109 from e-radionicacom/dev
Fixed vertical lines on Inkplate6Plus (einkOff is now board dependent function), added additional light waveform for Inkplate10, fixed partial updates on all Inkplate boards.
2 parents 8f8e9c1 + e1048fa commit b9a81b7

File tree

7 files changed

+204
-92
lines changed

7 files changed

+204
-92
lines changed

src/Inkplate.cpp

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -82,40 +82,6 @@ void Inkplate::preloadScreen()
8282
memcpy(DMemoryNew, _partial, 60000);
8383
}
8484

85-
/**
86-
* @brief einkOff turns off epaper power supply and put all digital IO
87-
* pins in high Z state
88-
*/
89-
void Inkplate::einkOff()
90-
{
91-
if (getPanelState() == 0)
92-
return;
93-
OE_CLEAR;
94-
GMOD_CLEAR;
95-
GPIO.out &= ~(DATA | LE | CL);
96-
CKV_CLEAR;
97-
SPH_CLEAR;
98-
SPV_CLEAR;
99-
100-
// Put TPS65186 into standby mode (leaving 3V3 SW active)
101-
Wire.beginTransmission(0x48);
102-
Wire.write(0x01);
103-
Wire.write(0x6f);
104-
Wire.endTransmission();
105-
106-
// Wait for all PWR rails to shut down
107-
delay(100);
108-
109-
// Disable 3V3 to the panel
110-
Wire.beginTransmission(0x48);
111-
Wire.write(0x01);
112-
Wire.write(0x4f);
113-
Wire.endTransmission();
114-
115-
pinsZstate();
116-
setPanelState(0);
117-
}
118-
11985
/**
12086
* @brief einkOn turns on supply for epaper display (TPS65186) [+15 VDC,
12187
* -15VDC, +22VDC, -20VDC, +3.3VDC, VCOM]
@@ -129,16 +95,27 @@ int Inkplate::einkOn()
12995
{
13096
if (getPanelState() == 1)
13197
return 1;
98+
13299
WAKEUP_SET;
100+
VCOM_SET;
133101
delay(2);
134-
PWRUP_SET;
135102

136103
// Enable all rails
137104
Wire.beginTransmission(0x48);
138105
Wire.write(0x01);
139-
Wire.write(B00111111);
106+
Wire.write(B00101111);
107+
Wire.endTransmission();
108+
109+
delay(1);
110+
111+
// Switch TPS65186 into active mode
112+
Wire.beginTransmission(0x48);
113+
Wire.write(0x01);
114+
Wire.write(B10101111);
140115
Wire.endTransmission();
116+
141117
pinsAsOutputs();
118+
142119
LE_CLEAR;
143120
OE_CLEAR;
144121
CL_CLEAR;
@@ -147,7 +124,6 @@ int Inkplate::einkOn()
147124
SPV_SET;
148125
CKV_CLEAR;
149126
OE_CLEAR;
150-
VCOM_SET;
151127

152128
unsigned long timer = millis();
153129
do

src/Inkplate.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ class Inkplate : public System, public Graphics
4343
#else
4444
Inkplate(uint8_t _mode);
4545
#endif
46+
47+
#ifdef ARDUINO_INKPLATE10
48+
bool begin(uint8_t lightWaveform = 0); // Special case for Inkplate10
49+
#else
4650
bool begin(void); // In boards
51+
#endif
52+
4753
void clearDisplay();
4854
void display(bool leaveOn = false);
4955
// void writeRow(uint8_t data);
@@ -112,7 +118,7 @@ class Inkplate : public System, public Graphics
112118
uint8_t _beginDone = 0;
113119

114120
#ifdef WAVEFORM3BIT
115-
const uint8_t waveform3Bit[8][9] = WAVEFORM3BIT;
121+
uint8_t waveform3Bit[8][9] = WAVEFORM3BIT;
116122
#endif
117123
};
118124

src/boards/Inkplate10.cpp

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@
3030
* @return True if initialization is successful, false if failed or already
3131
* initialized
3232
*/
33-
bool Inkplate::begin(void)
33+
bool Inkplate::begin(uint8_t lightWaveform)
3434
{
35+
if (lightWaveform)
36+
{
37+
uint8_t alternateWaveform[8][9] = WAVEFORM3BIT_LIGHT;
38+
memcpy(waveform3Bit, alternateWaveform, sizeof(waveform3Bit));
39+
}
3540
if (_beginDone == 1)
3641
return 0;
3742

@@ -200,10 +205,10 @@ void Inkplate::display1b(bool leaveOn)
200205
uint32_t _pos;
201206
uint8_t data;
202207
uint8_t dram;
203-
if (!leaveOn && !einkOn())
204-
{
208+
209+
if (!einkOn())
205210
return;
206-
}
211+
207212
clean(0, 10);
208213
clean(1, 10);
209214
clean(0, 10);
@@ -253,10 +258,9 @@ void Inkplate::display1b(bool leaveOn)
253258
*/
254259
void IRAM_ATTR Inkplate::display3b(bool leaveOn)
255260
{
256-
if (!leaveOn && !einkOn())
257-
{
261+
if (!einkOn())
258262
return;
259-
}
263+
260264
clean(0, 10);
261265
clean(1, 10);
262266
clean(0, 10);
@@ -354,13 +358,8 @@ uint32_t Inkplate::partialUpdate(bool _forced, bool leaveOn)
354358
}
355359
}
356360

357-
if (!leaveOn)
358-
{
359-
if (!einkOn())
360-
{
361-
return 0;
362-
}
363-
}
361+
if (!einkOn())
362+
return 0;
364363

365364
for (int k = 0; k < 5; ++k)
366365
{
@@ -450,4 +449,41 @@ void Inkplate::clean(uint8_t c, uint8_t rep)
450449
}
451450
}
452451

452+
/**
453+
* @brief einkOff turns off epaper power supply and put all digital IO
454+
* pins in high Z state
455+
*/
456+
void Inkplate::einkOff()
457+
{
458+
if (getPanelState() == 0)
459+
return;
460+
OE_CLEAR;
461+
GMOD_CLEAR;
462+
GPIO.out &= ~(DATA | LE | CL);
463+
CKV_CLEAR;
464+
SPH_CLEAR;
465+
SPV_CLEAR;
466+
467+
// Put TPS65186 into standby mode (leaving 3V3 SW active)
468+
VCOM_CLEAR;
469+
Wire.beginTransmission(0x48);
470+
Wire.write(0x01);
471+
Wire.write(0x6f);
472+
Wire.endTransmission();
473+
474+
// Wait for all PWR rails to shut down
475+
delay(100);
476+
477+
// Disable 3V3 to the panel
478+
Wire.beginTransmission(0x48);
479+
Wire.write(0x01);
480+
Wire.write(0x4f);
481+
Wire.endTransmission();
482+
483+
WAKEUP_CLEAR;
484+
485+
pinsZstate();
486+
setPanelState(0);
487+
}
488+
453489
#endif

src/boards/Inkplate10.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,8 @@
8686
{{0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 2, 2, 2, 1, 1, 0}, {0, 2, 1, 1, 2, 2, 1, 0}, {1, 2, 2, 1, 2, 2, 1, 0}, \
8787
{0, 2, 1, 2, 2, 2, 1, 0}, {2, 2, 2, 2, 2, 2, 1, 0}, {0, 0, 0, 0, 2, 1, 2, 0}, {0, 0, 2, 2, 2, 2, 2, 0}};
8888

89+
#define WAVEFORM3BIT_LIGHT \
90+
{{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 2, 2, 1, 2, 1, 0}, {0, 2, 2, 1, 2, 2, 1, 0}, {0, 0, 2, 2, 2, 2, 1, 0}, \
91+
{0, 0, 2, 1, 1, 1, 2, 0}, {0, 2, 2, 2, 1, 1, 2, 0}, {0, 0, 0, 2, 1, 2, 2, 0}, {0, 0, 2, 2, 2, 2, 2, 0}};
92+
8993
#endif

src/boards/Inkplate5.cpp

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,8 @@ void Inkplate::display1b(bool leaveOn)
204204
uint8_t data;
205205
uint8_t dram;
206206

207-
208-
if (!leaveOn && !einkOn())
209-
{
207+
if (!einkOn())
210208
return;
211-
}
212209

213210
clean(0, 17);
214211
clean(1, 17);
@@ -287,10 +284,9 @@ void Inkplate::display1b(bool leaveOn)
287284
*/
288285
void IRAM_ATTR Inkplate::display3b(bool leaveOn)
289286
{
290-
if (!leaveOn && !einkOn())
291-
{
287+
if (!einkOn())
292288
return;
293-
}
289+
294290
clean(0, 17);
295291
clean(1, 17);
296292
clean(0, 17);
@@ -387,13 +383,9 @@ uint32_t Inkplate::partialUpdate(bool _forced, bool leaveOn)
387383
}
388384
}
389385

390-
if (!leaveOn)
391-
{
392-
if (!einkOn())
393-
{
394-
return 0;
395-
}
396-
}
386+
387+
if (!einkOn())
388+
return 0;
397389

398390
for (int k = 0; k < 5; k++)
399391
{
@@ -493,4 +485,42 @@ void Inkplate::clean(uint8_t c, uint8_t rep)
493485
delayMicroseconds(230);
494486
}
495487
}
488+
489+
/**
490+
* @brief einkOff turns off epaper power supply and put all digital IO
491+
* pins in high Z state
492+
*/
493+
void Inkplate::einkOff()
494+
{
495+
if (getPanelState() == 0)
496+
return;
497+
OE_CLEAR;
498+
GMOD_CLEAR;
499+
GPIO.out &= ~(DATA | LE | CL);
500+
CKV_CLEAR;
501+
SPH_CLEAR;
502+
SPV_CLEAR;
503+
504+
// Put TPS65186 into standby mode (leaving 3V3 SW active)
505+
VCOM_CLEAR;
506+
Wire.beginTransmission(0x48);
507+
Wire.write(0x01);
508+
Wire.write(0x6f);
509+
Wire.endTransmission();
510+
511+
// Wait for all PWR rails to shut down
512+
delay(100);
513+
514+
// Disable 3V3 to the panel
515+
Wire.beginTransmission(0x48);
516+
Wire.write(0x01);
517+
Wire.write(0x4f);
518+
Wire.endTransmission();
519+
520+
WAKEUP_CLEAR;
521+
522+
pinsZstate();
523+
setPanelState(0);
524+
}
525+
496526
#endif

src/boards/Inkplate6.cpp

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,8 @@ void Inkplate::display1b(bool leaveOn)
185185
uint8_t data;
186186
uint8_t dram;
187187

188-
if (!leaveOn && !einkOn())
189-
{
188+
if (!einkOn())
190189
return;
191-
}
192190

193191
clean(0, 1);
194192
clean(1, 21);
@@ -301,10 +299,9 @@ void Inkplate::display1b(bool leaveOn)
301299
*/
302300
void Inkplate::display3b(bool leaveOn)
303301
{
304-
if (!leaveOn && !einkOn())
305-
{
302+
if (!einkOn())
306303
return;
307-
}
304+
308305
clean(0, 1);
309306
clean(1, 21);
310307
clean(2, 1);
@@ -405,13 +402,8 @@ uint32_t Inkplate::partialUpdate(bool _forced, bool leaveOn)
405402
}
406403
}
407404

408-
if (!leaveOn)
409-
{
410-
if (!einkOn())
411-
{
412-
return 0;
413-
}
414-
}
405+
if (!einkOn())
406+
return 0;
415407

416408
for (int k = 0; k < 5; ++k)
417409
{
@@ -501,4 +493,41 @@ void Inkplate::clean(uint8_t c, uint8_t rep)
501493
}
502494
}
503495

496+
/**
497+
* @brief einkOff turns off epaper power supply and put all digital IO
498+
* pins in high Z state
499+
*/
500+
void Inkplate::einkOff()
501+
{
502+
if (getPanelState() == 0)
503+
return;
504+
OE_CLEAR;
505+
GMOD_CLEAR;
506+
GPIO.out &= ~(DATA | LE | CL);
507+
CKV_CLEAR;
508+
SPH_CLEAR;
509+
SPV_CLEAR;
510+
511+
// Put TPS65186 into standby mode (leaving 3V3 SW active)
512+
VCOM_CLEAR;
513+
Wire.beginTransmission(0x48);
514+
Wire.write(0x01);
515+
Wire.write(0x6f);
516+
Wire.endTransmission();
517+
518+
// Wait for all PWR rails to shut down
519+
delay(100);
520+
521+
// Disable 3V3 to the panel
522+
Wire.beginTransmission(0x48);
523+
Wire.write(0x01);
524+
Wire.write(0x4f);
525+
Wire.endTransmission();
526+
527+
WAKEUP_CLEAR;
528+
529+
pinsZstate();
530+
setPanelState(0);
531+
}
532+
504533
#endif

0 commit comments

Comments
 (0)