-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathLCDIC2.h
More file actions
63 lines (53 loc) · 1.85 KB
/
LCDIC2.h
File metadata and controls
63 lines (53 loc) · 1.85 KB
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
#ifndef LCDIC2_H
#define LCDIC2_H
#include <Wire.h>
#define LCDIC2_MODE 0b100
#define LCDIC2_DISPLAY 0b1000
#define LCDIC2_MOVE 0b10000
#define LCDIC2_FUNCTION 0b100000
#define LCDIC2_CGRAM 0b1000000
#define LCDIC2_DDRAM 0b10000000
#define LCDIC2_BITS_4 0b0
#define LCDIC2_CURSOR 0b0000
#define LCDIC2_SHIFT 0b1000
#define LCDIC2_LEFT 0b000
#define LCDIC2_RIGHT 0b100
class LCDIC2 {
private:
bool _backlight = true, _blink = false, _cursor = true, _display = true, _font = 0, _gain = true, _shift = false;
uint8_t _address, _height = 0, _width = 0;
bool busy();
uint8_t request(uint8_t rs);
bool send(uint8_t data, uint8_t rs = 0);
uint8_t start(uint8_t y);
bool wait(uint16_t us);
bool write(uint8_t data, uint8_t rs = 0);
public:
const bool backlight = _backlight, blink = _blink, cursor = _cursor, display = _display, font = _font, gain = _gain, shift = _shift;
const uint8_t height = _height, width = _width;
LCDIC2(uint8_t address, uint8_t width, uint8_t height, bool font = 0);
bool begin();
char charAt(uint8_t x, uint8_t y);
bool clear();
bool cursorLeft();
bool cursorRight();
void getCursor(uint8_t &x, uint8_t &y);
bool getGlyph(uint8_t glyph, uint8_t *&buffer);
bool home();
bool leftToRight();
bool moveLeft();
bool moveRight();
bool print(uint8_t glyph);
uint8_t print(String data);
bool rightToLeft();
bool setBacklight(bool state);
bool setBlink(bool state);
bool setCursor(bool state);
bool setCursor(uint8_t x, uint8_t y);
bool setDisplay(bool state);
bool setFont(bool font);
bool setGlyph(uint8_t glyph, uint8_t buffer[]);
bool setLines(uint8_t height);
bool setShift(bool state);
};
#endif