losungepaper/losungepaper.ino
2022-08-21 10:48:54 +02:00

46 lines
1.2 KiB
C++
Executable File

#include "epd2in7.h"
#include "epdpaint.h"
// b/w e-Paper
#define COLORED 0
#define UNCOLORED 1
Epd epd;
// style of the frame shown
sFONT TITLE_FONT = Font16;
char TITLE_TEXT[] = "Losung heute";
void showDailyText() {
/* This clears the SRAM of the e-paper display and displays it */
epd.ClearFrame();
epd.DisplayFrame();
// now the drawing init
unsigned char image[2048];
Paint paint(image, 176, 30); // width should be the multiple of 8
paint.Clear(UNCOLORED);
int startTitleAtX = round((paint.GetWidth()-strlen(TITLE_TEXT)*TITLE_FONT.Width)/2);
paint.DrawStringAt(startTitleAtX, 2, TITLE_TEXT, &TITLE_FONT, COLORED);
paint.DrawHorizontalLine(startTitleAtX+15, TITLE_FONT.Height+1, paint.GetWidth()-(startTitleAtX+15)*2, COLORED);
epd.TransmitPartialData(paint.GetImage(), 0, 0, paint.GetWidth(), paint.GetHeight());
epd.RefreshPartial(0, 0, paint.GetWidth(), paint.GetHeight());
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("[INFO] Initializing e-Paper...");
if (epd.Init() != 0) {
Serial.println("[FATAL] Failed initializing e-Paper; Exiting...");
return;
}
Serial.println("[INFO] Initialized e-Paper!");
}
void loop() {
}