-
Notifications
You must be signed in to change notification settings - Fork 1
/
Screen.h
66 lines (53 loc) · 1.3 KB
/
Screen.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "Context.h"
#include <Arduino.h>
#include <TFT_eSPI.h>
#ifndef AQM_SCREEN
#define AQM_SCREEN
// Display pinout setup
#ifndef TFT_DISPOFF
#define TFT_DISPOFF 0x28
#endif
#ifndef TFT_SLPIN
#define TFT_SLPIN 0x10
#endif
#define TFT_WIDTH 135
#define TFT_HEIGHT 240
#define TFT_MOSI 19
#define TFT_SCLK 18
#define TFT_CS 5
#define TFT_DC 16
#define TFT_RST 23
#define TFT_BL 4 // Display backlight control pin
#define ADC_EN 14 // ADC_EN is the ADC detection enable port
#define ADC_PIN 34
const uint8_t TOTAL_SCREEN = 4;
const uint8_t SCREEN_PM25 = 0;
const uint8_t SCREEN_ECO2 = 1;
const uint8_t SCREEN_TVOC = 2;
const uint8_t SCREEN_ALL = 3;
class Screen {
private:
// Screen management
TFT_eSPI tft = TFT_eSPI(TFT_WIDTH, TFT_HEIGHT);
int16_t h;
int16_t w;
uint8_t currentView = 0;
// View data binding
Context *context;
void showMeasurement(measurement m, char *libelle, char *unit, char *rawValueUnit = "");
public:
Screen(struct Context *context);
void setView(uint8_t view);
void nextView();
void refresh();
void toggleBacklight();
void waitForIt(char *message, int8_t seconds);
// Views
void showSplash(char *libelle, int8_t counter = -1);
void showError(char *message);
void showMainConcentration();
void showeco2();
void showtvoc();
void showAllData();
};
#endif