-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLCD.h
86 lines (76 loc) · 2.32 KB
/
LCD.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
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef LCD_H
#define LCD_H
#include <string>
#include "Pin.h"
namespace Actinium {
typedef unsigned char BYTE;
typedef bool BIT;
const BYTE LCD_UPPERCASE_START_INDEX = 0b01000001;
const BYTE LCD_LOWERCASE_START_INDEX = 0b01100001;
const BYTE LCD_NUMERIC_START_INDEX = 0b00110000;
std::string CharToLCDBin(char character);
enum ShiftDirection {
RIGHT,
LEFT
};
enum LineCount {
ONE,
TWO
};
enum FontSize {
FiveByEight,
FiveByEleven
};
class LCD {
Pin m_RS_PIN = Pin(0, PinMode::OUT);
Pin m_RW_PIN = Pin(0, PinMode::OUT);
Pin m_E_PIN = Pin(0, PinMode::OUT);
Pin m_DB7_PIN = Pin(0, PinMode::OUT);
Pin m_DB6_PIN = Pin(0, PinMode::OUT);
Pin m_DB5_PIN = Pin(0, PinMode::OUT);
Pin m_DB4_PIN = Pin(0, PinMode::OUT);
Pin m_DB3_PIN = Pin(0, PinMode::OUT);
Pin m_DB2_PIN = Pin(0, PinMode::OUT);
Pin m_DB1_PIN = Pin(0, PinMode::OUT);
Pin m_DB0_PIN = Pin(0, PinMode::OUT);
public:
// 10 BYTE constructor takes pin numbers of required outputs
LCD(BYTE RS,
BYTE RW,
BYTE E,
BYTE DB7,
BYTE DB6,
BYTE DB5,
BYTE DB4,
BYTE DB3,
BYTE DB2,
BYTE DB1,
BYTE DB0);
void SetPins(BIT RS,
BIT RW,
BIT DB7,
BIT DB6,
BIT DB5,
BIT DB4,
BIT DB3,
BIT DB2,
BIT DB1,
BIT DB0);
void SetPins(std::string bits);
void ResetPins(bool ResetEnable = true);
void ResetCursor();
void CursorEnd();
void CursorPos(BYTE position);
void CursorRight();
void CursorLeft();
void ClearDisplay();
void WriteChar(char input);
void WriteString(std::string input, unsigned int sleep = 2);
void Apply();
void EntryMode(ShiftDirection Shift, bool ShiftDisplay);
void FunctionSet(LineCount NumLines, FontSize dispSize);
void On(bool cursor = true, bool cursorBlink = true);
void Off();
};
}
#endif