Skip to content

Commit bc3766b

Browse files
committed
Added new selectable waveform for Inkplate10, einkOff() is now board dependent due vertical lines on Inkplate6Plus.
1 parent d89b514 commit bc3766b

File tree

7 files changed

+181
-40
lines changed

7 files changed

+181
-40
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); // In boards
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: 43 additions & 1 deletion
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

@@ -450,4 +455,41 @@ void Inkplate::clean(uint8_t c, uint8_t rep)
450455
}
451456
}
452457

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

src/boards/Inkplate10.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,12 @@
8282
#define MCP23017_PIN_A7 7
8383
#define MCP23017_PIN_B0 8
8484

85-
#define WAVEFORM3BIT \
85+
#define WAVEFORM3BIT \
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: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,4 +493,42 @@ void Inkplate::clean(uint8_t c, uint8_t rep)
493493
delayMicroseconds(230);
494494
}
495495
}
496+
497+
/**
498+
* @brief einkOff turns off epaper power supply and put all digital IO
499+
* pins in high Z state
500+
*/
501+
void Inkplate::einkOff()
502+
{
503+
if (getPanelState() == 0)
504+
return;
505+
OE_CLEAR;
506+
GMOD_CLEAR;
507+
GPIO.out &= ~(DATA | LE | CL);
508+
CKV_CLEAR;
509+
SPH_CLEAR;
510+
SPV_CLEAR;
511+
512+
// Put TPS65186 into standby mode (leaving 3V3 SW active)
513+
VCOM_CLEAR;
514+
Wire.beginTransmission(0x48);
515+
Wire.write(0x01);
516+
Wire.write(0x6f);
517+
Wire.endTransmission();
518+
519+
// Wait for all PWR rails to shut down
520+
delay(100);
521+
522+
// Disable 3V3 to the panel
523+
Wire.beginTransmission(0x48);
524+
Wire.write(0x01);
525+
Wire.write(0x4f);
526+
Wire.endTransmission();
527+
528+
WAKEUP_CLEAR;
529+
530+
pinsZstate();
531+
setPanelState(0);
532+
}
533+
496534
#endif

src/boards/Inkplate6.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,4 +501,41 @@ void Inkplate::clean(uint8_t c, uint8_t rep)
501501
}
502502
}
503503

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

src/boards/Inkplate6plus.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,4 +522,42 @@ uint32_t Inkplate::partialUpdate(bool _forced, bool leaveOn)
522522
return changeCount;
523523
}
524524

525+
/**
526+
* @brief einkOff turns off epaper power supply and put all digital IO
527+
* pins in high Z state
528+
*/
529+
void Inkplate::einkOff()
530+
{
531+
if (getPanelState() == 0)
532+
return;
533+
OE_CLEAR;
534+
GMOD_CLEAR;
535+
GPIO.out &= ~(DATA | LE | CL);
536+
CKV_CLEAR;
537+
SPH_CLEAR;
538+
SPV_CLEAR;
539+
540+
// Put TPS65186 into standby mode (leaving 3V3 SW active)
541+
VCOM_CLEAR;
542+
Wire.beginTransmission(0x48);
543+
Wire.write(0x01);
544+
Wire.write(0x6f);
545+
Wire.endTransmission();
546+
547+
// Wait for all PWR rails to shut down
548+
delay(100);
549+
550+
// Disable 3V3 to the panel
551+
Wire.beginTransmission(0x48);
552+
Wire.write(0x01);
553+
Wire.write(0x4f);
554+
Wire.endTransmission();
555+
556+
// Clearing WAKEUP pin can cause vertical lines on panel
557+
//WAKEUP_CLEAR;
558+
559+
pinsZstate();
560+
setPanelState(0);
561+
}
562+
525563
#endif

0 commit comments

Comments
 (0)