]> granicus.if.org Git - esp-idf/blob - components/esp32/include/xtensa/lcd-splc780d-4bitmode.h
Initial public version
[esp-idf] / components / esp32 / include / xtensa / lcd-splc780d-4bitmode.h
1 /*******************************************************************************
2
3 Copyright (c) 2009-2010 by Tensilica Inc.  ALL RIGHTS RESERVED.
4 These coded instructions, statements, and computer programs are the
5 copyrighted works and confidential proprietary information of Tensilica Inc.
6 They may not be modified, copied, reproduced, distributed, or disclosed to
7 third parties in any manner, medium, or form, in whole or in part, without
8 the prior written consent of Tensilica Inc.
9 --------------------------------------------------------------------------------
10
11 lcd-SPLC780D-4bitmode.h  Generic definitions for Sunplus SPLC780D LCD Controller
12 operating in 4 bit mode.
13
14 This is used by board-support-packages with one or more LCD displays that use
15 a SPLC780D controller in 4 bit mode. A BSP provides a base address for each 
16 instance of an SPLC780D LCD controller on the board.
17
18 Note that LCD display operation is almost totally independent of the LCD 
19 display, depending almost entirely on the controller. However the display
20 may limit the number of characters of the controller's RAM buffer that are
21 actually visible at one time. The length of the display's visible window
22 is not specifified in this controller-specific header, but comes to the 
23 driver from the board-specific "display.h" header.
24
25 *******************************************************************************/
26
27 #ifndef _LCD_SPLC780D_4BIT_H_
28 #define _LCD_SPLC780D_4BIT_H_
29
30
31 /* Offsets to controller registers from base. */
32 #define SPLC780D_4BIT_INST   0
33 #define SPLC780D_4BIT_DATA   (SPLC780D_4BIT_INST + SPLC780D_4BIT_REGSPACING)
34
35
36 #define SPLC780D_4BIT_INST_INIT1             0xFF /* First command in 
37                                                      init sequence */
38 #define SPLC780D_4BIT_INST_INIT2             0x30 /* Second command in 
39                                                      init sequence, 
40                                                      issued 3 times */
41 #define SPLC780D_4BIT_INST_INIT3             0x20 /* Third and last command 
42                                                      in init sequence */
43 #define SPLC780D_4BIT_INST_CLEAR             0x01 /* clear (blank) display) */
44 #define SPLC780D_4BIT_INST_SET_MODE          0x28 /* Set LCD mode. Supported
45                                                      setting is 4 bit data 
46                                                      length, 2 lines, 5*8 */
47 #define SPLC780D_4BIT_INST_DSPLY_ON          0x0C /* Set Display ON */
48 #define SPLC780D_4BIT_INST_CRSR_INC          0x06 /* Set cursor moving direction
49                                                      as increment */
50
51 #define SPLC780D_4BIT_LINET_ADDR             0x80 /* clear (blank) display) */
52 #define SPLC780D_4BIT_LINEB_ADDR             0xC0 /* clear (blank) display) */
53
54 #ifndef __ASSEMBLER__
55
56 /* C interface to controller registers. */
57 struct splc780d_4bit_s {
58     splc780d_4bit_reg_t  inst;       /* instruction register */
59     splc780d_4bit_reg_t  data;       /* data register */
60 };
61
62 typedef volatile struct splc780d_4bit_s splc780d_4bit_t;
63
64 /*
65 Prototypes of high level driver functions.
66 */
67
68 /* Write an instruction byte to LCD, result in two back to back writes since the
69  * LCD is hooked up in 4 bit mode*/
70 extern void lcd_write_inst_byte(splc780d_4bit_t *lcd, unsigned char inst);
71
72 /* Write a data byte to LCD, result in two back to back writes since the
73  * LCD is hooked up in 4 bit mode*/
74 extern void lcd_write_data_byte(splc780d_4bit_t *lcd, unsigned char data);
75
76 /*
77 Initialize the display with default settings. 
78 */
79 extern void splc780d_4bit_init_default(splc780d_4bit_t *lcd);
80
81 /*
82 Write a single character at a given position (chars from left, starting at 0).
83 Wait long enough afterward for the controller to be ready for more input.
84 Positions beyond the end of the display are ignored.
85 */
86 extern void splc780d_4bit_write_char(splc780d_4bit_t *lcd, unsigned pos, const char c);
87
88 /*
89 Write a string to the display starting at the left (position 0). 
90 Blank-pad to or truncate at the end of the display (overwrites any previous 
91 string so don't need to blank the display first).
92 Wait long enough after each char for the controller to be ready for more input.
93 */
94 extern void splc780d_4bit_write_string(splc780d_4bit_t *lcd, const char *s);
95
96 /*
97 Blank (clear) the entire display.
98 Wait long enough afterward for the controller to be ready for more input.
99 */
100 extern void splc780d_4bit_blank(splc780d_4bit_t *lcd);
101
102 #endif /* __ASSEMBLER__ */
103
104 #endif /* _LCD_SPLC780D_4BIT_H_ */
105