Power up/power down bug fix., clean, new HW seq
- Fixed epaper power up / power down bug that caused problems on some epaper panels (random vertical black lines). Some informations on how to properly pwr up/down TPS65186 Epaper PMIC is missing in datasheet. - Better cleaning (for some reason, whilte color can easly "overcharge" screen, so now the are less white frames than black ones). [This problem is visible if the panel is refreshed multiple times in a row, screen after has been powerd down starts to fade] - Improved HW sequence (there was some issue with line clock and start pulse vertical signal) - Removed vscan_write() function (it's not needed anymore). - Some minor bug fixes
This commit is contained in:
parent
48bee38bca
commit
e16f608d31
141
src/Inkplate.cpp
141
src/Inkplate.cpp
|
@ -198,15 +198,15 @@ void Inkplate::display1b()
|
||||||
uint8_t data;
|
uint8_t data;
|
||||||
uint8_t dram;
|
uint8_t dram;
|
||||||
einkOn();
|
einkOn();
|
||||||
cleanFast(0, 1);
|
cleanFast(0, 1);
|
||||||
cleanFast(1, 12);
|
cleanFast(1, 16);
|
||||||
cleanFast(2, 1);
|
cleanFast(2, 1);
|
||||||
cleanFast(0, 11);
|
cleanFast(0, 11);
|
||||||
cleanFast(2, 1);
|
cleanFast(2, 1);
|
||||||
cleanFast(1, 12);
|
cleanFast(1, 16);
|
||||||
cleanFast(2, 1);
|
cleanFast(2, 1);
|
||||||
cleanFast(0, 11);
|
cleanFast(0, 11);
|
||||||
for (int k = 0; k < 3; ++k)
|
for (int k = 0; k < 4; ++k)
|
||||||
{
|
{
|
||||||
uint8_t *DMemoryNewPtr = DMemoryNew + 59999;
|
uint8_t *DMemoryNewPtr = DMemoryNew + 59999;
|
||||||
vscan_start();
|
vscan_start();
|
||||||
|
@ -303,14 +303,14 @@ void Inkplate::display1b()
|
||||||
void Inkplate::display3b()
|
void Inkplate::display3b()
|
||||||
{
|
{
|
||||||
einkOn();
|
einkOn();
|
||||||
cleanFast(0, 1);
|
cleanFast(0, 1);
|
||||||
cleanFast(1, 12);
|
cleanFast(1, 16);
|
||||||
cleanFast(2, 1);
|
cleanFast(2, 1);
|
||||||
cleanFast(0, 11);
|
cleanFast(0, 11);
|
||||||
cleanFast(2, 1);
|
cleanFast(2, 1);
|
||||||
cleanFast(1, 12);
|
cleanFast(1, 16);
|
||||||
cleanFast(2, 1);
|
cleanFast(2, 1);
|
||||||
cleanFast(0, 11);
|
cleanFast(0, 11);
|
||||||
|
|
||||||
for (int k = 0; k < 8; ++k)
|
for (int k = 0; k < 8; ++k)
|
||||||
{
|
{
|
||||||
|
@ -370,7 +370,6 @@ void Inkplate::display3b()
|
||||||
}
|
}
|
||||||
delayMicroseconds(230);
|
delayMicroseconds(230);
|
||||||
}
|
}
|
||||||
cleanFast(2, 1);
|
|
||||||
cleanFast(3, 1);
|
cleanFast(3, 1);
|
||||||
vscan_start();
|
vscan_start();
|
||||||
einkOff();
|
einkOff();
|
||||||
|
@ -490,29 +489,64 @@ void Inkplate::cleanFast(uint8_t c, uint8_t rep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Turn off epaper power supply and put all digital IO pins in high Z state
|
||||||
|
void Inkplate::einkOff()
|
||||||
|
{
|
||||||
|
if (getPanelState() == 0)
|
||||||
|
return;
|
||||||
|
OE_CLEAR;
|
||||||
|
GMOD_CLEAR;
|
||||||
|
GPIO.out &= ~(DATA | LE | CL);
|
||||||
|
CKV_CLEAR;
|
||||||
|
SPH_CLEAR;
|
||||||
|
SPV_CLEAR;
|
||||||
|
|
||||||
|
VCOM_CLEAR;
|
||||||
|
delay(6);
|
||||||
|
PWRUP_CLEAR;
|
||||||
|
WAKEUP_CLEAR;
|
||||||
|
delay(50);
|
||||||
|
pinsZstate();
|
||||||
|
setPanelState(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Turn on supply for epaper display (TPS65186) [+15 VDC, -15VDC, +22VDC, -20VDC, +3.3VDC, VCOM]
|
||||||
void Inkplate::einkOn()
|
void Inkplate::einkOn()
|
||||||
{
|
{
|
||||||
if (getPanelState() == 1)
|
if (getPanelState() == 1)
|
||||||
return;
|
return;
|
||||||
setPanelState(1);
|
|
||||||
pinsAsOutputs();
|
|
||||||
WAKEUP_SET;
|
WAKEUP_SET;
|
||||||
PWRUP_SET;
|
delay(1);
|
||||||
VCOM_SET;
|
Wire.beginTransmission(0x48);
|
||||||
|
Wire.write(0x09);
|
||||||
|
Wire.write(B00011011); //Power up seq.
|
||||||
|
Wire.write(B00000000); //Power up delay (3mS per rail)
|
||||||
|
Wire.write(B00011011); //Power down seq.
|
||||||
|
Wire.write(B00000000); //Power down delay (6mS per rail)
|
||||||
|
Wire.endTransmission();
|
||||||
|
|
||||||
|
PWRUP_SET;
|
||||||
|
|
||||||
|
//Enable all rails
|
||||||
Wire.beginTransmission(0x48);
|
Wire.beginTransmission(0x48);
|
||||||
Wire.write(0x01);
|
Wire.write(0x01);
|
||||||
Wire.write(B00111111);
|
Wire.write(B00111111);
|
||||||
Wire.endTransmission();
|
Wire.endTransmission();
|
||||||
|
pinsAsOutputs();
|
||||||
delay(40);
|
LE_CLEAR;
|
||||||
|
OE_CLEAR;
|
||||||
Wire.beginTransmission(0x48);
|
CL_CLEAR;
|
||||||
|
SPH_SET;
|
||||||
|
GMOD_SET;
|
||||||
|
SPV_SET;
|
||||||
|
CKV_CLEAR;
|
||||||
|
OE_CLEAR;
|
||||||
|
VCOM_SET;
|
||||||
|
Wire.beginTransmission(0x48);
|
||||||
Wire.write(0x0D);
|
Wire.write(0x0D);
|
||||||
Wire.write(B10000000);
|
Wire.write(B10000000);
|
||||||
Wire.endTransmission();
|
Wire.endTransmission();
|
||||||
|
delay(5);
|
||||||
delay(2);
|
|
||||||
|
|
||||||
Wire.beginTransmission(0x48);
|
Wire.beginTransmission(0x48);
|
||||||
Wire.write(0x00);
|
Wire.write(0x00);
|
||||||
|
@ -521,32 +555,10 @@ void Inkplate::einkOn()
|
||||||
Wire.requestFrom(0x48, 1);
|
Wire.requestFrom(0x48, 1);
|
||||||
setTemperature(Wire.read());
|
setTemperature(Wire.read());
|
||||||
|
|
||||||
LE_CLEAR;
|
pinModeMCP(7, INPUT_PULLUP);
|
||||||
OE_CLEAR;
|
while(!digitalReadMCP(7));
|
||||||
CL_CLEAR;
|
OE_SET;
|
||||||
SPH_SET;
|
setPanelState(1);
|
||||||
GMOD_SET;
|
|
||||||
SPV_SET;
|
|
||||||
CKV_CLEAR;
|
|
||||||
OE_SET;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Inkplate::einkOff()
|
|
||||||
{
|
|
||||||
if (getPanelState() == 0)
|
|
||||||
return;
|
|
||||||
setPanelState(0);
|
|
||||||
GMOD_CLEAR;
|
|
||||||
OE_CLEAR;
|
|
||||||
GPIO.out &= ~(DATA | CL | LE);
|
|
||||||
SPH_CLEAR;
|
|
||||||
SPV_CLEAR;
|
|
||||||
|
|
||||||
PWRUP_CLEAR;
|
|
||||||
WAKEUP_CLEAR;
|
|
||||||
VCOM_CLEAR;
|
|
||||||
|
|
||||||
pinsZstate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOW LEVEL FUNCTIONS
|
// LOW LEVEL FUNCTIONS
|
||||||
|
@ -576,25 +588,13 @@ void Inkplate::vscan_start()
|
||||||
CKV_SET;
|
CKV_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inkplate::vscan_write()
|
|
||||||
{
|
|
||||||
CKV_CLEAR;
|
|
||||||
LE_SET;
|
|
||||||
LE_CLEAR;
|
|
||||||
delayMicroseconds(0);
|
|
||||||
SPH_CLEAR;
|
|
||||||
CL_SET;
|
|
||||||
CL_CLEAR;
|
|
||||||
SPH_SET;
|
|
||||||
CKV_SET;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Inkplate::hscan_start(uint32_t _d)
|
void Inkplate::hscan_start(uint32_t _d)
|
||||||
{
|
{
|
||||||
SPH_CLEAR;
|
SPH_CLEAR;
|
||||||
GPIO.out_w1ts = (_d) | CL;
|
GPIO.out_w1ts = (_d) | CL;
|
||||||
GPIO.out_w1tc = DATA | CL;
|
GPIO.out_w1tc = DATA | CL;
|
||||||
SPH_SET;
|
SPH_SET;
|
||||||
|
CKV_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inkplate::vscan_end()
|
void Inkplate::vscan_end()
|
||||||
|
@ -602,8 +602,7 @@ void Inkplate::vscan_end()
|
||||||
CKV_CLEAR;
|
CKV_CLEAR;
|
||||||
LE_SET;
|
LE_SET;
|
||||||
LE_CLEAR;
|
LE_CLEAR;
|
||||||
delayMicroseconds(1);
|
delayMicroseconds(0);
|
||||||
CKV_SET;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inkplate::pinsZstate()
|
void Inkplate::pinsZstate()
|
||||||
|
|
|
@ -51,7 +51,6 @@ private:
|
||||||
void display3b();
|
void display3b();
|
||||||
void cleanFast(uint8_t c, uint8_t rep);
|
void cleanFast(uint8_t c, uint8_t rep);
|
||||||
void vscan_start();
|
void vscan_start();
|
||||||
void vscan_write();
|
|
||||||
void vscan_end();
|
void vscan_end();
|
||||||
void hscan_start(uint32_t _d = 0);
|
void hscan_start(uint32_t _d = 0);
|
||||||
void pinsZstate();
|
void pinsZstate();
|
||||||
|
|
Loading…
Reference in New Issue