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
|
#include "Layout.h"
#include "font_6x8.h"
Label::Label(uint8_t col, uint8_t row, std::string value)
: _col(col),
_row(row),
_value(value)
{}
Field::Field(uint8_t col, uint8_t row, uint8_t maxSize)
: _col(col),
_row(row),
_maxSize(maxSize)
{}
Image::Image(uint8_t col, uint8_t row, const uint8_t* bmp)
: _col(col),
_row(row),
_bmp(bmp)
{}
Layout::Layout(DOGS102* lcd) : _lcd(lcd) {}
Layout::~Layout() {}
void Layout::clear() {
_lcd->clearBuffer();
}
void Layout::startUpdate() {
_lcd->startUpdate();
}
void Layout::endUpdate() {
_lcd->endUpdate();
}
bool Layout::writeField(uint8_t col, uint8_t row, std::string field, bool apply) {
return writeField(col, row, field.c_str(), field.size(), apply);
}
bool Layout::writeField(uint8_t col, uint8_t row, const char* field, size_t size, bool apply) {
if (apply)
startUpdate();
_lcd->writeText(col*6, row, font_6x8, field, size);
if (apply)
endUpdate();
return true;
}
bool Layout::writeImage(uint8_t col, uint8_t row, const uint8_t* bmp, bool apply) {
if (apply)
startUpdate();
_lcd->writeBitmap(col, row, bmp);
if (apply)
endUpdate();
return true;
}
|