mirror of
https://github.com/Lemonochrme/clover.git
synced 2025-06-08 08:40:50 +02:00
54 lines
No EOL
1.3 KiB
C++
54 lines
No EOL
1.3 KiB
C++
#ifndef _HEADER_SCREEN
|
|
#define _HEADER_SCREEN
|
|
#include <U8g2lib.h>
|
|
#include <Wire.h>
|
|
|
|
#include "ScreenComponents.hpp"
|
|
|
|
namespace Display
|
|
{
|
|
constexpr uint8_t FONT_SIZE=6;
|
|
|
|
class Screen
|
|
{
|
|
public:
|
|
// Singleton
|
|
static Screen &GetInstance()
|
|
{
|
|
static Screen instance;
|
|
return instance;
|
|
}
|
|
// Public functions
|
|
void Setup(uint8_t *font);
|
|
void connecting(uint8_t state = 0);
|
|
void connected(const char *ipaddress, uint8_t timing);
|
|
void loop();
|
|
// Getters
|
|
uint16_t getHeight();
|
|
uint16_t getWidth();
|
|
U8G2_SSD1306_128X64_NONAME_F_HW_I2C& getScreen();
|
|
uint16_t getTextWidth(const char * str);
|
|
private:
|
|
// Singleton
|
|
Screen();
|
|
~Screen();
|
|
Screen(const Screen &) = delete;
|
|
Screen &operator=(const Screen &) = delete;
|
|
|
|
// Fonctions
|
|
uint16_t setupHeader(const uint16_t w_padding = 2, const uint16_t h_padding = 5);
|
|
|
|
// Variables
|
|
U8G2_SSD1306_128X64_NONAME_F_HW_I2C *_screen;
|
|
uint8_t *_font;
|
|
uint16_t _width;
|
|
uint16_t _height;
|
|
String _loading;
|
|
|
|
// Static Components
|
|
Components connectingWindow;
|
|
Components connectedWindow;
|
|
};
|
|
}
|
|
|
|
#endif //_HEADER_SCREEN
|