fixed code format on last commit + added partial test.

This commit is contained in:
nitko12 2020-10-12 10:20:53 +02:00
parent fc268c7655
commit ef1a7f79b6
3 changed files with 40 additions and 12 deletions

View File

@ -160,7 +160,7 @@ void Inkplate::begin(void)
memset(_partial, 0, 60000); memset(_partial, 0, 60000);
memset(_pBuffer, 0, 120000); memset(_pBuffer, 0, 120000);
memset(D_memory4Bit, 255, 240000); memset(D_memory4Bit, 255, 240000);
_beginDone = 1; _beginDone = 1;
} }
@ -495,9 +495,10 @@ void Inkplate::einkOff()
delay(6); delay(6);
PWRUP_CLEAR; PWRUP_CLEAR;
WAKEUP_CLEAR; WAKEUP_CLEAR;
unsigned long timer = millis(); unsigned long timer = millis();
do { do
{
delay(1); delay(1);
} while ((readPowerGood() != 0) && (millis() - timer) < 250); } while ((readPowerGood() != 0) && (millis() - timer) < 250);
@ -531,26 +532,28 @@ void Inkplate::einkOn()
VCOM_SET; VCOM_SET;
unsigned long timer = millis(); unsigned long timer = millis();
do { do
{
delay(1); delay(1);
} while ((readPowerGood() != PWR_GOOD_OK) && (millis() - timer) < 250); } while ((readPowerGood() != PWR_GOOD_OK) && (millis() - timer) < 250);
if ((millis() - timer) >= 250) if ((millis() - timer) >= 250)
{ {
WAKEUP_CLEAR; WAKEUP_CLEAR;
VCOM_CLEAR; VCOM_CLEAR;
PWRUP_CLEAR; PWRUP_CLEAR;
return; return;
} }
OE_SET; OE_SET;
setPanelState(1); setPanelState(1);
} }
uint8_t Inkplate::readPowerGood() { uint8_t Inkplate::readPowerGood()
{
Wire.beginTransmission(0x48); Wire.beginTransmission(0x48);
Wire.write(0x0F); Wire.write(0x0F);
Wire.endTransmission(); Wire.endTransmission();
Wire.requestFrom(0x48, 1); Wire.requestFrom(0x48, 1);
return Wire.read(); return Wire.read();
} }

View File

@ -32,7 +32,7 @@ uint8_t System::getPanelState()
int8_t System::readTemperature() int8_t System::readTemperature()
{ {
int8_t temp; int8_t temp;
if(getPanelState() == 0) if (getPanelState() == 0)
{ {
WAKEUP_SET; WAKEUP_SET;
PWRUP_SET; PWRUP_SET;
@ -50,7 +50,7 @@ int8_t System::readTemperature()
Wire.requestFrom(0x48, 1); Wire.requestFrom(0x48, 1);
temp = Wire.read(); temp = Wire.read();
if(getPanelState() == 0) if (getPanelState() == 0)
{ {
PWRUP_CLEAR; PWRUP_CLEAR;
WAKEUP_CLEAR; WAKEUP_CLEAR;

25
test/partial/partial.ino Normal file
View File

@ -0,0 +1,25 @@
#include "Inkplate.h"
Inkplate display(INKPLATE_1BIT);
void setup()
{
Serial.begin(115200);
display.begin();
}
void loop()
{
for (int j = 0; j < 50; ++j)
{
for (int i = 0; i < 100; ++i)
display.drawFastVLine(i * 5 + j * 3, 0, 600, BLACK);
for (int i = 0; i < 100; ++i)
display.drawFastHLine(j * 3, i * 5, 800, BLACK);
display.partialUpdate();
display.clearDisplay();
}
display.clean();
display.display();
}