diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2020-07-17 20:29:41 +0200 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2020-07-17 20:29:41 +0200 |
| commit | 4a239ede79c43cf22e8f769a4ea086687a65c3f0 (patch) | |
| tree | 5b1e651dc4188f541fdcd5d85d1e6c0521f93200 /src/main.cpp | |
| parent | 097db5fa9f57a77866be60ef8d8d39beef882639 (diff) | |
use u8g2 for font rendering, as they support fonts with umlauts
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index 70f2559..ee7435a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,5 @@ #include <GxEPD2_BW.h> -#include <Fonts/FreeSansBold9pt7b.h> -#include <Fonts/FreeSans9pt7b.h> +#include <U8g2_for_Adafruit_GFX.h> #include <WiFi.h> #include "calendar.h" @@ -22,6 +21,12 @@ */ GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=*/ 15, /*DC=*/ 27, /*RST=*/ 26, /*BUSY=*/ 25)); +U8G2_FOR_ADAFRUIT_GFX u8g2Fonts; + +extern GxEPD2_GFX_BASE_CLASS &get_display() { + return display; +} + void board_spi_setup() { /* board-specific setup */ @@ -32,18 +37,19 @@ void board_spi_setup() { void display_setup() { display.init(); board_spi_setup(); + u8g2Fonts.begin(display); } void draw() { display.setRotation(1); - display.setFont(&FreeSans9pt7b); - display.setTextColor(GxEPD_BLACK); + u8g2Fonts.setBackgroundColor(GxEPD_WHITE); + u8g2Fonts.setForegroundColor(GxEPD_BLACK); display.firstPage(); do { display.fillScreen(GxEPD_WHITE); - draw_calendar(display, 30, 30); - draw_qrcode_wlan(display, 30, 200, wifi_ssid, wifi_psk); + draw_calendar(30, 30); + draw_qrcode_wlan(30, 200, wifi_ssid, wifi_psk); } while(display.nextPage()); } |
