Split into modules, add error handling
This commit is contained in:
parent
23be368b68
commit
e7532b40a7
14 changed files with 946 additions and 790 deletions
60
include/lcd_interface.h
Normal file
60
include/lcd_interface.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#ifndef __LCD_INTERFACE_H__
|
||||
#define __LCD_INTERFACE_H__
|
||||
|
||||
/* https://www.lcd-module.de/eng/pdf/zubehoer/ks0066.pdf */
|
||||
enum LCD_Command {
|
||||
LCD_CMD_CLEAR = 0x01,
|
||||
LCD_CMD_HOME = 0x02,
|
||||
LCD_CMD_ENTRY_MODE = 0x04,
|
||||
LCD_CMD_ON_OFF = 0x08,
|
||||
LCD_CMD_SHIFT = 0x10,
|
||||
LCD_CMD_FUNCTION = 0x20,
|
||||
LCD_CMD_CGRAM_ADDR = 0x40,
|
||||
LCD_CMD_DDRAM_ADDR = 0x80,
|
||||
};
|
||||
|
||||
enum LCD_ENTRY_MODE_Cmd {
|
||||
LCD_ENTRY_CUR_RIGHT = 0x02,
|
||||
LCD_ENTRY_CUR_LEFT = 0x00,
|
||||
LCD_ENTRY_DSP_RIGHT = 0x03,
|
||||
LCD_ENTRY_DSP_LEFT = 0x01,
|
||||
};
|
||||
|
||||
enum LCD_ON_OFF_Cmd {
|
||||
LCD_DSP_ON = 0x04,
|
||||
LCD_DSP_OFF = 0x00,
|
||||
LCD_CUR_ON = 0x02,
|
||||
LCD_CUR_OFF = 0x00,
|
||||
LCD_BLK_ON = 0x01,
|
||||
LCD_BLK_OFF = 0x00,
|
||||
};
|
||||
|
||||
enum LCD_SHIFT_Cmd {
|
||||
LCD_SH_CUR_LEFT = 0x00,
|
||||
LCD_SH_CUR_RIGHT = 0x04,
|
||||
LCD_SH_DSP_LEFT = 0x08,
|
||||
LCD_SH_DSP_RIGHT = 0x0C,
|
||||
};
|
||||
|
||||
enum LCD_FUNCTION_Cmd {
|
||||
LCD_FN_4BIT = 0x00,
|
||||
LCD_FN_8BIT = 0x10,
|
||||
LCD_FN_1LINE = 0x00,
|
||||
LCD_FN_2LINE = 0x08,
|
||||
LCD_FN_5X8 = 0x00,
|
||||
LCD_FN_5X11 = 0x04,
|
||||
};
|
||||
|
||||
#define LCD_ENTER_8BIT 0x3
|
||||
#define LCD_ENTER_4BIT 0x2
|
||||
|
||||
enum LCD_Pins {
|
||||
B_LCD_RS = (1<<0),
|
||||
B_LCD_RW = (1<<1),
|
||||
B_LCD_E = (1<<2),
|
||||
B_LCD_LED = (1<<3),
|
||||
};
|
||||
|
||||
#define LCD_D_Pos 4
|
||||
|
||||
#endif /* __LCD_INTERFACE_H__ */
|
||||
Loading…
Add table
Add a link
Reference in a new issue