Example 4: Update Modes
In the previous examples, we learned how to initialise the display, how to write different graphics & text and how to use different graylevels. Now let’s have a look at three different ways how to update an ePaper screen.
Update Modes
The E-Paper library defines the following three update modes EPD_UPD_FULL
, EPD_UPD_PART
and EPD_MONO
.
EPD_UPD_FULL
is set by default, achieves four graylevels, takes about 800ms and refreshes all pixels. This is the update mode having the best image quality. EPD_UPD_PART
is a variant of the previous one but only changing pixels are refreshed. This results in less flickering for the price of a slightly higher pixel to pixel crosstalk. EPD_MONO
is again a variant of the previous update mode but only about 250ms long. This allows slightly faster and more responsive updates for the price of supporting only two graylevels (EPD_BLACK
and EPD_WHITE
). Depending on your application it is recommended to insert a full update EPD_UPD_FULL
after a couple of mono updates to increase the image quality.
Demo
Sketch
#include "Adafruit_GFX.h"
#include "PL_microEPD.h"
#define EPD_RST A0
#define EPD_BUSY A1
#define EPD_CS A2
PL_microEPD display(EPD_CS, EPD_RST, EPD_BUSY);
void setup() {
SPI.begin(); // SPI initialisation
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0);
SPI.setClockDivider(SPI_CLOCK_DIV4);
display.begin(); // Paperino ePaper initialisation and refresh screen
display.setTextSize(2);
display.println("Update Modes");
display.setTextSize(1);
display.println("-Full Update");
display.println("-Partial Update");
display.println("-Partial Mono Update");
display.update(); // Triggers a Full update, 4 GL, 800ms
delay(4000);
display.clear();
display.setTextSize(2);
display.print("EPD_UPD_FULL");
display.update(); // Triggers a Full update, 4 GL, 800ms
delay(1000);
display.setTextSize(1);
display.print("This is a ");
display.setTextColor(EPD_WHITE, EPD_BLACK);
display.println("full update.");
display.update();
delay(1000);
display.setTextColor(EPD_BLACK, EPD_WHITE);
display.println("All pixels are reset no matter whether they are changing or not.");
display.update();
delay(2000);
display.println("Hm, a bit boring, isn't it...?");
display.update();
delay(4000);
display.clear();
display.setTextSize(2);
display.print("EPD_UPD_PART");
display.update(EPD_UPD_PART); // Triggers a Partial update, 4 GL, 800ms
delay(1000);
display.setTextSize(1);
display.print("OK! Now you see ");
display.setTextColor(EPD_WHITE, EPD_BLACK);
display.print("partial updates!");
display.update(EPD_UPD_PART);
delay(1000);
display.setTextColor(EPD_BLACK, EPD_WHITE);
display.print(" Only changing pixels are updated. ");
display.update(EPD_UPD_PART);
delay(1000);
display.print("Thisgenerates less flicker and results in lower power consumption. ");
display.update(EPD_UPD_PART);
delay(4000);
display.clear();
display.setTextSize(2);
display.print("EPD_UPD_MONO");
display.update(EPD_UPD_MONO); // Triggers a Partial Mono update, 2 GL, 250ms
delay(1000);
display.setTextSize(1);
display.setTextColor(EPD_WHITE, EPD_BLACK);
display.print("Mono updates");
display.setTextColor(EPD_BLACK, EPD_WHITE);
display.print(" allow a bitfaster update rates ");
display.update(EPD_UPD_MONO);
delay(1000);
display.print("(butsupport only two grey- levels).");
display.update(EPD_UPD_MONO);
delay(1000);
display.drawRect(9, 51, 125, 14, 0);
display.update(EPD_UPD_MONO);
for (int i=1; i<18; i++) {
display.fillRect(6 + 7*i, 53, 5, 10, 0);
display.update(EPD_UPD_MONO);
}
}
void loop() {
}
Congratulation! You now learned the basics of running an ePaper screen. Interested in more? In the next examples we learn how to make use of the integrated accelerometer as a cheap touch emulator.