Skip to content

Commit

Permalink
One more power up and power down TPS code fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
BornaBiro committed Aug 10, 2024
1 parent 64fa39c commit c9492d9
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions src/Inkplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,40 +104,37 @@ int Inkplate::einkOn()
WAKEUP_SET;
delay(5);

// Modify power up sequence.
Wire.beginTransmission(0x48);
Wire.write(0x09);
Wire.write(B11100100);
Wire.endTransmission();

// Modify power down sequence (VEE and VNEG are swapped)
Wire.beginTransmission(0x48);
Wire.write(0x0b);
Wire.write(B00011011);
Wire.endTransmission();

#ifdef ARDUINO_INKPLATE6PLUSV2
if (pwrMode != INKPLATE_USB_PWR_ONLY)
{
// Enable all rails
Wire.beginTransmission(0x48);
Wire.write(0x01);
Wire.write(B00111111);
Wire.write(B00100000);
Wire.endTransmission();
}
#else
// Enable all rails
Wire.beginTransmission(0x48);
Wire.write(0x01);
Wire.write(B00111111);
Wire.write(B00100000);
Wire.endTransmission();
#endif

PWRUP_SET;
// Modify power up sequence.
Wire.beginTransmission(0x48);
Wire.write(0x09);
Wire.write(B11100100);
Wire.endTransmission();

// Modify power down sequence (VEE and VNEG are swapped)
Wire.beginTransmission(0x48);
Wire.write(0x0b);
Wire.write(B00011011);
Wire.endTransmission();

pinsAsOutputs();
LE_CLEAR;
OE_CLEAR;
#if !defined(ARDUINO_ESP32_DEV) && !defined(ARDUINO_INKPLATE6V2) && !defined(ARDUINO_INKPLATE6FLICK)
CL_CLEAR;
#endif
Expand All @@ -146,7 +143,8 @@ int Inkplate::einkOn()
SPV_SET;
CKV_CLEAR;
OE_CLEAR;
VCOM_SET;
PWRUP_SET;
setPanelState(1);

unsigned long timer = millis();
do
Expand All @@ -155,13 +153,12 @@ int Inkplate::einkOn()
} while ((readPowerGood() != PWR_GOOD_OK) && (millis() - timer) < 250);
if ((millis() - timer) >= 250)
{
VCOM_CLEAR;
PWRUP_CLEAR;
einkOff();
return 0;
}

VCOM_SET;
OE_SET;
setPanelState(1);

return 1;
}
Expand All @@ -174,6 +171,7 @@ void Inkplate::einkOff()
{
if (getPanelState() == 0)
return;
VCOM_CLEAR;
OE_CLEAR;
GMOD_CLEAR;
#if !defined(ARDUINO_ESP32_DEV) && !defined(ARDUINO_INKPLATE6V2) && !defined(ARDUINO_INKPLATE6FLICK)
Expand All @@ -184,8 +182,6 @@ void Inkplate::einkOff()
CKV_CLEAR;
SPH_CLEAR;
SPV_CLEAR;

VCOM_CLEAR;
PWRUP_CLEAR;

unsigned long timer = millis();
Expand All @@ -200,7 +196,11 @@ void Inkplate::einkOff()
if (pwrMode != INKPLATE_USB_PWR_ONLY)
WAKEUP_CLEAR;
#else
WAKEUP_CLEAR;
WAKEUP_CLEAR; // Disable 3V3 Switch for ePaper.
Wire.beginTransmission(0x48);
Wire.write(0x01);
Wire.write(B00000000);
Wire.endTransmission();
#endif
#endif

Expand Down

0 comments on commit c9492d9

Please sign in to comment.