bcab214e20730aa4ae29138a28d3a46f555e182e
[bertos.git] / drv / lcd_hd44.h
1 /**
2  * \file
3  * <!--
4  * Copyright 2005 Develer S.r.l. (http://www.develer.com/)
5  * This file is part of DevLib - See README.devlib for information.
6  * -->
7  *
8  * \brief Hitachi HD44780 and clones LCD module (interface)
9  *
10  * \version $Id$
11  * \author Bernardo Innocenti <bernie@develer.com>
12  * \author Stefano Fedrigo <aleph@develer.com>
13  */
14
15 /*#*
16  *#* $Log$
17  *#* Revision 1.3  2006/09/20 19:55:01  marco
18  *#* Added CONFIG_LCD_4BIT.
19  *#*
20  *#* Revision 1.2  2006/07/19 12:56:25  bernie
21  *#* Convert to new Doxygen style.
22  *#*
23  *#* Revision 1.1  2005/11/04 18:00:42  bernie
24  *#* Import into DevLib.
25  *#*
26  *#* Revision 1.2  2005/06/14 14:43:43  bernie
27  *#* Add DevLib headers.
28  *#*
29  *#* Revision 1.1  2005/05/24 09:17:58  batt
30  *#* Move drivers to top-level.
31  *#*
32  *#* Revision 1.3  2005/04/22 13:14:58  batt
33  *#* Better lcd rows and cols definition.
34  *#*
35  *#* Revision 1.2  2005/04/17 22:41:39  bernie
36  *#* lcd_test(): Rename to lcd_hw_test() and conditionalize on CONFIG_TEST.
37  *#*
38  *#* Revision 1.1  2005/04/16 19:48:35  aleph
39  *#* Rename lcd driver
40  *#*/
41
42 #ifndef DRV_LCD_HD44_H
43 #define DRV_LCD_HD44_H
44
45 #include <appconfig.h>
46 #include <cfg/compiler.h> /* For stdint types */
47
48 /**
49  * \name Display dimensions (in chars)
50  * \{
51  */
52 #define LCD_ROWS  2
53 #define LCD_COLS  16
54 /* \} */
55
56 /**
57  * \name Hitachi HD44 commands.
58  * \{
59  */
60 #define LCD_CMD_DISPLAY_INI      0x30
61
62 #if CONFIG_LCD_4BIT
63         #define LCD_CMD_SETFUNC  0x28   /**< 4 bits, 2 lines, 5x7 dots */
64 #else
65         #define LCD_CMD_SETFUNC  0x38   /**< 8 bits, 2 lines, 5x7 dots */
66 #endif
67
68 #define LCD_CMD_DISPLAY_ON       0x0F   /**< Switch on display */
69 #define LCD_CMD_DISPLAY_OFF      0x08   /**< Switch off display */
70 #define LCD_CMD_CLEAR            0x01   /**< Clear display */
71 #define LCD_CMD_CURSOR_BLOCK     0x0D   /**< Show cursor (block) */
72 #define LCD_CMD_CURSOR_LINE      0x0F   /**< Show cursor (line) */
73 #define LCD_CMD_CURSOR_OFF       0x0C   /**< Hide cursor */
74 #define LCD_CMD_DISPLAYMODE      0x06
75 #define LCD_CMD_SET_CGRAMADDR    0x40
76 #define LCD_CMD_RESET_DDRAM      0x80
77 #define LCD_CMD_SET_DDRAMADDR    0x80
78 #define LCD_CMD_DISPLAY_SHIFT    0x18
79 #define LCD_CMD_MOVESHIFT_LEFT   0x00
80 #define LCD_CMD_MOVESHIFT_RIGHT  0x04
81 /*\}*/
82
83 /** Type for combined LCD cursor position (x,y). */
84 typedef uint8_t lcdpos_t;
85
86 void lcd_waitBusy(void);
87 void lcd_moveTo(uint8_t addr);
88 void lcd_setReg(uint8_t val);
89 void lcd_putc(uint8_t a, uint8_t c);
90 void lcd_remapChar(const char *glyph, char code);
91 void lcd_hw_init(void);
92 void lcd_hw_test(void);
93
94 #endif /* DRV_LCD_HD44_H */