Move gfx diplay driver to AVR driver dir.
[bertos.git] / drv / lcd_hd44.h
1 /**
2  * \file
3  * <!--
4  * This file is part of BeRTOS.
5  *
6  * Bertos is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * As a special exception, you may use this file as part of a free software
21  * library without restriction.  Specifically, if other files instantiate
22  * templates or use macros or inline functions from this file, or you compile
23  * this file and link it with other files to produce an executable, this
24  * file does not by itself cause the resulting executable to be covered by
25  * the GNU General Public License.  This exception does not however
26  * invalidate any other reasons why the executable file might be covered by
27  * the GNU General Public License.
28  *
29  * Copyright 2005 Develer S.r.l. (http://www.develer.com/)
30  *
31  * -->
32  *
33  * \brief Hitachi HD44780 and clones LCD module (interface)
34  *
35  * \version $Id$
36  * \author Bernardo Innocenti <bernie@develer.com>
37  * \author Stefano Fedrigo <aleph@develer.com>
38  */
39
40 /*#*
41  *#* $Log$
42  *#* Revision 1.3  2006/09/20 19:55:01  marco
43  *#* Added CONFIG_LCD_4BIT.
44  *#*
45  *#* Revision 1.2  2006/07/19 12:56:25  bernie
46  *#* Convert to new Doxygen style.
47  *#*
48  *#* Revision 1.1  2005/11/04 18:00:42  bernie
49  *#* Import into DevLib.
50  *#*
51  *#* Revision 1.2  2005/06/14 14:43:43  bernie
52  *#* Add DevLib headers.
53  *#*
54  *#* Revision 1.1  2005/05/24 09:17:58  batt
55  *#* Move drivers to top-level.
56  *#*
57  *#* Revision 1.3  2005/04/22 13:14:58  batt
58  *#* Better lcd rows and cols definition.
59  *#*
60  *#* Revision 1.2  2005/04/17 22:41:39  bernie
61  *#* lcd_test(): Rename to lcd_hw_test() and conditionalize on CONFIG_TEST.
62  *#*
63  *#* Revision 1.1  2005/04/16 19:48:35  aleph
64  *#* Rename lcd driver
65  *#*/
66
67 #ifndef DRV_LCD_HD44_H
68 #define DRV_LCD_HD44_H
69
70 #include <appconfig.h>
71 #include <cfg/compiler.h> /* For stdint types */
72
73 /**
74  * \name Display dimensions (in chars)
75  * \{
76  */
77 #define LCD_ROWS  2
78 #define LCD_COLS  16
79 /* \} */
80
81 /**
82  * \name Hitachi HD44 commands.
83  * \{
84  */
85 #define LCD_CMD_DISPLAY_INI      0x30
86
87 #if CONFIG_LCD_4BIT
88         #define LCD_CMD_SETFUNC  0x28   /**< 4 bits, 2 lines, 5x7 dots */
89 #else
90         #define LCD_CMD_SETFUNC  0x38   /**< 8 bits, 2 lines, 5x7 dots */
91 #endif
92
93 #define LCD_CMD_DISPLAY_ON       0x0F   /**< Switch on display */
94 #define LCD_CMD_DISPLAY_OFF      0x08   /**< Switch off display */
95 #define LCD_CMD_CLEAR            0x01   /**< Clear display */
96 #define LCD_CMD_CURSOR_BLOCK     0x0D   /**< Show cursor (block) */
97 #define LCD_CMD_CURSOR_LINE      0x0F   /**< Show cursor (line) */
98 #define LCD_CMD_CURSOR_OFF       0x0C   /**< Hide cursor */
99 #define LCD_CMD_DISPLAYMODE      0x06
100 #define LCD_CMD_SET_CGRAMADDR    0x40
101 #define LCD_CMD_RESET_DDRAM      0x80
102 #define LCD_CMD_SET_DDRAMADDR    0x80
103 #define LCD_CMD_DISPLAY_SHIFT    0x18
104 #define LCD_CMD_MOVESHIFT_LEFT   0x00
105 #define LCD_CMD_MOVESHIFT_RIGHT  0x04
106 /*\}*/
107
108 /** Type for combined LCD cursor position (x,y). */
109 typedef uint8_t lcdpos_t;
110
111 void lcd_waitBusy(void);
112 void lcd_moveTo(uint8_t addr);
113 void lcd_setReg(uint8_t val);
114 void lcd_putc(uint8_t a, uint8_t c);
115 void lcd_remapChar(const char *glyph, char code);
116 void lcd_hw_init(void);
117 void lcd_hw_test(void);
118
119 #endif /* DRV_LCD_HD44_H */