-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlcd_hd44780u.h
48 lines (39 loc) · 1.59 KB
/
lcd_hd44780u.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
/*******************************************************************************
* File : lcd_hd44780u.h
* Brief : APIs for the HD44780U 16x2 Character LCD module
* Author : Kyungjae Lee
* Date : Jun 27, 2023
*
* Note : This code includes only the features that are necessary for my
* personal projects.
******************************************************************************/
#ifndef LCD_HD44780U_H
#define LCD_HD44780U_H
#include "stm32f407xx.h"
/* Application configurable items */
#define LCD_GPIO_PORT GPIOD
#define LCD_PIN_RS GPIO_PIN_0
#define LCD_PIN_RW GPIO_PIN_1
#define LCD_PIN_EN GPIO_PIN_2
#define LCD_PIN_D4 GPIO_PIN_3
#define LCD_PIN_D5 GPIO_PIN_4
#define LCD_PIN_D6 GPIO_PIN_5
#define LCD_PIN_D7 GPIO_PIN_6
/* LCD instructions */
#define LCD_INST_4DL_2N_5X8F 0x28 /* 4 data lines, 2 lines, 5x8 font size */
#define LCD_INST_DON_CURON 0x0E /* Display on, cursor on */
#define LCD_INST_INCADD 0x06 /* Entry mode set */
#define LCD_INST_CLEAR_DISPLAY 0x01 /* Clear display */
#define LCD_INST_RETURN_HOME 0x02 /* Return home */
/*******************************************************************************
* APIs supported by the HD44780U 16x2 Character LCD module
* (See the function definitions for more information)
******************************************************************************/
void LCD_Init(void);
void LCD_TxInstruction(uint8_t instruction);
void LCD_ClearDisplay(void);
void LCD_ReturnHome(void);
void LCD_PrintChar(uint8_t ch);
void LCD_PrintString(char *msg);
void LCD_SetCursor(uint8_t row, uint8_t column);
#endif /* LCD_HD44780U_H */