lcd.h (748B)
1 #ifndef _LCD_H_ 2 #define _LCD_H_ 3 4 #include <stdint.h> 5 6 #define LCD_DELAY_STARTUP 15 7 #define LCD_DELAY_CMD 2 8 #define LCD_SEL_INST 0 /* Instruction register for RS */ 9 #define LCD_SEL_DATA 1 /* Data register for RS */ 10 #define LCD_CLEAR 0x01 /* Clear screen */ 11 #define LCD_CURS_ROW1 0x02 /* Set cursor on (0, 0) */ 12 #define LCD_CURS_ROW2 0xc0 /* Set cursor on (1, 0) */ 13 #define LCD_CURS_INC 0x06 /* Auto-increment cursor */ 14 #define LCD_CURS_OFF 0x0c /* Hide cursor */ 15 #define LCD_MODE 0x38 /* 8-bit, 16x2 */ 16 //TODO: backlight 17 18 /* Function macros */ 19 #define lcd_putc(c) lcd_data(c, LCD_SEL_DATA) 20 #define lcd_cmd(cmd) lcd_data(cmd, LCD_SEL_INST) 21 22 void lcd_init(void); 23 void lcd_data(uint8_t, uint8_t); 24 void lcd_puts(const char *); 25 26 #endif /* _LCD_H_ */