-
Notifications
You must be signed in to change notification settings - Fork 0
/
EpaperDevice.h
73 lines (61 loc) · 2.14 KB
/
EpaperDevice.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
67
68
69
70
71
72
73
#ifndef EPAPERDEVICE_H
#define EPAPERDEVICE_H
#include <SPI.h>
#include <epd1in54.h>
#include <epdpaint.h>
#include "GpsDevice.h"
#include "BMP180Device.h"
class EpaperDevice {
public:
EpaperDevice(GpsDevice& gpsDevice, BMP180Device& bmp180Device);
~EpaperDevice();
void init();
void drawLabels();
void drawUnits();
void drawData(); // TODO remove this
void drawLatData();
void drawLonData();
void drawAltData();
void drawTmpData();
void drawPrsData();
void drawDirData();
void fetchLat();
void fetchLon();
void fetchAlt();
void fetchTmp();
void fetchPrs();
void fetchDir();
private:
const String classname = "[EpaperDevice]";
void logmsg(String msg);
GpsDevice& gpsDevice;
BMP180Device& bmp180Device;
/**
* Due to RAM not enough in Arduino UNO, a frame buffer is not allowed.
* In this case, a smaller image buffer is allocated and you have to
* update a partial display several times.
* 1 byte = 8 pixels, therefore you have to set 8*N pixels at a time.
*/
unsigned char image[1024];
Paint paint; // width should be the multiple of 8
Epd epd;
// LABELS
const char latLabel[4] = {'L', 'A', 'T', '\0'};
const char lonLabel[4] = {'L', 'O', 'N', '\0'};
const char altLabel[5] = {'A', 'L', 'T', ':', '\0'};
const char tmpLabel[5] = {'T', 'M', 'P', ':', '\0'};
const char prsLabel[5] = {'P', 'R', 'S', ':', '\0'};
const char dirLabel[5] = {'D', 'I', 'R', ':', '\0'};
// UNITS
const char altUnit[3] = {'f', 't', '\0'};
const char tmpUnit[2] = {'F', '\0'};
const char prsUnit[3] = {'m', 'b', '\0'};
// DATA
char latData[10] = {'0', '0', '0', '0', '0', '.', '0', '0', '0', '\0'}; // ex. 3000.452 N
char lonData[10] = {'0', '0', '0', '0', '0', '.', '0', '0', '0', '\0'}; // ex. 10000.719 W
char altData[7] = {'0', '0', ',', '0', '0', '0', '\0'}; // ex. 14115 ft.
char tmpData[6] = {'0', '0', '0', '.', '0', '\0'}; // ex. 101.2 F
char prsData[7] = {'0', '0', '0', '.', '0', '0', '\0'}; // ex. 847.18 mb
char dir_data[4] = {'W', 'N', 'W', '\0'}; // ex, ESE 'east south east'
};
#endif