-
Notifications
You must be signed in to change notification settings - Fork 1
/
lcd.h
109 lines (94 loc) · 1.94 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
/*
* lcd.h
*
* API for interfacing with the MSOE dev board LCD display
*/
//Include Guards
#ifndef LCD_H_
#define LCD_H_
#include <inttypes.h>
/**
* See LCD documentation ST7066U
* DB0 = PA4
* DB1 = PA5
* DB2 = PA6
* DB3 = PA7
* DB4 = PA8
* DB5 = PA9
* DB6 = PA10
* DB7 = PA11 (also busy flag)
*
* RS = PC8
* R/W = PC9
* E = PC10
*
*/
#define DB0 4
#define DB1 5
#define DB2 6
#define DB3 7
#define DB4 8
#define DB5 9
#define DB6 10
#define DB7 11 // also busy flag
#define RS 8
#define RW 9
#define E 10
/**
* Initializes I/O to interface to communicate with LCD module.
* Clears and homes the display.
*/
void lcd_init();
/**
* Clears the display.
* Includes necessary delay.
*/
void lcd_clear();
/**
* Moves cursor to the home position.
* Includes necessary delay.
*/
void lcd_home();
/**
* Moves cursor to the position indicated.
*
* @param row
* zero-based row of desired position
* @param col
* zero-based column of desired position
* Includes necessary delay
*/
void lcd_set_position(uint8_t row, uint8_t col);
/**
* Prints a null terminated string to the display.
* Accepts the pointer to a null-terminated string, returns the number of characters written to
* the display.
*
* @param str_ptr
* pointer to a null-terminated string
* @return
* number of characters written to the display
*/
uint8_t lcd_print_string(char *str_ptr);
/**
* Prints a (decimal) number to the display.
* Accepts the number to be printed, returns the number of characters written to the display.
*
* @param num
* number to be printed
* @return uint32_t
* number of characters written to the display
*/
uint32_t lcd_print_num(uint32_t num);
/**
* Writes an instruction to the LCD controller.
*
* @param instr
* instruction to be written to LCD controller
*/
void lcd_write_instr(uint32_t instr);
/**
* TODO
*/
void lcd_write_data(uint32_t data);
#endif