Skip to content

Commit d2a6d82

Browse files
committed
Fixed vertical lines on Inkplate6Plus after panel power down, fixed leaveOn bug on Inkplate6Plus on 1 bit full refresh mode, fixed VCOM programming (problem with sending commands to wrong MCP)
1 parent 7923e00 commit d2a6d82

File tree

3 files changed

+58
-61
lines changed

3 files changed

+58
-61
lines changed

examples/Inkplate6PLUS/Others/Inkplate_Factory_Programming_VCOM/Inkplate_Factory_Programming_VCOM.ino

Lines changed: 44 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ void setup()
2121

2222
if (EEPROM.read(EEPROMaddress) != 170)
2323
{
24-
display.digitalWriteMCP(3, HIGH);
25-
display.digitalWriteMCP(4, HIGH);
26-
display.digitalWriteMCP(5, HIGH);
27-
display.pinModeMCP(6, INPUT_PULLUP);
24+
display.einkOn();
25+
display.pinModeInternal(MCP23017_INT_ADDR, display.mcpRegsInt, 6, INPUT_PULLUP);
2826
display.display();
2927
display.einkOn();
3028
delay(100);
@@ -421,7 +419,7 @@ void writeToScreen()
421419
double readVCOM()
422420
{
423421
double vcomVolts;
424-
writeReg(0x01, B00111111); // enable all rails
422+
display.einkOn();
425423
writeReg(0x04, (readReg(0x04) | B00100000));
426424
writeToScreen();
427425
writeReg(0x04, (readReg(0x04) | B10000000));
@@ -439,62 +437,57 @@ double readVCOM()
439437

440438
void writeVCOMToEEPROM(double v)
441439
{
442-
int vcom = int(abs(v) * 100);
443-
int vcomH = (vcom >> 8) & 1;
444-
int vcomL = vcom & 0xFF;
445-
// First, we have to power up TPS65186
446-
// Pull TPS65186 WAKEUP pin to High
447-
display.digitalWriteMCP(3, HIGH);
448-
449-
// Pull TPS65186 PWR pin to High
450-
display.digitalWriteMCP(4, HIGH);
451-
delay(10);
440+
int vcom = int(abs(v) * 100);
441+
int vcomH = (vcom >> 8) & 1;
442+
int vcomL = vcom & 0xFF;
452443

453-
// Send to TPS65186 first 8 bits of VCOM
454-
writeReg(0x03, vcomL);
444+
// Set MCP23017 pin where TPS65186 INT pin is connectet to input pull up
445+
display.pinModeInternal(MCP23017_INT_ADDR, display.mcpRegsInt, 6, INPUT_PULLUP);
455446

456-
// Send new value of register to TPS
457-
writeReg(0x04, vcomH);
458-
delay(1);
447+
// First power up TPS65186 so we can communicate with it
448+
display.einkOn();
459449

460-
// Program VCOM value to EEPROM
461-
writeReg(0x04, vcomH | (1 << 6));
450+
// Send to TPS65186 first 8 bits of VCOM
451+
writeReg(0x03, vcomL);
462452

463-
// Wait until EEPROM has been programmed
464-
delay(1);
465-
do
466-
{
467-
delay(1);
468-
} while (display.digitalReadMCP(6));
453+
// Send new value of register to TPS
454+
writeReg(0x04, vcomH);
455+
delay(1);
469456

470-
// Clear Interrupt flag by reading INT1 register
471-
readReg(0x07);
457+
// Program VCOM value to EEPROM
458+
writeReg(0x04, vcomH | (1 << 6));
472459

473-
// Now, power off whole TPS
474-
// Pull TPS65186 WAKEUP pin to Low
475-
display.digitalWriteMCP(3, LOW);
460+
// Wait until EEPROM has been programmed
461+
delay(1);
462+
do
463+
{
464+
delay(1);
465+
} while (display.digitalReadInternal(MCP23017_INT_ADDR, display.mcpRegsInt, 6));
476466

477-
// Pull TPS65186 PWR pin to Low
478-
display.digitalWriteMCP(4, LOW);
467+
// Clear Interrupt flag by reading INT1 register
468+
readReg(0x07);
479469

480-
// Wait a little bit...
481-
delay(1000);
470+
// Now, power off whole TPS
471+
display.einkOff();
482472

483-
// Power up TPS again
484-
display.digitalWriteMCP(3, HIGH);
473+
// Wait a little bit...
474+
delay(1000);
485475

486-
delay(10);
476+
// Power up TPS again
477+
display.einkOn();
487478

488-
// Read VCOM valuse from registers
489-
vcomL = readReg(0x03);
490-
vcomH = readReg(0x04);
479+
delay(10);
491480

492-
if (vcom != (vcomL | (vcomH << 8)))
493-
{
494-
Serial.println("\nVCOM EEPROM PROGRAMMING FAILED!\n");
495-
}
496-
else
497-
{
498-
Serial.println("\nVCOM EEPROM PROGRAMMING OK\n");
499-
}
481+
// Read VCOM valuse from registers
482+
vcomL = readReg(0x03);
483+
vcomH = readReg(0x04);
484+
485+
if (vcom != (vcomL | (vcomH << 8)))
486+
{
487+
Serial.println("\nVCOM EEPROM PROGRAMMING FAILED!\n");
488+
}
489+
else
490+
{
491+
Serial.println("\nVCOM EEPROM PROGRAMMING OK\n");
492+
}
500493
}

src/Inkplate.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,20 @@ void Inkplate::einkOff()
9797
SPH_CLEAR;
9898
SPV_CLEAR;
9999

100-
VCOM_CLEAR;
101-
delay(6);
102-
PWRUP_CLEAR;
103-
WAKEUP_CLEAR;
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();
104105

105-
unsigned long timer = millis();
106-
do
107-
{
108-
delay(1);
109-
} while ((readPowerGood() != 0) && (millis() - timer) < 250);
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();
110114

111115
pinsZstate();
112116
setPanelState(0);

src/boards/Inkplate6plus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ void Inkplate::display1b(bool leaveOn)
344344
clean(3, 1);
345345
vscan_start();
346346

347-
if (leaveOn)
347+
if (!leaveOn)
348348
einkOff();
349349
_blockPartial = 0;
350350
}

0 commit comments

Comments
 (0)