拆解与点亮:ESP32驱动二手汉朔4.2寸电子墨水屏的测试之路(二)
目录
接上篇文章:
拆解与点亮:ESP32驱动二手汉朔4.2寸电子墨水屏的测试之路(一)
经过了几天的折腾,终于把汉朔4.2寸电子墨水屏完整点亮!
在这里继续记录过程。
关键信息-双IC
在这个地址,看到了非常关键的信息
https://hackaday.io/project/191055-magicpaper-a-epaper-kit/log/220099-hink-e042a03-a1
(其实,在之前引用的网络资料就有转载这篇文章的。只是当时没有太留意这个信息点)
主要是说HINK-E042A03-A1这个型号的电子墨水屏(这款4.2寸的汉朔用的也是这个)是通过2个IC来驱动的,突然就恍然大悟,因为这并不是修改下分辨率就行,而是需要对另一个芯片进行片选操作写数据。
对比datasheet,可以发现这个24pin的引脚,大部分都和其他墨水屏的24pin引脚差不多,唯一只有1号引脚不一样,其作用是CS1,那就是芯片选片用的。
找到关键例子程序-双IC的电子墨水屏驱动
那么程序,就是需要支持双IC屏幕的,
根据ESP32/电子墨水屏/双IC关键词在网络上继续搜索,没想到还真的是能找到:
【PCB外壳系列】老王的4.2寸墨水屏_驱动板支持双IC屏幕
https://oshwhub.com/xljxlj/4-2-cun-mo-shui-ping--qu-dong-ban
这位大佬已经把在附件里面放有双IC的Arduino驱动库,基于GXEPD2的,大佬他自己改的,可能有BUG,欢迎反馈。
程序下载解压后,把文件夹「GxEPD2_2IC」放到Arduino IDE的libraries文件夹中(库目录)
安装库
开打刚安装好的「GxEPD2_2IC」库的例子:
菜单栏「File」--->「Examples」--->「GxEPD2_2IC」--->「GxEPD2_Example」,如下图:
测试程序
可以看到Pin口定义部分在CS 那里是可以定义2个引脚,
把程序的定义pin口改了一下,上传程序先试一试:
GxEPD2_2IC_BW<GxEPD2_2IC_420_A03, GxEPD2_2IC_420_A03::HEIGHT> display(GxEPD2_2IC_420_A03(/*CS=5*/ 5,14, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH042A03-A1
屏幕是有反应的,显示的东西好像缺失了,但大概能看到是什么图案。
飞线手术
接下来就很有信心去完全点亮了,理论上只需要飞一条线出来。
但在这驱动板上处理有点难度,万一手残焊接烂了得不尝失,于是我在某宝中购买了一些24P的FPC延长板。
等收到货后,我就直接在延长板上对应的Pin 1引脚中,飞一条杜邦线出来
经过检查第一次焊接的引脚搞错了,继续。。。
终于焊接好了,以下图中绿色的飞线是正确的引脚Pin 1(橙色的可以忽略)
原本水墨屏的转接板子上的CS接的就是ESP32的Pin5,然后现在把飞线出来的CS1接到ESP32的Pin14
CS0 接ESP32的Pin 5
CS1 接ESP32的Pin 14
修改例程程序,分别设置2个CS的引脚,上传:
GxEPD2_2IC_BW<GxEPD2_2IC_420_A03, GxEPD2_2IC_420_A03::HEIGHT> display(GxEPD2_2IC_420_A03(/*CS=5*/ 5,14, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH042A03-A1
完整点亮
上传成功后,屏幕有反应并且已经可以完整的显示例子程序,在这块4.2寸的屏幕上。
如果想要完美一点,可以自己画一块驱动板,直接接上就能开心的使用了。
完整程序
已经修改好PIn口,接线方式请参考:
https://lingshunlab.com/book/esp32/esp32-display-4-2-inch-e-paper-module-hello-world
其中:
CS0 接ESP32的Pin 5
CS1 接ESP32的Pin 14(飞线的那条)
#define ENABLE_GxEPD2_GFX 0
#include <GxEPD2_2IC_BW.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#if !defined(__AVR) && !defined(_BOARD_GENERIC_STM32F103C_H_) && !defined(ARDUINO_BLUEPILL_F103C8)
#include "bitmaps/Bitmaps80x128.h" // 1.02" b/w
#include "bitmaps/Bitmaps152x152.h" // 1.54" b/w
#include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
#include "bitmaps/Bitmaps104x212.h" // 2.13" b/w flexible GDEW0213I5F
#include "bitmaps/Bitmaps128x250.h" // 2.13" b/w
#include "bitmaps/Bitmaps128x296.h" // 2.9" b/w
#include "bitmaps/Bitmaps152x296.h" // 2.6" b/w
#include "bitmaps/Bitmaps176x264.h" // 2.7" b/w
#include "bitmaps/Bitmaps240x416.h" // 3.71" b/w
#include "bitmaps/Bitmaps400x300.h" // 4.2" b/w
#include "bitmaps/Bitmaps648x480.h" // 5.38" b/w
#include "bitmaps/Bitmaps640x384.h" // 7.5" b/w
#include "bitmaps/Bitmaps800x480.h" // 7.5" b/w
// 3-color
#include "bitmaps/Bitmaps3c200x200.h" // 1.54" b/w/r
#include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
#include "bitmaps/Bitmaps3c128x250.h" // 2.13" b/w/r
#include "bitmaps/Bitmaps3c128x296.h" // 2.9" b/w/r
#include "bitmaps/Bitmaps3c152x296.h" // 2.66" b/w/r
#include "bitmaps/Bitmaps3c176x264.h" // 2.7" b/w/r
#include "bitmaps/Bitmaps3c400x300.h" // 4.2" b/w/r
#if defined(ESP8266) || defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
#include "bitmaps/Bitmaps3c648x480.h" // 5.83" b/w/r
#include "bitmaps/Bitmaps3c800x480.h" // 7.5" b/w/r
#include "bitmaps/Bitmaps3c880x528.h" // 7.5" b/w/r
#include "bitmaps/WS_Bitmaps800x600.h" // 6.0" grey
#include "bitmaps/WS_Bitmaps7c192x143.h" // 5.65" 7-color
#endif
#if defined(ESP32)
#include "bitmaps/Bitmaps1304x984.h" // 12.48" b/w
#include "bitmaps/Bitmaps3c1304x984.h" // 12.48" b/w/r
#endif
#else
#include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
#include "bitmaps/Bitmaps3c128x250.h" // 2.13" b/w/r
#endif
#if defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_RASPBERRY_PI_PICO)
arduino::MbedSPI SPI0(4, 7, 6); // need be valid pins for same SPI channel, else fails blinking 4 long 4 short
#endif
GxEPD2_2IC_BW<GxEPD2_2IC_420_A03, GxEPD2_2IC_420_A03::HEIGHT> display(GxEPD2_2IC_420_A03(/*CS=5*/ 5,14, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH042A03-A1
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println("setup");
Serial.println();
delay(100);
pinMode(32, OUTPUT);
digitalWrite(32, LOW);
#if defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_RASPBERRY_PI_PICO)
pinMode(15, INPUT_PULLUP); // safety pin
while (!digitalRead(15)) delay(100); // check safety pin for fail recovery
#endif
display.init(115200); // default 10ms reset pulse, e.g. for bare panels with DESPI-C02
//display.init(115200, true, 2, false); // USE THIS for Waveshare boards with "clever" reset circuit, 2ms reset pulse
//display.init(115200, true, 10, false, SPI0, SPISettings(4000000, MSBFIRST, SPI_MODE0)); // extended init method with SPI channel and/or settings selection
// first update should be full refresh
helloWorld();
delay(1000);
helloFullScreenPartialMode();
delay(1000);
//stripeTest(); return; // GDEH029Z13 issue
helloArduino();
delay(1000);
helloEpaper();
delay(1000);
//helloValue(123.9, 1);
//delay(1000);
showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
delay(3000);
if (display.epd2.WIDTH < 104)
{
showFont("glcdfont", 0);
delay(1000);
}
drawBitmaps();
//return;
#if !defined(__AVR) // takes too long!
#endif
if (display.epd2.hasPartialUpdate)
{
showPartialUpdate();
delay(1000);
}
display.powerOff();
deepSleepTest();
#if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
drawBitmaps1304x984();
display.powerOff();
#endif
Serial.println("setup done");
}
void loop()
{
}
// note for partial update window and setPartialWindow() method:
// partial update window size and position is on byte boundary in physical x direction
// the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
// see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
const char HelloWorld[] = "Hello World!";
const char HelloArduino[] = "Hello Arduino!";
const char HelloEpaper[] = "Hello E-Paper!";
void helloWorld()
{
//Serial.println("helloWorld");
display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
if (display.epd2.WIDTH < 104) display.setFont(0);
display.setTextColor(GxEPD_BLACK);
int16_t tbx, tby; uint16_t tbw, tbh;
display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
// center bounding box by transposition of origin:
uint16_t x = ((display.width() - tbw) / 2) - tbx;
uint16_t y = ((display.height() - tbh) / 2) - tby;
display.setFullWindow();
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(x, y);
display.print(HelloWorld);
}
while (display.nextPage());
//Serial.println("helloWorld done");
}
void helloWorldForDummies()
{
//Serial.println("helloWorld");
const char text[] = "Hello World!";
// most e-papers have width < height (portrait) as native orientation, especially the small ones
// in GxEPD2 rotation 0 is used for native orientation (most TFT libraries use 0 fix for portrait orientation)
// set rotation to 1 (rotate right 90 degrees) to have enough space on small displays (landscape)
display.setRotation(1);
// select a suitable font in Adafruit_GFX
display.setFont(&FreeMonoBold9pt7b);
// on e-papers black on white is more pleasant to read
display.setTextColor(GxEPD_BLACK);
// Adafruit_GFX has a handy method getTextBounds() to determine the boundary box for a text for the actual font
int16_t tbx, tby; uint16_t tbw, tbh; // boundary box window
display.getTextBounds(text, 0, 0, &tbx, &tby, &tbw, &tbh); // it works for origin 0, 0, fortunately (negative tby!)
// center bounding box by transposition of origin:
uint16_t x = ((display.width() - tbw) / 2) - tbx;
uint16_t y = ((display.height() - tbh) / 2) - tby;
// full window mode is the initial mode, set it anyway
display.setFullWindow();
// here we use paged drawing, even if the processor has enough RAM for full buffer
// so this can be used with any supported processor board.
// the cost in code overhead and execution time penalty is marginal
// tell the graphics class to use paged drawing mode
display.firstPage();
do
{
// this part of code is executed multiple times, as many as needed,
// in case of full buffer it is executed once
// IMPORTANT: each iteration needs to draw the same, to avoid strange effects
// use a copy of values that might change, don't read e.g. from analog or pins in the loop!
display.fillScreen(GxEPD_WHITE); // set the background to white (fill the buffer with value for white)
display.setCursor(x, y); // set the postition to start printing text
display.print(text); // print some text
// end of part executed multiple times
}
// tell the graphics class to transfer the buffer content (page) to the controller buffer
// the graphics class will command the controller to refresh to the screen when the last page has been transferred
// returns true if more pages need be drawn and transferred
// returns false if the last page has been transferred and the screen refreshed for panels without fast partial update
// returns false for panels with fast partial update when the controller buffer has been written once more, to make the differential buffers equal
// (for full buffered with fast partial update the (full) buffer is just transferred again, and false returned)
while (display.nextPage());
//Serial.println("helloWorld done");
}
void helloFullScreenPartialMode()
{
//Serial.println("helloFullScreenPartialMode");
const char fullscreen[] = "full screen update";
const char fpm[] = "fast partial mode";
const char spm[] = "slow partial mode";
const char npm[] = "no partial mode";
display.setPartialWindow(0, 0, display.width(), display.height());
display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
if (display.epd2.WIDTH < 104) display.setFont(0);
display.setTextColor(GxEPD_BLACK);
const char* updatemode;
if (display.epd2.hasFastPartialUpdate)
{
updatemode = fpm;
}
else if (display.epd2.hasPartialUpdate)
{
updatemode = spm;
}
else
{
updatemode = npm;
}
// do this outside of the loop
int16_t tbx, tby; uint16_t tbw, tbh;
// center update text
display.getTextBounds(fullscreen, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t utx = ((display.width() - tbw) / 2) - tbx;
uint16_t uty = ((display.height() / 4) - tbh / 2) - tby;
// center update mode
display.getTextBounds(updatemode, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t umx = ((display.width() - tbw) / 2) - tbx;
uint16_t umy = ((display.height() * 3 / 4) - tbh / 2) - tby;
// center HelloWorld
display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t hwx = ((display.width() - tbw) / 2) - tbx;
uint16_t hwy = ((display.height() - tbh) / 2) - tby;
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(hwx, hwy);
display.print(HelloWorld);
display.setCursor(utx, uty);
display.print(fullscreen);
display.setCursor(umx, umy);
display.print(updatemode);
}
while (display.nextPage());
//Serial.println("helloFullScreenPartialMode done");
}
void helloArduino()
{
//Serial.println("helloArduino");
display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
if (display.epd2.WIDTH < 104) display.setFont(0);
display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
int16_t tbx, tby; uint16_t tbw, tbh;
// align with centered HelloWorld
display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t x = ((display.width() - tbw) / 2) - tbx;
// height might be different
display.getTextBounds(HelloArduino, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t y = ((display.height() / 4) - tbh / 2) - tby; // y is base line!
// make the window big enough to cover (overwrite) descenders of previous text
uint16_t wh = FreeMonoBold9pt7b.yAdvance;
uint16_t wy = (display.height() / 4) - wh / 2;
display.setPartialWindow(0, wy, display.width(), wh);
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
//display.drawRect(x, y - tbh, tbw, tbh, GxEPD_BLACK);
display.setCursor(x, y);
display.print(HelloArduino);
}
while (display.nextPage());
delay(1000);
//Serial.println("helloArduino done");
}
void helloEpaper()
{
//Serial.println("helloEpaper");
display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
if (display.epd2.WIDTH < 104) display.setFont(0);
display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
int16_t tbx, tby; uint16_t tbw, tbh;
// align with centered HelloWorld
display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t x = ((display.width() - tbw) / 2) - tbx;
// height might be different
display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t y = ((display.height() * 3 / 4) - tbh / 2) - tby; // y is base line!
// make the window big enough to cover (overwrite) descenders of previous text
uint16_t wh = FreeMonoBold9pt7b.yAdvance;
uint16_t wy = (display.height() * 3 / 4) - wh / 2;
display.setPartialWindow(0, wy, display.width(), wh);
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(x, y);
display.print(HelloEpaper);
}
while (display.nextPage());
//Serial.println("helloEpaper done");
}
// test partial window issue on GDEW0213Z19 and GDEH029Z13
void stripeTest()
{
helloStripe(104);
delay(2000);
helloStripe(96);
}
const char HelloStripe[] = "Hello Stripe!";
void helloStripe(uint16_t pw_xe) // end of partial window in physcal x direction
{
//Serial.print("HelloStripe("); Serial.print(pw_xe); Serial.println(")");
display.setRotation(3);
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
int16_t tbx, tby; uint16_t tbw, tbh;
display.getTextBounds(HelloStripe, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t wh = FreeMonoBold9pt7b.yAdvance;
uint16_t wy = pw_xe - wh;
uint16_t x = ((display.width() - tbw) / 2) - tbx;
uint16_t y = wy - tby;
display.setPartialWindow(0, wy, display.width(), wh);
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(x, y);
display.print(HelloStripe);
}
while (display.nextPage());
//Serial.println("HelloStripe done");
}
#if defined(ESP8266) || defined(ESP32)
#include <StreamString.h>
#define PrintString StreamString
#else
class PrintString : public Print, public String
{
public:
size_t write(uint8_t data) override
{
return concat(char(data));
};
};
#endif
void helloValue(double v, int digits)
{
//Serial.println("helloValue");
display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(display.epd2.hasColor ? GxEPD_RED : GxEPD_BLACK);
PrintString valueString;
valueString.print(v, digits);
int16_t tbx, tby; uint16_t tbw, tbh;
display.getTextBounds(valueString, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t x = ((display.width() - tbw) / 2) - tbx;
uint16_t y = ((display.height() * 3 / 4) - tbh / 2) - tby; // y is base line!
// show what happens, if we use the bounding box for partial window
uint16_t wx = (display.width() - tbw) / 2;
uint16_t wy = ((display.height() * 3 / 4) - tbh / 2);
display.setPartialWindow(wx, wy, tbw, tbh);
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(x, y);
display.print(valueString);
}
while (display.nextPage());
delay(2000);
// make the partial window big enough to cover the previous text
uint16_t ww = tbw; // remember window width
display.getTextBounds(HelloEpaper, 0, 0, &tbx, &tby, &tbw, &tbh);
// adjust, because HelloEpaper was aligned, not centered (could calculate this to be precise)
ww = max(ww, uint16_t(tbw + 12)); // 12 seems ok
wx = (display.width() - tbw) / 2;
// make the window big enough to cover (overwrite) descenders of previous text
uint16_t wh = FreeMonoBold9pt7b.yAdvance;
wy = (display.height() * 3 / 4) - wh / 2;
display.setPartialWindow(wx, wy, ww, wh);
// alternately use the whole width for partial window
//display.setPartialWindow(0, wy, display.width(), wh);
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(x, y);
display.print(valueString);
}
while (display.nextPage());
//Serial.println("helloValue done");
}
void deepSleepTest()
{
//Serial.println("deepSleepTest");
const char hibernating[] = "hibernating ...";
const char wokeup[] = "woke up";
const char from[] = "from deep sleep";
const char again[] = "again";
display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
if (display.epd2.WIDTH < 104) display.setFont(0);
display.setTextColor(GxEPD_BLACK);
int16_t tbx, tby; uint16_t tbw, tbh;
// center text
display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t x = ((display.width() - tbw) / 2) - tbx;
uint16_t y = ((display.height() - tbh) / 2) - tby;
display.setFullWindow();
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(x, y);
display.print(hibernating);
}
while (display.nextPage());
display.hibernate();
delay(5000);
display.getTextBounds(wokeup, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t wx = (display.width() - tbw) / 2;
uint16_t wy = ((display.height() / 3) - tbh / 2) - tby; // y is base line!
display.getTextBounds(from, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t fx = (display.width() - tbw) / 2;
uint16_t fy = ((display.height() * 2 / 3) - tbh / 2) - tby; // y is base line!
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(wx, wy);
display.print(wokeup);
display.setCursor(fx, fy);
display.print(from);
}
while (display.nextPage());
delay(5000);
display.getTextBounds(hibernating, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t hx = (display.width() - tbw) / 2;
uint16_t hy = ((display.height() / 3) - tbh / 2) - tby; // y is base line!
display.getTextBounds(again, 0, 0, &tbx, &tby, &tbw, &tbh);
uint16_t ax = (display.width() - tbw) / 2;
uint16_t ay = ((display.height() * 2 / 3) - tbh / 2) - tby; // y is base line!
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.setCursor(hx, hy);
display.print(hibernating);
display.setCursor(ax, ay);
display.print(again);
}
while (display.nextPage());
display.hibernate();
//Serial.println("deepSleepTest done");
}
void showBox(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool partial)
{
//Serial.println("showBox");
display.setRotation(1);
if (partial)
{
display.setPartialWindow(x, y, w, h);
}
else
{
display.setFullWindow();
}
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.fillRect(x, y, w, h, GxEPD_BLACK);
}
while (display.nextPage());
//Serial.println("showBox done");
}
void drawCornerTest()
{
display.setFullWindow();
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(GxEPD_BLACK);
for (uint16_t r = 0; r <= 4; r++)
{
display.setRotation(r);
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
display.setCursor(display.width() / 2, display.height() / 2);
display.print(display.getRotation());
}
while (display.nextPage());
delay(2000);
}
}
void showFont(const char name[], const GFXfont* f)
{
display.setFullWindow();
display.setRotation(0);
display.setTextColor(GxEPD_BLACK);
display.firstPage();
do
{
drawFont(name, f);
}
while (display.nextPage());
}
void drawFont(const char name[], const GFXfont* f)
{
//display.setRotation(0);
display.fillScreen(GxEPD_WHITE);
display.setTextColor(GxEPD_BLACK);
display.setFont(f);
display.setCursor(0, 0);
display.println();
display.println(name);
display.println(" !\"#$%&'()*+,-./");
display.println("0123456789:;<=>?");
display.println("@ABCDEFGHIJKLMNO");
display.println("PQRSTUVWXYZ[\\]^_");
if (display.epd2.hasColor)
{
display.setTextColor(GxEPD_RED);
}
display.println("`abcdefghijklmno");
display.println("pqrstuvwxyz{|}~ ");
}
// note for partial update window and setPartialWindow() method:
// partial update window size and position is on byte boundary in physical x direction
// the size is increased in setPartialWindow() if x or w are not multiple of 8 for even rotation, y or h for odd rotation
// see also comment in GxEPD2_BW.h, GxEPD2_3C.h or GxEPD2_GFX.h for method setPartialWindow()
// showPartialUpdate() purposely uses values that are not multiples of 8 to test this
void showPartialUpdate()
{
// some useful background
helloWorld();
// use asymmetric values for test
uint16_t box_x = 10;
uint16_t box_y = 15;
uint16_t box_w = 70;
uint16_t box_h = 20;
uint16_t cursor_y = box_y + box_h - 6;
if (display.epd2.WIDTH < 104) cursor_y = box_y + 6;
float value = 13.95;
uint16_t incr = display.epd2.hasFastPartialUpdate ? 1 : 3;
display.setFont(&FreeMonoBold9pt7b);
if (display.epd2.WIDTH < 104) display.setFont(0);
display.setTextColor(GxEPD_BLACK);
// show where the update box is
for (uint16_t r = 0; r < 4; r++)
{
display.setRotation(r);
display.setPartialWindow(box_x, box_y, box_w, box_h);
display.firstPage();
do
{
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
//display.fillScreen(GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
display.firstPage();
do
{
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
}
while (display.nextPage());
delay(1000);
}
//return;
// show updates in the update box
for (uint16_t r = 0; r < 4; r++)
{
display.setRotation(r);
display.setPartialWindow(box_x, box_y, box_w, box_h);
for (uint16_t i = 1; i <= 10; i += incr)
{
display.firstPage();
do
{
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
display.setCursor(box_x, cursor_y);
display.print(value * i, 2);
}
while (display.nextPage());
delay(500);
}
delay(1000);
display.firstPage();
do
{
display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
}
while (display.nextPage());
delay(1000);
}
}
void drawBitmaps()
{
display.setFullWindow();
#ifdef _GxBitmaps80x128_H_
drawBitmaps80x128();
#endif
#ifdef _GxBitmaps152x152_H_
drawBitmaps152x152();
#endif
#ifdef _GxBitmaps104x212_H_
drawBitmaps104x212();
#endif
#ifdef _GxBitmaps128x250_H_
drawBitmaps128x250();
#endif
#ifdef _GxBitmaps128x296_H_
drawBitmaps128x296();
#endif
#ifdef _GxBitmaps152x296_H_
drawBitmaps152x296();
#endif
#ifdef _GxBitmaps176x264_H_
drawBitmaps176x264();
#endif
#ifdef _GxBitmaps240x416_H_
drawBitmaps240x416();
#endif
#ifdef _GxBitmaps400x300_H_
drawBitmaps400x300();
#endif
#ifdef _GxBitmaps640x384_H_
drawBitmaps640x384();
#endif
#ifdef _GxBitmaps648x480_H_
drawBitmaps648x480();
#endif
#ifdef _GxBitmaps800x480_H_
drawBitmaps800x480();
#endif
#ifdef _WS_Bitmaps800x600_H_
drawBitmaps800x600();
#endif
#if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
drawBitmaps1304x984();
#endif
// 3-color
#ifdef _GxBitmaps3c104x212_H_
drawBitmaps3c104x212();
#endif
#ifdef _GxBitmaps3c128x250_H_
drawBitmaps3c128x250();
#endif
#ifdef _GxBitmaps3c128x296_H_
drawBitmaps3c128x296();
#endif
#ifdef _GxBitmaps3c152x296_H_
drawBitmaps3c152x296();
#endif
#ifdef _GxBitmaps3c176x264_H_
drawBitmaps3c176x264();
#endif
#ifdef _GxBitmaps3c400x300_H_
drawBitmaps3c400x300();
#endif
#ifdef _GxBitmaps3c648x480_H_
drawBitmaps3c648x480();
#endif
#ifdef _GxBitmaps3c800x480_H_
drawBitmaps3c800x480();
#endif
#ifdef _GxBitmaps3c880x528_H_
drawBitmaps3c880x528();
#endif
#if defined(_WS_Bitmaps7c192x143_H_)
drawBitmaps7c192x143();
#endif
if ((display.epd2.WIDTH >= 200) && (display.epd2.HEIGHT >= 200))
{
// show these after the specific bitmaps
#ifdef _GxBitmaps200x200_H_
drawBitmaps200x200();
#endif
// 3-color
#ifdef _GxBitmaps3c200x200_H_
drawBitmaps3c200x200();
#endif
}
#if defined(ESP32) && defined(_GxBitmaps3c1304x984_H_)
drawBitmaps3c1304x984();
#endif
}
#ifdef _GxBitmaps80x128_H_
void drawBitmaps80x128()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
Bitmap80x128_1, Bitmap80x128_2, Bitmap80x128_3, Bitmap80x128_4, Bitmap80x128_5
};
#else
const unsigned char* bitmaps[] =
{
Bitmap80x128_1, Bitmap80x128_2, Bitmap80x128_3, Bitmap80x128_4, Bitmap80x128_5
};
#endif
if ((display.epd2.WIDTH == 80) && (display.epd2.HEIGHT == 128))
{
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmaps[i], 80, 128, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawBitmap(0, 0, WS_Bitmap80x128, 80, 128, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
}
#endif
#ifdef _GxBitmaps152x152_H_
void drawBitmaps152x152()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
};
#else
const unsigned char* bitmaps[] =
{
Bitmap152x152_1, Bitmap152x152_2, Bitmap152x152_3
};
#endif
if ((display.epd2.WIDTH == 152) && (display.epd2.HEIGHT == 152))
{
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmaps[i], 152, 152, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
}
}
#endif
#ifdef _GxBitmaps200x200_H_
void drawBitmaps200x200()
{
#if defined(ARDUINO_AVR_PRO)
const unsigned char* bitmaps[] =
{
logo200x200
};
#elif defined(__AVR)
const unsigned char* bitmaps[] =
{
logo200x200, //first200x200
};
#elif defined(_BOARD_GENERIC_STM32F103C_H_) || defined(STM32F1xx)
const unsigned char* bitmaps[] =
{
logo200x200, first200x200, second200x200, third200x200, //fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
};
#else
const unsigned char* bitmaps[] =
{
logo200x200, first200x200, second200x200, third200x200, fourth200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200
//logo200x200, first200x200, second200x200, fourth200x200, third200x200, fifth200x200, sixth200x200, senventh200x200, eighth200x200 // ED037TC1 test
};
#endif
if (display.epd2.hasColor) return; // to avoid many long refreshes
if ((display.epd2.WIDTH == 200) && (display.epd2.HEIGHT == 200) && !display.epd2.hasColor)
{
bool m = display.mirror(true);
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmaps[i], 200, 200, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
display.mirror(m);
}
//else
{
bool mirror_y = true;
display.clearScreen(); // use default for white
int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.drawImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
delay(2000);
}
}
bool mirror_y = true;
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
int16_t x = -60;
int16_t y = -60;
for (uint16_t j = 0; j < 10; j++)
{
display.writeScreenBuffer(); // use default for white
display.writeImage(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
display.refresh(true);
if (display.epd2.hasFastPartialUpdate)
{
// for differential update: set previous buffer equal to current buffer in controller
//display.epd2.writeScreenBufferAgain(); // use default for white
//display.epd2.writeImageAgain(bitmaps[i], x, y, 200, 200, false, mirror_y, true);
}
delay(2000);
x += display.epd2.WIDTH / 4;
y += display.epd2.HEIGHT / 4;
if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
}
if (!display.epd2.hasFastPartialUpdate) break; // comment out for full show
break; // comment out for full show
}
display.writeScreenBuffer(); // use default for white
display.writeImage(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
display.writeImage(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
display.refresh(true);
// for differential update: set previous buffer equal to current buffer in controller
//display.epd2.writeScreenBufferAgain(); // use default for white
//display.epd2.writeImageAgain(bitmaps[0], int16_t(0), 0, 200, 200, false, mirror_y, true);
//display.epd2.writeImageAgain(bitmaps[0], int16_t(int16_t(display.epd2.WIDTH) - 200), int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, mirror_y, true);
delay(2000);
}
#endif
#ifdef _GxBitmaps104x212_H_
void drawBitmaps104x212()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
};
#else
const unsigned char* bitmaps[] =
{
WS_Bitmap104x212, Bitmap104x212_1, Bitmap104x212_2, Bitmap104x212_3
};
#endif
if ((display.epd2.WIDTH == 104) && (display.epd2.HEIGHT == 212) && !display.epd2.hasColor)
{
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawBitmap(0, 0, bitmaps[i], 104, 212, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
}
}
#endif
#ifdef _GxBitmaps128x250_H_
void drawBitmaps128x250()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
};
#else
const unsigned char* bitmaps[] =
{
Bitmap128x250_1, logo128x250, first128x250, second128x250, third128x250
};
#endif
if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 250) && !display.epd2.hasColor)
{
bool m = display.mirror(true);
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmaps[i], 128, 250, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
display.mirror(m);
}
}
#endif
#ifdef _GxBitmaps128x296_H_
void drawBitmaps128x296()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
Bitmap128x296_1, logo128x296, first128x296, second128x296, third128x296
};
#else
const unsigned char* bitmaps[] =
{
Bitmap128x296_1, logo128x296 //, first128x296, second128x296, third128x296
};
#endif
if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 296) && !display.epd2.hasColor)
{
bool m = display.mirror(true);
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmaps[i], 128, 296, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
display.mirror(m);
}
}
#endif
#ifdef _GxBitmaps152x296_H_
void drawBitmaps152x296()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
};
#else
const unsigned char* bitmaps[] =
{
Bitmap152x296_1, Bitmap152x296_2, Bitmap152x296_3
};
#endif
if ((display.epd2.WIDTH == 152) && (display.epd2.HEIGHT == 296) && !display.epd2.hasColor)
{
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmaps[i], 152, 296, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
}
}
#endif
#ifdef _GxBitmaps176x264_H_
void drawBitmaps176x264()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
Bitmap176x264_1, Bitmap176x264_2, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
};
#else
const unsigned char* bitmaps[] =
{
Bitmap176x264_1, Bitmap176x264_2 //, Bitmap176x264_3, Bitmap176x264_4, Bitmap176x264_5
};
#endif
if ((display.epd2.WIDTH == 176) && (display.epd2.HEIGHT == 264) && !display.epd2.hasColor)
{
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmaps[i], 176, 264, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
}
}
#endif
#ifdef _GxBitmaps240x416_H_
void drawBitmaps240x416()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
Bitmap240x416_1, Bitmap240x416_2, Bitmap240x416_3
};
#else
const unsigned char* bitmaps[] =
{
Bitmap240x460_1, Bitmap240x460_2, Bitmap240x460_3
};
#endif
if ((display.epd2.WIDTH == 240) && (display.epd2.HEIGHT == 416) && !display.epd2.hasColor)
{
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmaps[i], 240, 416, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
}
}
#endif
#ifdef _GxBitmaps400x300_H_
void drawBitmaps400x300()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
Bitmap400x300_1, Bitmap400x300_2
};
#else
const unsigned char* bitmaps[] = {}; // not enough code space
#endif
if ((display.epd2.WIDTH == 400) && (display.epd2.HEIGHT == 300) && !display.epd2.hasColor)
{
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmaps[i], 400, 300, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
}
}
#endif
#ifdef _GxBitmaps640x384_H_
void drawBitmaps640x384()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
Bitmap640x384_1, Bitmap640x384_2
};
#else
const unsigned char* bitmaps[] = {}; // not enough code space
#endif
if ((display.epd2.WIDTH == 640) && (display.epd2.HEIGHT == 384))
{
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmaps[i], 640, 384, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
}
}
#endif
#ifdef _GxBitmaps648x480_H_
void drawBitmaps648x480()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
Bitmap648x480_1, Bitmap648x480_2, Bitmap648x480_3
};
#else
const unsigned char* bitmaps[] = {}; // not enough code space
#endif
if ((display.epd2.WIDTH == 648) && (display.epd2.HEIGHT == 480) && !display.epd2.hasColor)
{
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawBitmap(0, 0, bitmaps[i], 648, 480, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
}
}
#endif
#ifdef _GxBitmaps800x480_H_
void drawBitmaps800x480()
{
#if !defined(__AVR)
const unsigned char* bitmaps[] =
{
Bitmap800x480_1, Bitmap800x480_2, Bitmap800x480_3, Bitmap800x480_4
};
#else
const unsigned char* bitmaps[] = {}; // not enough code space
#endif
if ((display.epd2.WIDTH == 800) && (display.epd2.HEIGHT == 480))
{
for (uint16_t i = 0; i < sizeof(bitmaps) / sizeof(char*); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawBitmap(0, 0, bitmaps[i], 800, 480, GxEPD_BLACK);
}
while (display.nextPage());
delay(2000);
}
}
}
#endif
#ifdef _WS_Bitmaps800x600_H_
void drawBitmaps800x600()
{
#if defined(ESP8266) || defined(ESP32)
#endif
}
#endif
#if defined(ESP32) && defined(_GxBitmaps1304x984_H_)
void drawBitmaps1304x984()
{
}
#endif
struct bitmap_pair
{
const unsigned char* black;
const unsigned char* red;
};
#ifdef _GxBitmaps3c200x200_H_
void drawBitmaps3c200x200()
{
bitmap_pair bitmap_pairs[] =
{
//{Bitmap3c200x200_black, Bitmap3c200x200_red},
{WS_Bitmap3c200x200_black, WS_Bitmap3c200x200_red}
};
if (display.epd2.hasColor)
{
display.clearScreen(); // use default for white
int16_t x = (int16_t(display.epd2.WIDTH) - 200) / 2;
int16_t y = (int16_t(display.epd2.HEIGHT) - 200) / 2;
for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
{
display.drawImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
delay(2000);
}
for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
{
int16_t x = -60;
int16_t y = -60;
for (uint16_t j = 0; j < 10; j++)
{
display.writeScreenBuffer(); // use default for white
display.writeImage(bitmap_pairs[i].black, bitmap_pairs[i].red, x, y, 200, 200, false, false, true);
display.refresh();
delay(1000);
x += display.epd2.WIDTH / 4;
y += display.epd2.HEIGHT / 4;
if ((x >= int16_t(display.epd2.WIDTH)) || (y >= int16_t(display.epd2.HEIGHT))) break;
}
}
display.writeScreenBuffer(); // use default for white
display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, 0, 0, 200, 200, false, false, true);
display.writeImage(bitmap_pairs[0].black, bitmap_pairs[0].red, int16_t(display.epd2.WIDTH) - 200, int16_t(display.epd2.HEIGHT) - 200, 200, 200, false, false, true);
display.refresh();
delay(2000);
}
}
#endif
#ifdef _GxBitmaps3c104x212_H_
void drawBitmaps3c104x212()
{
#if !defined(__AVR)
bitmap_pair bitmap_pairs[] =
{
{Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
{Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
{WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
};
#else
bitmap_pair bitmap_pairs[] =
{
{Bitmap3c104x212_1_black, Bitmap3c104x212_1_red},
//{Bitmap3c104x212_2_black, Bitmap3c104x212_2_red},
{WS_Bitmap3c104x212_black, WS_Bitmap3c104x212_red}
};
#endif
}
#endif
#ifdef _GxBitmaps3c128x250_H_
void drawBitmaps3c128x250()
{
if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 250) && display.epd2.hasColor)
{
bool mirrored = display.mirror(true);
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, Bitmap3c128x250_1_black, 128, 250, GxEPD_BLACK);
display.drawInvertedBitmap(0, 0, Bitmap3c128x250_1_red, 128, 250, GxEPD_RED);
}
while (display.nextPage());
delay(2000);
#if !defined(__AVR)
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, Bitmap3c128x250_2_black, 128, 250, GxEPD_BLACK);
display.drawBitmap(0, 0, Bitmap3c128x250_2_red, 128, 250, GxEPD_RED);
}
while (display.nextPage());
delay(2000);
#endif
display.mirror(mirrored);
}
}
#endif
#ifdef _GxBitmaps3c128x296_H_
void drawBitmaps3c128x296()
{
#if !defined(__AVR)
bitmap_pair bitmap_pairs[] =
{
{Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
{Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
{WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
};
#else
bitmap_pair bitmap_pairs[] =
{
//{Bitmap3c128x296_1_black, Bitmap3c128x296_1_red},
//{Bitmap3c128x296_2_black, Bitmap3c128x296_2_red},
{WS_Bitmap3c128x296_black, WS_Bitmap3c128x296_red}
};
#endif
if ((display.epd2.WIDTH == 128) && (display.epd2.HEIGHT == 296) && display.epd2.hasColor)
{
for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, 128, 296, GxEPD_BLACK);
if (bitmap_pairs[i].red == WS_Bitmap3c128x296_red)
{
display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, 128, 296, GxEPD_RED);
}
else display.drawBitmap(0, 0, bitmap_pairs[i].red, 128, 296, GxEPD_RED);
}
while (display.nextPage());
delay(2000);
}
}
}
#endif
#ifdef _GxBitmaps3c152x296_H_
void drawBitmaps3c152x296()
{
bitmap_pair bitmap_pairs[] =
{
{Bitmap3c152x296_black, Bitmap3c152x296_red}
};
}
#endif
#ifdef _GxBitmaps3c176x264_H_
void drawBitmaps3c176x264()
{
bitmap_pair bitmap_pairs[] =
{
{Bitmap3c176x264_black, Bitmap3c176x264_red}
};
}
#endif
#ifdef _GxBitmaps3c400x300_H_
void drawBitmaps3c400x300()
{
#if !defined(__AVR)
bitmap_pair bitmap_pairs[] =
{
{Bitmap3c400x300_1_black, Bitmap3c400x300_1_red},
{Bitmap3c400x300_2_black, Bitmap3c400x300_2_red},
{WS_Bitmap3c400x300_black, WS_Bitmap3c400x300_red}
};
#else
bitmap_pair bitmap_pairs[] = {}; // not enough code space
#endif
if (display.epd2.panel == GxEPD2::GDEH042A03)
{
for (uint16_t i = 0; i < sizeof(bitmap_pairs) / sizeof(bitmap_pair); i++)
{
display.firstPage();
do
{
display.fillScreen(GxEPD_WHITE);
display.drawInvertedBitmap(0, 0, bitmap_pairs[i].black, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_BLACK);
display.drawInvertedBitmap(0, 0, bitmap_pairs[i].red, display.epd2.WIDTH, display.epd2.HEIGHT, GxEPD_RED);
}
while (display.nextPage());
delay(2000);
}
}
}
#endif
#ifdef _GxBitmaps3c648x480_H_
void drawBitmaps3c648x480()
{
#if !defined(__AVR)
bitmap_pair bitmap_pairs[] =
{
{Bitmap3c648x480_black, Bitmap3c648x480_red}
};
#else
bitmap_pair bitmap_pairs[] = {}; // not enough code space
#endif
}
#endif
#ifdef _GxBitmaps3c800x480_H_
void drawBitmaps3c800x480()
{
#if !defined(__AVR)
bitmap_pair bitmap_pairs[] =
{
{Bitmap3c800x480_1_black, Bitmap3c800x480_1_red}
};
#else
bitmap_pair bitmap_pairs[] = {}; // not enough code space
#endif
}
#endif
#ifdef _GxBitmaps3c880x528_H_
void drawBitmaps3c880x528()
{
#if !defined(__AVR)
bitmap_pair bitmap_pairs[] =
{
{Bitmap3c880x528_black, Bitmap3c880x528_red}
};
#else
bitmap_pair bitmap_pairs[] = {}; // not enough code space
#endif
}
#endif
#if defined(ESP32) && defined(_GxBitmaps3c1304x984_H_)
void drawBitmaps3c1304x984()
{
}
#endif
#if defined(_WS_Bitmaps7c192x143_H_)
void drawBitmaps7c192x143()
{
}
#endif
void draw7colors()
{
display.setRotation(0);
uint16_t h = display.height() / 7;
display.firstPage();
do
{
display.fillRect(0, 0, display.width(), h, GxEPD_BLACK);
display.fillRect(0, h, display.width(), h, GxEPD_WHITE);
display.fillRect(0, 2 * h, display.width(), h, GxEPD_GREEN);
display.fillRect(0, 3 * h, display.width(), h, GxEPD_BLUE);
display.fillRect(0, 4 * h, display.width(), h, GxEPD_RED);
display.fillRect(0, 5 * h, display.width(), h, GxEPD_YELLOW);
display.fillRect(0, 6 * h, display.width(), h, GxEPD_ORANGE);
}
while (display.nextPage());
}
void draw7colorlines()
{
display.setRotation(0);
uint16_t h = 2;
display.firstPage();
do
{
uint16_t y = 0;
do
{
display.fillRect(0, y, display.width(), h, GxEPD_BLACK); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_GREEN); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_BLUE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_RED); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_YELLOW); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_ORANGE); y += h;
display.fillRect(0, y, display.width(), h, GxEPD_WHITE); y += h;
}
while ((y + 12 * h) < uint16_t(display.height()));
//display.drawPixel(0, y, GxEPD_BLACK); display.drawPixel(10, y, GxEPD_GREEN);
//display.drawPixel(20, y, GxEPD_BLUE); display.drawPixel(30, y, GxEPD_RED);
//display.drawPixel(40, y, GxEPD_YELLOW); display.drawPixel(50, y, GxEPD_ORANGE);
display.fillRect(0, y, 2, 2, GxEPD_BLACK); display.fillRect(10, y, 2, 2, GxEPD_GREEN);
display.fillRect(20, y, 2, 2, GxEPD_BLUE); display.fillRect(30, y, 2, 2, GxEPD_RED);
display.fillRect(40, y, 2, 2, GxEPD_YELLOW); display.fillRect(50, y, 2, 2, GxEPD_ORANGE);
}
while (display.nextPage());
}