v1.0.0 reorg
[hackover2013-badge-firmware.git] / drivers / displays / tft / hw / hx8340b.h
1 /**************************************************************************/
2 /*!
3 @file hx8340b.h
4 @author K. Townsend (microBuilder.eu)
5
6 @section LICENSE
7
8 Software License Agreement (BSD License)
9
10 Copyright (c) 2012, microBuilder SARL
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 1. Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 2. Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 3. Neither the name of the copyright holders nor the
21 names of its contributors may be used to endorse or promote products
22 derived from this software without specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35 /**************************************************************************/
36 #ifndef __HX8340B_H__
37 #define __HX8340B_H__
38
39 #include "projectconfig.h"
40 #include "drivers/displays/tft/lcd.h"
41
42 #define HX8340B_ICVERSION_N
43 // #define HX8340B_ICVERSION_T
44
45 #if defined HX8340B_ICVERSION_N && defined HX8340B_ICVERSION_T
46 #error "Only one IC version can be set for HX8340B (HX8340B_ICVERSION_N or HX8340B_ICVERSION_T)"
47 #endif
48 #if !defined HX8340B_ICVERSION_N && !defined HX8340B_ICVERSION_T
49 #error "HX8340B_ICVERSION_N or HX8340B_ICVERSION_T must be defined for HW8340 LCDs"
50 #endif
51
52 /**************************************************************************
53 BTL221722-276L CONNECTOR (HX8340B_ICVERSION_N)
54 -----------------------------------------------------------------------
55 Pin Function Notes
56 === ============== ===============================
57 1 VSS
58 2 NC
59 3 LED A/+ Vf 3.3V
60 4 VDD 2.8-3.3V
61 5 CS
62 6 SDI Serial Data
63 7 SCL Serial Clock
64 8 RS Not used
65 9 RESET
66 10 VDD 2.8-3.3V
67 11 LED K1
68 12 LED K2
69 13 LED K3
70 14 VSS
71
72 **************************************************************************/
73
74 // Control pins
75 #define HX8340B_GPIODATAREG (*(pREG32 (0x50023FFC))) // GPIO2DATA
76 #define HX8340B_PORT (2)
77 #define HX8340B_SDI_PIN (2)
78 #define HX8340B_SCL_PIN (3)
79 #define HX8340B_CS_PIN (4)
80 #define HX8340B_RES_PIN (5)
81 #define HX8340B_BL_PIN (6)
82
83 // Macros for control line state
84 #define CLR_SDI do { HX8340B_GPIODATAREG &= ~(1<<HX8340B_SDI_PIN); } while(0)
85 #define SET_SDI do { HX8340B_GPIODATAREG &= ~(1<<HX8340B_SDI_PIN); HX8340B_GPIODATAREG |= (1<<HX8340B_SDI_PIN); } while(0)
86 #define CLR_SCL do { HX8340B_GPIODATAREG &= ~(1<<HX8340B_SCL_PIN); } while(0)
87 #define SET_SCL do { HX8340B_GPIODATAREG &= ~(1<<HX8340B_SCL_PIN); HX8340B_GPIODATAREG |= (1<<HX8340B_SCL_PIN); } while(0)
88 #define CLR_CS do { HX8340B_GPIODATAREG &= ~(1<<HX8340B_CS_PIN); } while(0)
89 #define SET_CS do { HX8340B_GPIODATAREG &= ~(1<<HX8340B_CS_PIN); HX8340B_GPIODATAREG |= (1<<HX8340B_CS_PIN); } while(0)
90 #define CLR_RES do { HX8340B_GPIODATAREG &= ~(1<<HX8340B_RES_PIN); } while(0)
91 #define SET_RES do { HX8340B_GPIODATAREG &= ~(1<<HX8340B_RES_PIN); HX8340B_GPIODATAREG |= (1<<HX8340B_RES_PIN); } while(0)
92 #define CLR_BL do { HX8340B_GPIODATAREG &= ~(1<<HX8340B_BL_PIN); } while(0)
93 #define SET_BL do { HX8340B_GPIODATAREG &= ~(1<<HX8340B_BL_PIN); HX8340B_GPIODATAREG |= (1<<HX8340B_BL_PIN); } while(0)
94
95 // HX8340-B(N) Commands (used by BTL221722-276L)
96 #define HX8340B_N_NOP (0x00)
97 #define HX8340B_N_SWRESET (0x01)
98 #define HX8340B_N_RDDIDIF (0x04)
99 #define HX8340B_N_RDDST (0x09)
100 #define HX8340B_N_RDDPM (0x0A)
101 #define HX8340B_N_RDDMADCTL (0x0B)
102 #define HX8340B_N_RDDCOLMOD (0x0C)
103 #define HX8340B_N_RDDIM (0x0D)
104 #define HX8340B_N_RDDSM (0x0E)
105 #define HX8340B_N_RDDSDR (0x0F)
106 #define HX8340B_N_SLPIN (0x10)
107 #define HX8340B_N_SPLOUT (0x11)
108 #define HX8340B_N_PTLON (0x12)
109 #define HX8340B_N_NORON (0x13)
110 #define HX8340B_N_INVOFF (0x20)
111 #define HX8340B_N_INVON (0x21)
112 #define HX8340B_N_GAMSET (0x26)
113 #define HX8340B_N_DISPOFF (0x28)
114 #define HX8340B_N_DISPON (0x29)
115 #define HX8340B_N_CASET (0x2A)
116 #define HX8340B_N_PASET (0x2B)
117 #define HX8340B_N_RAMWR (0x2C)
118 #define HX8340B_N_RAMRD (0x2E)
119 #define HX8340B_N_RGBSET (0x2D)
120 #define HX8340B_N_PLTAR (0x30)
121 #define HX8340B_N_VSCRDEF (0x33)
122 #define HX8340B_N_TEOFF (0x34)
123 #define HX8340B_N_TEON (0x35)
124 #define HX8340B_N_MADCTL (0x36)
125 #define HX8340B_N_VSCRSADD (0x37)
126 #define HX8340B_N_IDMOFF (0x38)
127 #define HX8340B_N_IDMON (0x39)
128 #define HX8340B_N_COLMOD (0x3A)
129 #define HX8340B_N_RDID1 (0xDA)
130 #define HX8340B_N_RDID2 (0xDB)
131 #define HX8340B_N_RDID3 (0xDC)
132 #define HX8340B_N_SETOSC (0xB0)
133 #define HX8340B_N_SETPWCTR1 (0xB1)
134 #define HX8340B_N_SETPWCTR2 (0xB2)
135 #define HX8340B_N_SETPWCTR3 (0xB3)
136 #define HX8340B_N_SETPWCTR4 (0xB4)
137 #define HX8340B_N_SETPWCTR5 (0xB5)
138 #define HX8340B_N_SETDISCTRL (0xB6)
139 #define HX8340B_N_SETFRMCTRL (0xB7)
140 #define HX8340B_N_SETDISCYCCTRL (0xB8)
141 #define HX8340B_N_SETINVCTRL (0xB9)
142 #define HX8340B_N_RGBBPCTR (0xBA)
143 #define HX8340B_N_SETRGBIF (0xBB)
144 #define HX8340B_N_SETDODC (0xBC)
145 #define HX8340B_N_SETINTMODE (0xBD)
146 #define HX8340B_N_SETPANEL (0xBE)
147 #define HX8340B_N_SETOTP (0xC7)
148 #define HX8340B_N_SETONOFF (0xC0)
149 #define HX8340B_N_SETEXTCMD (0xC1)
150 #define HX8340B_N_SETGAMMAP (0xC2)
151 #define HX8340B_N_SETGAMMAN (0xC3)
152
153 // HX8340-B(T) Commands
154 #define HX8340B_T_DISPLAYMODECONTROL (0x01)
155 #define HX8340B_T_COLADDR_START2 (0x02)
156 #define HX8340B_T_COLADDR_START1 (0x03)
157 #define HX8340B_T_COLADDR_END2 (0x04)
158 #define HX8340B_T_COLADDR_END1 (0x05)
159 #define HX8340B_T_ROWADDR_START2 (0x06)
160 #define HX8340B_T_ROWADDR_START1 (0x07)
161 #define HX8340B_T_ROWADDR_END2 (0x08)
162 #define HX8340B_T_ROWADDR_END1 (0x09)
163 #define HX8340B_T_MEMACCESSCONTROL (0x16)
164 #define HX8340B_T_COLMOD (0x17)
165 #define HX8340B_T_OSCCONTROLA (0x18)
166 #define HX8340B_T_POWERCONTROL1 (0x19)
167 #define HX8340B_T_POWERCONTROL3 (0x1A)
168 #define HX8340B_T_POWERCONTROL4 (0x1B)
169 #define HX8340B_T_POWERCONTROL5 (0x1C)
170 #define HX8340B_T_POWERCONTROL6 (0x1D)
171 #define HX8340B_T_POWERCONTROL7 (0x1E)
172 #define HX8340B_T_POWERCONTROL8 (0x1F)
173 #define HX8340B_T_POWERCONTROL9 (0x20)
174 #define HX8340B_T_OSCCONTROLB (0x21)
175 #define HX8340B_T_SRAMWRITECONTROL (0x22)
176 #define HX8340B_T_VCOMCONTROL1 (0x23)
177 #define HX8340B_T_VCOMCONTROL2 (0x24)
178 #define HX8340B_T_VCOMCONTROL3 (0x25)
179 #define HX8340B_T_DISPLAYCONTROL1 (0x26)
180 #define HX8340B_T_DISPLAYCONTROL2 (0x27)
181 #define HX8340B_T_FRAMERATECONTROL1 (0x28)
182 #define HX8340B_T_FRAMERATECONTROL2 (0x29)
183 #define HX8340B_T_FRAMERATECONTROL3 (0x2A)
184 #define HX8340B_T_FRAMERATECONTROL4 (0x2B)
185 #define HX8340B_T_DISPLAYINVERSION (0x2F)
186 #define HX8340B_T_RGBINTERFACECONTROL1 (0x31)
187 #define HX8340B_T_RGBINTERFACECONTROL2 (0x32)
188 #define HX8340B_T_RGBINTERFACECONTROL3 (0x33)
189 #define HX8340B_T_RGBINTERFACECONTROL4 (0x34)
190 #define HX8340B_T_OUTPUTSDIRECTION (0x35)
191 #define HX8340B_T_INTERFACEMODE (0x36)
192 #define HX8340B_T_NWNBPANELSET (0x37)
193 #define HX8340B_T_OTPCONTROL1 (0x38)
194 #define HX8340B_T_OTPCONTROL2 (0x39)
195 #define HX8340B_T_OTPCONTROL3 (0x3A)
196 #define HX8340B_T_POWERCONTROL_INT1 (0x60)
197 #define HX8340B_T_POWERCONTROL_INT2 (0x61)
198 #define HX8340B_T_SOURCECONTROL_INT1 (0x62)
199 #define HX8340B_T_SOURCECONTROL_INT2 (0x63)
200 #define HX8340B_T_SOURCEOPCONTROL (0x73)
201 #define HX8340B_T_HIMAXID (0x93)
202
203 #endif
This page took 0.052821 seconds and 5 git commands to generate.