-
Notifications
You must be signed in to change notification settings - Fork 0
/
lcd_util.h
40 lines (30 loc) · 914 Bytes
/
lcd_util.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
#ifndef LCD_UTIL_HEADER_GUARD
#define LCD_UTIL_HEADER_GUARD
#include <LiquidCrystal_I2C.h>
namespace lcdut {
namespace symbols {
constexpr char deg = 223;
constexpr char alpha = 0b11100000;
constexpr char beta = 0b11100010;
}
struct pos {
uint8_t row, col;
explicit pos(uint8_t col, uint8_t row): col(col), row(row) {}
friend LiquidCrystal_I2C& operator<<(LiquidCrystal_I2C& lcd, const pos& obj) {
lcd.setCursor(obj.col, obj.row);
return lcd;
}
};
LiquidCrystal_I2C& clear(LiquidCrystal_I2C& lcd) {
lcd.clear();
return lcd;
}
LiquidCrystal_I2C& home(LiquidCrystal_I2C& lcd) {
lcd.home();
return lcd;
}
LiquidCrystal_I2C& operator<<(LiquidCrystal_I2C& lcd, LiquidCrystal_I2C& (*modifier)(LiquidCrystal_I2C&) ) {
return modifier(lcd);
}
}
#endif