2023-01-18 21:25:30 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
#pragma once
|
2023-01-17 23:51:53 +01:00
|
|
|
|
2023-03-15 20:20:14 +01:00
|
|
|
#include "defaults.h"
|
2023-11-20 22:02:44 +01:00
|
|
|
#include <TaskSchedulerDeclarations.h>
|
2023-01-17 23:51:53 +01:00
|
|
|
#include <U8g2lib.h>
|
|
|
|
|
|
2023-01-19 20:12:16 +01:00
|
|
|
enum DisplayType_t {
|
|
|
|
|
None,
|
|
|
|
|
PCD8544,
|
|
|
|
|
SSD1306,
|
|
|
|
|
SH1106,
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-17 23:51:53 +01:00
|
|
|
class DisplayGraphicClass {
|
|
|
|
|
public:
|
|
|
|
|
DisplayGraphicClass();
|
|
|
|
|
~DisplayGraphicClass();
|
|
|
|
|
|
2023-11-20 22:02:44 +01:00
|
|
|
void init(Scheduler* scheduler, DisplayType_t type, uint8_t data, uint8_t clk, uint8_t cs, uint8_t reset);
|
2023-03-15 20:20:14 +01:00
|
|
|
void setContrast(uint8_t contrast);
|
2023-08-25 16:57:24 +02:00
|
|
|
void setStatus(bool turnOn);
|
2023-03-15 20:20:14 +01:00
|
|
|
void setOrientation(uint8_t rotation = DISPLAY_ROTATION);
|
2023-05-23 18:25:12 +02:00
|
|
|
void setLanguage(uint8_t language);
|
2023-03-15 20:20:14 +01:00
|
|
|
void setStartupDisplay();
|
2023-01-17 23:51:53 +01:00
|
|
|
|
2023-01-19 22:43:36 +01:00
|
|
|
bool enablePowerSafe = true;
|
2023-01-19 23:10:41 +01:00
|
|
|
bool enableScreensaver = true;
|
2023-01-17 23:51:53 +01:00
|
|
|
|
|
|
|
|
private:
|
2023-11-20 22:02:44 +01:00
|
|
|
void loop();
|
2023-01-17 23:51:53 +01:00
|
|
|
void printText(const char* text, uint8_t line);
|
2023-03-15 20:20:14 +01:00
|
|
|
void calcLineHeights();
|
|
|
|
|
void setFont(uint8_t line);
|
2023-01-17 23:51:53 +01:00
|
|
|
|
2023-11-20 22:02:44 +01:00
|
|
|
Task _loopTask;
|
|
|
|
|
|
2023-01-17 23:51:53 +01:00
|
|
|
U8G2* _display;
|
|
|
|
|
|
2023-08-25 16:57:24 +02:00
|
|
|
bool _displayTurnedOn;
|
|
|
|
|
|
2023-01-19 20:12:16 +01:00
|
|
|
DisplayType_t _display_type = DisplayType_t::None;
|
2023-05-23 18:25:12 +02:00
|
|
|
uint8_t _display_language = DISPLAY_LANGUAGE;
|
2023-01-17 23:51:53 +01:00
|
|
|
uint8_t _mExtra;
|
|
|
|
|
uint16_t _period = 1000;
|
|
|
|
|
uint16_t _interval = 60000; // interval at which to power save (milliseconds)
|
|
|
|
|
uint32_t _previousMillis = 0;
|
|
|
|
|
char _fmtText[32];
|
2023-03-15 20:20:14 +01:00
|
|
|
bool _isLarge = false;
|
|
|
|
|
uint8_t _lineOffsets[5];
|
2023-01-17 23:51:53 +01:00
|
|
|
};
|
|
|
|
|
|
2023-01-18 21:25:30 +01:00
|
|
|
extern DisplayGraphicClass Display;
|