forked from wertarbyte/funkenschlag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lcd.h
114 lines (94 loc) · 4.66 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include "input.h"
#define LCD_CLEARDISPLAY 0x01 // Command (HD44780) Page 21
#define LCD_RETURNHOME 0x02 // Command (HD44780)
// flags for display entry mode
#define LCD_ENTRYMODESET 0x04 // Command (HD44780)
#define LCD_ENTRYSHIFTINCREMENT 0x01 // Setting (HD44780)*
#define LCD_ENTRYSHIFTDECREMENT 0x00 // Setting (HD44780)
#define LCD_ENTRYLEFT 0x02 // Setting (HD44780)*
#define LCD_ENTRYRIGHT 0x00 // Setting (HD44780)
// flags for display on/off control
#define LCD_DISPLAYCONTROL 0x08 // Command (HD44780) Page 22
#define LCD_DISPLAYON 0x04 // Setting (HD44780)*
#define LCD_DISPLAYOFF 0x00 // Setting (HD44780)
#define LCD_CURSORON 0x02 // Setting (HD44780)
#define LCD_CURSOROFF 0x00 // Setting (HD44780)*
#define LCD_BLINKON 0x01 // Setting (HD44780)
#define LCD_BLINKOFF 0x00 // Setting (HD44780)*
// flags for display/cursor shift
#define LCD_CURSORSHIFT 0x10 // Command (HD44780)
#define LCD_DISPLAYMOVE 0x08 // Setting (HD44780)
#define LCD_CURSORMOVE 0x00 // Setting (HD44780)
#define LCD_MOVERIGHT 0x04 // Setting (HD44780)
#define LCD_MOVELEFT 0x00 // Setting (HD44780)
#define LCD_FUNCTIONSET 0x20 // Command (HD44780) Page 23
#define LCD_INSTRUCTION_SET_BASIC 0x00 // Setting (ST7032)
#define LCD_INSTRUCTION_SET_EXTENDED 0x01 // Setting (ST7032)
#define LCD_2LINE 0x08 // Setting (HD44780)*
#define LCD_1LINE 0x00 // Setting (HD44780)
#define LCD_8BITMODE 0x10 // Setting (HD44780)*
//#define LCD_4BITMODE 0x00 // Setting (HD44780) Not used in I2C mode
//#define LCD_5x10DOTS 0x04 // Setting (HD44780) Not supported by ST7032
#define LCD_5x8DOTS 0x00 // Setting (HD44780)*
#define LCD_SETCGRAMADDR 0x40 // Command (HD44780) Page 24
#define LCD_SETDDRAMADDR 0x80 // Command (HD44780)
#define LCD_BIAS_OSC_CONTROL 0x10 // Command (ST7032) Page 26
#define LCD_BIAS1_4 0x08 // Setting (ST7032)
#define LCD_BIAS1_5 0x00 // Setting (ST7032)*
// Internal frequency adjust for VDD = 3.0 V
#define LCD_OSC_122 0x00 // Setting (ST7032)
#define LCD_OSC_131 0x01 // Setting (ST7032)
#define LCD_OSC_144 0x02 // Setting (ST7032)
#define LCD_OSC_161 0x03 // Setting (ST7032)
#define LCD_OSC_183 0x04 // Setting (ST7032)
#define LCD_OSC_221 0x05 // Setting (ST7032)
#define LCD_OSC_274 0x06 // Setting (ST7032)
#define LCD_OSC_347 0x07 // Setting (ST7032)
// Internal frequency adjust for VDD = 5.0 V
#define LCD_OSC_120 0x00 // Setting (ST7032)
#define LCD_OSC_133 0x01 // Setting (ST7032)
#define LCD_OSC_149 0x02 // Setting (ST7032)
#define LCD_OSC_167 0x03 // Setting (ST7032)
#define LCD_OSC_192 0x04 // Setting (ST7032)*
#define LCD_OSC_227 0x05 // Setting (ST7032)
#define LCD_OSC_277 0x06 // Setting (ST7032)
#define LCD_OSC_347 0x07 // Setting (ST7032)
#define ICON_RAMADDRESSSET 0x40 // Command (ST7032)
#define LCD_ICON_CONTRAST_HIGH_BYTE 0x50 // Command (ST7032)
#define LCD_ICON_ON 0x08 // Setting (ST7032)
#define LCD_ICON_OFF 0x00 // Setting (ST7032)
#define LCD_BOOSTER_ON 0x04 // Setting (ST7032)*
#define LCD_BOOSTER_OFF 0x00 // Setting (ST7032)
#define LCD_CONTRAST_HIGH_BYTE_MASK 0x03 // Only used for bit masking (ST7032)
#define LCD_FOLLOWER_CONTROL 0x60 // Command (ST7032) Page 27
#define LCD_FOLLOWER_ON 0x08 // Setting (ST7032)*
#define LCD_FOLLOWER_OFF 0x00 // Setting (ST7032)
#define LCD_Rab_1_00 0x00 // Setting (ST7032)
#define LCD_Rab_1_25 0x01 // Setting (ST7032)
#define LCD_Rab_1_50 0x02 // Setting (ST7032)
#define LCD_Rab_1_80 0x03 // Setting (ST7032)
#define LCD_Rab_2_00 0x04 // Setting (ST7032)*
#define LCD_Rab_2_50 0x05 // Setting (ST7032)
#define LCD_Rab_3_00 0x06 // Setting (ST7032)
#define LCD_Rab_3_75 0x07 // Setting (ST7032)
#define LCD_CONTRAST_LOW_BYTE 0x70 // Command (ST7032)
#define LCD_CONTRAST_LOW_BYTE_MASK 0x0F // Only used for bit masking (ST7032)
#define LCD_CHAR_OMEGA 0x1E
#define LCD_CHAR_CHEVRON_UP 0x17
#define LCD_CHAR_DEGREES 0xDF
#define LCD_CHAR_ARROW_RIGHT 0x7E
#define LCD_CHAR_ARROW_LEFT 0x7F
#define LCD_ICON_CLOCK 0x00
void lcd_init(void);
void lcd_splash(void);
void lcd_clear(void);
void lcd_write(char c);
void lcd_fwrite(const char *format_string, ...);
void lcd_write_str(const char *c);
void lcd_write_int(int16_t t);
void lcd_write_uint(uint16_t t);
void lcd_set_cursor(uint8_t c, uint8_t r);
char lcd_get_bargraph(uint8_t);
void lcd_create_crosshair(isrc_t xd, isrc_t yd, uint8_t slot);
void lcd_create_bargraph(isrc_t bd, uint8_t slot);
uint8_t lcd_refresh_timeout(void);