Files

27 lines
1.0 KiB
C

// Gemeinsame Bausteine aller Apps: Schriften, Statuszeile mit App-Punkten und Akkuanzeige.
#pragma once
#include <Adafruit_GFX.h>
#include <U8g2_for_Adafruit_GFX.h>
const int STATUS_LINE_Y = 111; // Trennlinie über der Statuszeile (Querformat 296x128)
struct StatusInfo {
float batteryVoltage; // Volt, NAN ohne Messwert (dann ohne Akkuanzeige)
int appIndex;
int appCount;
};
extern const char* const DAY_NAMES[7]; // "So", "Mo", … "Sa"
// Wochentag, 0 = Sonntag; date im Format "YYYY-MM-DD"
int weekday(const char* date);
// setFont schaltet den transparenten Modus ab (der Hintergrund wäre dann schwarz), daher immer hierüber
void useFont(U8G2_FOR_ADAFRUIT_GFX& fonts, const uint8_t* font);
void drawCentered(U8G2_FOR_ADAFRUIT_GFX& fonts, const char* text, int centerX, int baseline);
int batteryPercent(float voltage);
// Statuszeile: links Text, in der Mitte ein Punkt pro App (aktuelle gefüllt), rechts der Akku
void drawStatusBar(Adafruit_GFX& gfx, U8G2_FOR_ADAFRUIT_GFX& fonts, const char* leftText, const StatusInfo& status);