LoRa_APRS_iGate/lib/Display/Display.h

70 wiersze
1.2 KiB
C
Czysty Zwykły widok Historia

2021-01-19 22:12:55 +00:00
#ifndef DISPLAY_H_
#define DISPLAY_H_
#include <list>
2021-01-19 22:12:55 +00:00
#include <memory>
#include <map>
#include <Arduino.h>
#include <Wire.h>
#include <TimeLib.h>
2021-01-19 22:12:55 +00:00
#include <SSD1306.h>
#include <BoardFinder.h>
class StatusFrame;
class DisplayFrame
{
public:
DisplayFrame() {}
virtual ~DisplayFrame() {}
virtual void drawStatusPage(Bitmap & bitmap) = 0;
};
2021-01-19 22:12:55 +00:00
class Display
{
public:
static Display & instance()
{
static Display _instance;
return _instance;
}
~Display() {}
void setup(std::shared_ptr<BoardConfig> boardConfig);
2021-02-10 21:37:18 +00:00
void turn180();
void update();
2021-01-19 22:12:55 +00:00
void addFrame(std::shared_ptr<DisplayFrame> frame);
2021-01-19 22:12:55 +00:00
void setStatusFrame(std::shared_ptr<StatusFrame> frame);
void showSpashScreen(String firmwareTitle, String version);
2021-01-19 22:12:55 +00:00
private:
std::shared_ptr<OLEDDisplay> _disp;
std::list<std::shared_ptr<DisplayFrame>> _frames;
std::shared_ptr<StatusFrame> _statusFrame;
2021-01-19 22:12:55 +00:00
time_t _nextFrameTime;
2021-01-19 22:12:55 +00:00
Display();
Display(const Display &);
Display & operator = (const Display &);
};
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