LoRa_APRS_iGate/src/Display/Display.h

73 wiersze
1.4 KiB
C
Czysty Zwykły widok Historia

2021-01-19 22:12:55 +00:00
#ifndef DISPLAY_H_
#define DISPLAY_H_
2023-09-23 13:37:35 +00:00
#include "BoardFinder/BoardFinder.h"
#include "Display/SSD1306.h"
#include "System/Timer.h"
2021-01-19 22:12:55 +00:00
#include <Arduino.h>
#include <Wire.h>
#include <list>
#include <map>
#include <memory>
2021-01-19 22:12:55 +00:00
2021-03-12 19:04:51 +00:00
class Timer;
class StatusFrame;
class DisplayFrame {
public:
DisplayFrame() {
}
virtual ~DisplayFrame() {
}
virtual void drawStatusPage(Bitmap &bitmap) = 0;
};
class Display {
2021-01-19 22:12:55 +00:00
public:
Display();
~Display();
2021-01-19 22:12:55 +00:00
2021-05-18 22:44:37 +00:00
void setup(BoardConfig const *const boardConfig);
// setup functions
void showSpashScreen(String firmwareTitle, String version);
void setStatusFrame(std::shared_ptr<StatusFrame> frame);
void showStatusScreen(String header, String text);
void turn180();
2021-03-13 21:45:43 +00:00
void activateDisplaySaveMode();
void setDisplaySaveTimeout(uint32_t timeout);
2021-01-19 22:12:55 +00:00
2021-09-03 20:24:04 +00:00
void activateDistplay();
// functions for update loop
void update();
void addFrame(std::shared_ptr<DisplayFrame> frame);
2021-01-19 22:12:55 +00:00
private:
2021-05-21 20:22:50 +00:00
OLEDDisplay *_disp;
2021-01-19 22:12:55 +00:00
Timer _displayFrameRate;
std::shared_ptr<StatusFrame> _statusFrame;
std::list<std::shared_ptr<DisplayFrame>> _frames;
Timer _frameTimeout;
2021-01-19 22:12:55 +00:00
2021-03-13 21:45:43 +00:00
bool _displaySaveMode;
Timer _displaySaveModeTimer;
2021-01-19 22:12:55 +00:00
};
class TextFrame : public DisplayFrame {
public:
TextFrame(String header, String text) : _header(header), _text(text) {
}
virtual ~TextFrame() {
}
void drawStatusPage(Bitmap &bitmap) override;
private:
String _header;
String _text;
};
2021-01-19 22:12:55 +00:00
#endif