Skip to content

Commit ed7dacf

Browse files
committed
Fix in VCOM programming for inkplate 6
1 parent df8bce1 commit ed7dacf

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

examples/Inkplate10/Others/Inkplate_Factory_Programming_VCOM/Inkplate_Factory_Programming_VCOM.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ void writeVCOMToEEPROM(double v)
489489
vcomH = readReg(0x04);
490490
Serial.print("Vcom: ");
491491
Serial.println(vcom);
492+
Serial.print("Vcom register: ");
492493
Serial.println(vcomL | (vcomH << 8));
493494

494495
if (vcom != (vcomL | (vcomH << 8)))

examples/Inkplate6/Others/Inkplate_Factory_Programming_VCOM/Inkplate_Factory_Programming_VCOM.ino

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ int EEPROMaddress = 0;
1313
char commandBuffer[BUFFER_SIZE + 1];
1414
char strTemp[2001];
1515

16+
uint8_t mcpRegsInt[22];
17+
1618
void setup()
1719
{
1820
display.begin();
@@ -21,10 +23,10 @@ void setup()
2123

2224
if (EEPROM.read(EEPROMaddress) != 170)
2325
{
24-
display.digitalWriteMCP(3, HIGH);
25-
display.digitalWriteMCP(4, HIGH);
26-
display.digitalWriteMCP(5, HIGH);
27-
display.pinModeMCP(6, INPUT_PULLUP);
26+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 3, HIGH);
27+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 4, HIGH);
28+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 5, HIGH);
29+
display.pinModeInternal(MCP23017_ADDR, mcpRegsInt, 6, INPUT_PULLUP);
2830
display.display();
2931
display.einkOn();
3032
delay(100);
@@ -36,6 +38,7 @@ void setup()
3638
Serial.print(vcomVoltage, 2);
3739
Serial.println("V");
3840
delay(1000);
41+
display.pinModeInternal(MCP23017_INT_ADDR, mcpRegsInt, 6, INPUT_PULLUP);
3942
writeVCOMToEEPROM(vcomVoltage);
4043
EEPROM.write(EEPROMaddress, 170);
4144
EEPROM.commit();
@@ -402,7 +405,7 @@ uint8_t readReg(uint8_t _reg)
402405

403406
void showSplashScreen()
404407
{
405-
display.clean();
408+
display.clean(0, 1);
406409
display.display();
407410
display.selectDisplayMode(INKPLATE_3BIT);
408411
display.drawBitmap3Bit(0, 0, picture1, picture1_w, picture1_h);
@@ -414,11 +417,12 @@ void showSplashScreen()
414417
display.display();
415418
}
416419

420+
//Inkplate 6 Null waveform
417421
void writeToScreen()
418422
{
419-
display.cleanFast(1, 8);
420-
display.cleanFast(0, 2);
421-
display.cleanFast(2, 10);
423+
display.clean(1, 8);
424+
display.clean(0, 2);
425+
display.clean(2, 10);
422426
// delay(10);
423427
}
424428

@@ -430,7 +434,7 @@ double readVCOM()
430434
writeToScreen();
431435
writeReg(0x04, (readReg(0x04) | B10000000));
432436
delay(10);
433-
while (display.digitalReadMCP(6))
437+
while (display.digitalReadInternal(MCP23017_ADDR, mcpRegsInt,6))
434438
{
435439
delay(1);
436440
};
@@ -449,10 +453,10 @@ void writeVCOMToEEPROM(double v)
449453
vcomL = vcom & 0xFF;
450454
// First, we have to power up TPS65186
451455
// Pull TPS65186 WAKEUP pin to High
452-
display.digitalWriteMCP(3, HIGH);
456+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 3, HIGH);
453457

454458
// Pull TPS65186 PWR pin to High
455-
display.digitalWriteMCP(4, HIGH);
459+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 4, HIGH);
456460
delay(10);
457461

458462
// Send to TPS65186 first 8 bits of VCOM
@@ -470,30 +474,35 @@ void writeVCOMToEEPROM(double v)
470474
do
471475
{
472476
delay(1);
473-
} while (display.digitalReadMCP(6));
477+
} while (display.digitalReadInternal(MCP23017_ADDR, mcpRegsInt, 6));
474478

475479
// Clear Interrupt flag by reading INT1 register
476480
readReg(0x07);
477481

478482
// Now, power off whole TPS
479483
// Pull TPS65186 WAKEUP pin to Low
480-
display.digitalWriteMCP(3, LOW);
484+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 3, LOW);
481485

482486
// Pull TPS65186 PWR pin to Low
483-
display.digitalWriteMCP(4, LOW);
487+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 4, LOW);
484488

485489
// Wait a little bit...
486490
delay(1000);
487491

488492
// Power up TPS again
489-
display.digitalWriteMCP(3, HIGH);
493+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 3, HIGH);
490494

491495
delay(10);
492496

493497
// Read VCOM valuse from registers
494498
vcomL = readReg(0x03);
495499
vcomH = readReg(0x04);
496500

501+
Serial.print("Vcom: ");
502+
Serial.println(vcom);
503+
Serial.print("Vcom register: ");
504+
Serial.println((vcomL | (vcomH << 8)));
505+
497506
if (vcom != (vcomL | (vcomH << 8)))
498507
{
499508
Serial.println("\nVCOM EEPROM PROGRAMMING FAILED!\n");

0 commit comments

Comments
 (0)