-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdwenguino_lcd.h
More file actions
99 lines (83 loc) · 2.07 KB
/
dwenguino_lcd.h
File metadata and controls
99 lines (83 loc) · 2.07 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
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
/*
* dwenguinoLCD.h
*
* Created on: Feb 17, 2021
* Author: Tom Neutens
*/
#ifndef DWENGUINO_LCD_H_
#define DWENGUINO_LCD_H_
#include "dwenguino_board.h"
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
// Properties
#define LCD_WIDTH 16
#define LCD_HEIGHT 2
#define LCD_LASTLINE (LCD_HEIGHT - 1)
#define LCD_LASTPOS (LCD_WIDTH - 1)
// Macro's
#define backlightOn() (PORTE |= (1<<3))
#define backlightOff() (PORTE &= ~(1<<3))
#define appendStringToLCD(message) appendStringToLCD_((const char*)(message))
// Functions
/*
@brief Initializes the LCD communication.
*/
void initLCD(void);
/*
@brief Clears the LCD screen.
*/
void clearLCD(void);
/*
@brief Send a command to the LCD screen over PORTA.
@param c The command to be sent.
*/
void commandLCD(const BYTE c);
/*
@brief Set the cursor to a specific position.
@param l line
@param p position
*/
void setCursorLCD(BYTE l, BYTE p);
/*
@brief print a character on the current cursor position and move the cursor.
@param c the character to be printed.
*/
void appendCharToLCD(const char c);
/*
@brief print a character to the LCD.
@param s the character to be printed.
@param l line
@param p position
*/
void printCharToLCD(const char s, BYTE l, BYTE p);
/*
@brief Print a char sequence on a specific position on the screen.
@param message The char sequence to be printed.
@param l line
@param p position
*/
void printStringToLCD(char* message, BYTE l, BYTE p);
/*
@brief print an integer to the LCD on the current cursor position.
@param i The integer to be printed.
*/
void appendIntToLCD(int i);
/*
@brief print an integer to the LCD on a specific position.
@param i The integer to be printed.
@param l line
@param p position
*/
void printIntToLCD(int i, BYTE l, BYTE p);
// Structures
/*
@brief Contains the current cursor position.
*/
struct lcd_info_type{
unsigned char line;
unsigned char pos;
};
// Keeps track of current line number and character position.
extern struct lcd_info_type lcd_info;
#endif /* DWENGUINO_LCD_H_ */