LCD 1602 Driver with ESP32 I2C
1.1
This is a complete driver for LCD 1602 using I2C with the ESP32
Loading...
Searching...
No Matches
lcd_1602_internal.h
Go to the documentation of this file.
1
12
13
#ifndef LCD_1602_INTERNAL_H_
14
#define LCD_1602_INTERNAL_H_
15
16
#ifdef __cplusplus
17
extern
"C"
{
18
#endif
19
20
/* Includes --------------------------------------------------------------------------------------*/
21
#include "
../lcd_1602.h
"
22
#include <stdint.h>
23
#include <stdlib.h>
24
25
/* Exported defines ------------------------------------------------------------------------------*/
29
#define LCD_1602_CLEAR_SCREEN 0x01
30
#define LCD_1602_RESET_CURSOR_POS 0x02
31
32
#define LCD_1602_INPUT_SET_MASK 0x07
33
#define LCD_1602_INPUT_SET 0x04
34
#define LCD_1602_INCREMENT_MODE 0x02
35
#define LCD_1602_DECREMENT_MODE 0x00
36
#define LCD_1602_DISPLAY_SHIFT_ON_WRITE 0x01
37
#define LCD_1602_CURSOR_N_MOVE 0x00
38
39
#define LCD_1602_DISPLAY_SWITCH_MASK 0x0F
40
#define LCD_1602_DISPLAY_SWITCH_FLAG 0x08
41
#define LCD_1602_DISPLAY_ON 0x04
42
#define LCD_1602_DISPLAY_OFF 0x00
43
#define LCD_1602_CURSOR_ON 0x02
44
#define LCD_1602_CURSOR_OFF 0x00
45
#define LCD_1602_BLINK_DISPLAY 0x01
46
#define LCD_1602_N_BLINK_DISPLAY 0x00
47
48
#define LCD_1602_SHIFT_BITMASK 0x1C
49
#define LCD_1602_SHIFT_FLAG 0x10
50
#define LCD_1602_CURSOR_MOVE 0x00
51
#define LCD_1602_DISPLAY_SHIFT 0x08
52
#define LCD_1602_SHIFT_LEFT 0x00
53
#define LCD_1602_SHIFT_RIGHT 0x04
54
55
#define LCD_1602_FUNCTION_SET_MASK 0x3C
56
#define LCD_1602_FUNCTION_SET_FLAG 0x20
57
#define LCD_1602_DATA_LEN_8_BIT 0x10
58
#define LCD_1602_DATA_LEN_4_BIT 0x00
59
#define LCD_1602_2_ROWS 0x08
60
#define LCD_1602_1_ROW 0x00
61
#define LCD_1602_FONT_5X10 0x04
62
#define LCD_1602_FONT_5X7 0x00
63
64
#define LCD_1602_BACKLIGHT 0x08
65
#define LCD_1602_ENABLE 0x04
66
#define LCD_1602_WRITE_DATA 0x00
67
#define LCD_1602_RS 0x01
68
70
71
/* Exported macros -------------------------------------------------------------------------------*/
87
#define LCD_1602_CONFIG_INPUT_SET(dir, mov) ((LCD_1602_INPUT_SET | dir | mov) & LCD_1602_INPUT_SET_MASK)
88
104
#define LCD_1602_CONFIG_DISPLAY_SWITCH(disp, curs, blink) ((LCD_1602_DISPLAY_SWITCH_FLAG | disp | curs | blink) & LCD_1602_DISPLAY_SWITCH_MASK)
105
118
#define LCD_1602_SHIFT(ele, dir) ((LCD_1602_SHIFT_FLAG | ele | dir) & LCD_1602_SHIFT_BITMASK)
119
135
#define LCD_1602_FUNCTION_SET(dl, r, f) ((LCD_1602_FUNCTION_SET_FLAG | dl | r | f) & LCD_1602_FUNCTION_SET_MASK)
136
138
139
#ifdef __cplusplus
140
}
141
#endif
142
143
#endif
// LCD_1602_INTERNAL_H_
lcd_1602.h
internal
lcd_1602_internal.h
Generated by
1.14.0