STM32F429ZI Discovery board drivers
Dependents: 2a 2b 2c 2d1 ... more
Drivers/BSP/Components/ili9341/ili9341.c@2:53d9067a4feb, 2018-02-28 (annotated)
- Committer:
- Jerome Coutant
- Date:
- Wed Feb 28 13:17:14 2018 +0100
- Revision:
- 2:53d9067a4feb
- Parent:
- 1:2371382139dd
STM32Cube_FW_F4_V1.19.0 BSP_DISCO_F429ZI
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jerome Coutant
1:2371382139dd
|
1
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
2
|
******************************************************************************
|
|
Jerome Coutant
1:2371382139dd
|
3
|
* @file ili9341.c
|
|
Jerome Coutant
1:2371382139dd
|
4
|
* @author MCD Application Team
|
|
Jerome Coutant
1:2371382139dd
|
5
|
* @version V1.0.2
|
|
Jerome Coutant
1:2371382139dd
|
6
|
* @date 02-December-2014
|
|
Jerome Coutant
1:2371382139dd
|
7
|
* @brief This file includes the LCD driver for ILI9341 LCD.
|
|
Jerome Coutant
1:2371382139dd
|
8
|
******************************************************************************
|
|
Jerome Coutant
1:2371382139dd
|
9
|
* @attention
|
|
Jerome Coutant
1:2371382139dd
|
10
|
*
|
|
Jerome Coutant
1:2371382139dd
|
11
|
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
|
|
Jerome Coutant
1:2371382139dd
|
12
|
*
|
|
Jerome Coutant
1:2371382139dd
|
13
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
Jerome Coutant
1:2371382139dd
|
14
|
* are permitted provided that the following conditions are met:
|
|
Jerome Coutant
1:2371382139dd
|
15
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
Jerome Coutant
1:2371382139dd
|
16
|
* this list of conditions and the following disclaimer.
|
|
Jerome Coutant
1:2371382139dd
|
17
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
Jerome Coutant
1:2371382139dd
|
18
|
* this list of conditions and the following disclaimer in the documentation
|
|
Jerome Coutant
1:2371382139dd
|
19
|
* and/or other materials provided with the distribution.
|
|
Jerome Coutant
1:2371382139dd
|
20
|
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
Jerome Coutant
1:2371382139dd
|
21
|
* may be used to endorse or promote products derived from this software
|
|
Jerome Coutant
1:2371382139dd
|
22
|
* without specific prior written permission.
|
|
Jerome Coutant
1:2371382139dd
|
23
|
*
|
|
Jerome Coutant
1:2371382139dd
|
24
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Jerome Coutant
1:2371382139dd
|
25
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Jerome Coutant
1:2371382139dd
|
26
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Jerome Coutant
1:2371382139dd
|
27
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
Jerome Coutant
1:2371382139dd
|
28
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Jerome Coutant
1:2371382139dd
|
29
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Jerome Coutant
1:2371382139dd
|
30
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Jerome Coutant
1:2371382139dd
|
31
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Jerome Coutant
1:2371382139dd
|
32
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Jerome Coutant
1:2371382139dd
|
33
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Jerome Coutant
1:2371382139dd
|
34
|
*
|
|
Jerome Coutant
1:2371382139dd
|
35
|
******************************************************************************
|
|
Jerome Coutant
1:2371382139dd
|
36
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
37
|
|
|
Jerome Coutant
1:2371382139dd
|
38
|
/* Includes ------------------------------------------------------------------*/
|
|
Jerome Coutant
1:2371382139dd
|
39
|
#include "ili9341.h"
|
|
Jerome Coutant
1:2371382139dd
|
40
|
|
|
Jerome Coutant
1:2371382139dd
|
41
|
/** @addtogroup BSP
|
|
Jerome Coutant
1:2371382139dd
|
42
|
* @{
|
|
Jerome Coutant
1:2371382139dd
|
43
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
44
|
|
|
Jerome Coutant
1:2371382139dd
|
45
|
/** @addtogroup Components
|
|
Jerome Coutant
1:2371382139dd
|
46
|
* @{
|
|
Jerome Coutant
1:2371382139dd
|
47
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
48
|
|
|
Jerome Coutant
1:2371382139dd
|
49
|
/** @addtogroup ILI9341
|
|
Jerome Coutant
1:2371382139dd
|
50
|
* @brief This file provides a set of functions needed to drive the
|
|
Jerome Coutant
1:2371382139dd
|
51
|
* ILI9341 LCD.
|
|
Jerome Coutant
1:2371382139dd
|
52
|
* @{
|
|
Jerome Coutant
1:2371382139dd
|
53
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
54
|
|
|
Jerome Coutant
1:2371382139dd
|
55
|
/** @defgroup ILI9341_Private_TypesDefinitions
|
|
Jerome Coutant
1:2371382139dd
|
56
|
* @{
|
|
Jerome Coutant
1:2371382139dd
|
57
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
58
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
59
|
* @}
|
|
Jerome Coutant
1:2371382139dd
|
60
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
61
|
|
|
Jerome Coutant
1:2371382139dd
|
62
|
/** @defgroup ILI9341_Private_Defines
|
|
Jerome Coutant
1:2371382139dd
|
63
|
* @{
|
|
Jerome Coutant
1:2371382139dd
|
64
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
65
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
66
|
* @}
|
|
Jerome Coutant
1:2371382139dd
|
67
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
68
|
|
|
Jerome Coutant
1:2371382139dd
|
69
|
/** @defgroup ILI9341_Private_Macros
|
|
Jerome Coutant
1:2371382139dd
|
70
|
* @{
|
|
Jerome Coutant
1:2371382139dd
|
71
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
72
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
73
|
* @}
|
|
Jerome Coutant
1:2371382139dd
|
74
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
75
|
|
|
Jerome Coutant
1:2371382139dd
|
76
|
/** @defgroup ILI9341_Private_Variables
|
|
Jerome Coutant
1:2371382139dd
|
77
|
* @{
|
|
Jerome Coutant
1:2371382139dd
|
78
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
79
|
|
|
Jerome Coutant
1:2371382139dd
|
80
|
LCD_DrvTypeDef ili9341_drv =
|
|
Jerome Coutant
1:2371382139dd
|
81
|
{
|
|
Jerome Coutant
1:2371382139dd
|
82
|
ili9341_Init,
|
|
Jerome Coutant
1:2371382139dd
|
83
|
ili9341_ReadID,
|
|
Jerome Coutant
1:2371382139dd
|
84
|
ili9341_DisplayOn,
|
|
Jerome Coutant
1:2371382139dd
|
85
|
ili9341_DisplayOff,
|
|
Jerome Coutant
1:2371382139dd
|
86
|
0,
|
|
Jerome Coutant
1:2371382139dd
|
87
|
0,
|
|
Jerome Coutant
1:2371382139dd
|
88
|
0,
|
|
Jerome Coutant
1:2371382139dd
|
89
|
0,
|
|
Jerome Coutant
1:2371382139dd
|
90
|
0,
|
|
Jerome Coutant
1:2371382139dd
|
91
|
0,
|
|
Jerome Coutant
1:2371382139dd
|
92
|
ili9341_GetLcdPixelWidth,
|
|
Jerome Coutant
1:2371382139dd
|
93
|
ili9341_GetLcdPixelHeight,
|
|
Jerome Coutant
1:2371382139dd
|
94
|
0,
|
|
Jerome Coutant
1:2371382139dd
|
95
|
0,
|
|
Jerome Coutant
1:2371382139dd
|
96
|
};
|
|
Jerome Coutant
1:2371382139dd
|
97
|
|
|
Jerome Coutant
1:2371382139dd
|
98
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
99
|
* @}
|
|
Jerome Coutant
1:2371382139dd
|
100
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
101
|
|
|
Jerome Coutant
1:2371382139dd
|
102
|
/** @defgroup ILI9341_Private_FunctionPrototypes
|
|
Jerome Coutant
1:2371382139dd
|
103
|
* @{
|
|
Jerome Coutant
1:2371382139dd
|
104
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
105
|
|
|
Jerome Coutant
1:2371382139dd
|
106
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
107
|
* @}
|
|
Jerome Coutant
1:2371382139dd
|
108
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
109
|
|
|
Jerome Coutant
1:2371382139dd
|
110
|
/** @defgroup ILI9341_Private_Functions
|
|
Jerome Coutant
1:2371382139dd
|
111
|
* @{
|
|
Jerome Coutant
1:2371382139dd
|
112
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
113
|
|
|
Jerome Coutant
1:2371382139dd
|
114
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
115
|
* @brief Power on the LCD.
|
|
Jerome Coutant
1:2371382139dd
|
116
|
* @param None
|
|
Jerome Coutant
1:2371382139dd
|
117
|
* @retval None
|
|
Jerome Coutant
1:2371382139dd
|
118
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
119
|
void ili9341_Init(void)
|
|
Jerome Coutant
1:2371382139dd
|
120
|
{
|
|
Jerome Coutant
1:2371382139dd
|
121
|
/* Initialize ILI9341 low level bus layer ----------------------------------*/
|
|
Jerome Coutant
1:2371382139dd
|
122
|
LCD_IO_Init();
|
|
Jerome Coutant
1:2371382139dd
|
123
|
|
|
Jerome Coutant
1:2371382139dd
|
124
|
/* Configure LCD */
|
|
Jerome Coutant
1:2371382139dd
|
125
|
ili9341_WriteReg(0xCA);
|
|
Jerome Coutant
1:2371382139dd
|
126
|
ili9341_WriteData(0xC3);
|
|
Jerome Coutant
1:2371382139dd
|
127
|
ili9341_WriteData(0x08);
|
|
Jerome Coutant
1:2371382139dd
|
128
|
ili9341_WriteData(0x50);
|
|
Jerome Coutant
1:2371382139dd
|
129
|
ili9341_WriteReg(LCD_POWERB);
|
|
Jerome Coutant
1:2371382139dd
|
130
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
131
|
ili9341_WriteData(0xC1);
|
|
Jerome Coutant
1:2371382139dd
|
132
|
ili9341_WriteData(0x30);
|
|
Jerome Coutant
1:2371382139dd
|
133
|
ili9341_WriteReg(LCD_POWER_SEQ);
|
|
Jerome Coutant
1:2371382139dd
|
134
|
ili9341_WriteData(0x64);
|
|
Jerome Coutant
1:2371382139dd
|
135
|
ili9341_WriteData(0x03);
|
|
Jerome Coutant
1:2371382139dd
|
136
|
ili9341_WriteData(0x12);
|
|
Jerome Coutant
1:2371382139dd
|
137
|
ili9341_WriteData(0x81);
|
|
Jerome Coutant
1:2371382139dd
|
138
|
ili9341_WriteReg(LCD_DTCA);
|
|
Jerome Coutant
1:2371382139dd
|
139
|
ili9341_WriteData(0x85);
|
|
Jerome Coutant
1:2371382139dd
|
140
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
141
|
ili9341_WriteData(0x78);
|
|
Jerome Coutant
1:2371382139dd
|
142
|
ili9341_WriteReg(LCD_POWERA);
|
|
Jerome Coutant
1:2371382139dd
|
143
|
ili9341_WriteData(0x39);
|
|
Jerome Coutant
1:2371382139dd
|
144
|
ili9341_WriteData(0x2C);
|
|
Jerome Coutant
1:2371382139dd
|
145
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
146
|
ili9341_WriteData(0x34);
|
|
Jerome Coutant
1:2371382139dd
|
147
|
ili9341_WriteData(0x02);
|
|
Jerome Coutant
1:2371382139dd
|
148
|
ili9341_WriteReg(LCD_PRC);
|
|
Jerome Coutant
1:2371382139dd
|
149
|
ili9341_WriteData(0x20);
|
|
Jerome Coutant
1:2371382139dd
|
150
|
ili9341_WriteReg(LCD_DTCB);
|
|
Jerome Coutant
1:2371382139dd
|
151
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
152
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
153
|
ili9341_WriteReg(LCD_FRMCTR1);
|
|
Jerome Coutant
1:2371382139dd
|
154
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
155
|
ili9341_WriteData(0x1B);
|
|
Jerome Coutant
1:2371382139dd
|
156
|
ili9341_WriteReg(LCD_DFC);
|
|
Jerome Coutant
1:2371382139dd
|
157
|
ili9341_WriteData(0x0A);
|
|
Jerome Coutant
1:2371382139dd
|
158
|
ili9341_WriteData(0xA2);
|
|
Jerome Coutant
1:2371382139dd
|
159
|
ili9341_WriteReg(LCD_POWER1);
|
|
Jerome Coutant
1:2371382139dd
|
160
|
ili9341_WriteData(0x10);
|
|
Jerome Coutant
1:2371382139dd
|
161
|
ili9341_WriteReg(LCD_POWER2);
|
|
Jerome Coutant
1:2371382139dd
|
162
|
ili9341_WriteData(0x10);
|
|
Jerome Coutant
1:2371382139dd
|
163
|
ili9341_WriteReg(LCD_VCOM1);
|
|
Jerome Coutant
1:2371382139dd
|
164
|
ili9341_WriteData(0x45);
|
|
Jerome Coutant
1:2371382139dd
|
165
|
ili9341_WriteData(0x15);
|
|
Jerome Coutant
1:2371382139dd
|
166
|
ili9341_WriteReg(LCD_VCOM2);
|
|
Jerome Coutant
1:2371382139dd
|
167
|
ili9341_WriteData(0x90);
|
|
Jerome Coutant
1:2371382139dd
|
168
|
ili9341_WriteReg(LCD_MAC);
|
|
Jerome Coutant
1:2371382139dd
|
169
|
ili9341_WriteData(0xC8);
|
|
Jerome Coutant
1:2371382139dd
|
170
|
ili9341_WriteReg(LCD_3GAMMA_EN);
|
|
Jerome Coutant
1:2371382139dd
|
171
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
172
|
ili9341_WriteReg(LCD_RGB_INTERFACE);
|
|
Jerome Coutant
1:2371382139dd
|
173
|
ili9341_WriteData(0xC2);
|
|
Jerome Coutant
1:2371382139dd
|
174
|
ili9341_WriteReg(LCD_DFC);
|
|
Jerome Coutant
1:2371382139dd
|
175
|
ili9341_WriteData(0x0A);
|
|
Jerome Coutant
1:2371382139dd
|
176
|
ili9341_WriteData(0xA7);
|
|
Jerome Coutant
1:2371382139dd
|
177
|
ili9341_WriteData(0x27);
|
|
Jerome Coutant
1:2371382139dd
|
178
|
ili9341_WriteData(0x04);
|
|
Jerome Coutant
1:2371382139dd
|
179
|
|
|
Jerome Coutant
1:2371382139dd
|
180
|
/* Colomn address set */
|
|
Jerome Coutant
1:2371382139dd
|
181
|
ili9341_WriteReg(LCD_COLUMN_ADDR);
|
|
Jerome Coutant
1:2371382139dd
|
182
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
183
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
184
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
185
|
ili9341_WriteData(0xEF);
|
|
Jerome Coutant
1:2371382139dd
|
186
|
/* Page address set */
|
|
Jerome Coutant
1:2371382139dd
|
187
|
ili9341_WriteReg(LCD_PAGE_ADDR);
|
|
Jerome Coutant
1:2371382139dd
|
188
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
189
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
190
|
ili9341_WriteData(0x01);
|
|
Jerome Coutant
1:2371382139dd
|
191
|
ili9341_WriteData(0x3F);
|
|
Jerome Coutant
1:2371382139dd
|
192
|
ili9341_WriteReg(LCD_INTERFACE);
|
|
Jerome Coutant
1:2371382139dd
|
193
|
ili9341_WriteData(0x01);
|
|
Jerome Coutant
1:2371382139dd
|
194
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
195
|
ili9341_WriteData(0x06);
|
|
Jerome Coutant
1:2371382139dd
|
196
|
|
|
Jerome Coutant
1:2371382139dd
|
197
|
ili9341_WriteReg(LCD_GRAM);
|
|
Jerome Coutant
1:2371382139dd
|
198
|
LCD_Delay(200);
|
|
Jerome Coutant
1:2371382139dd
|
199
|
|
|
Jerome Coutant
1:2371382139dd
|
200
|
ili9341_WriteReg(LCD_GAMMA);
|
|
Jerome Coutant
1:2371382139dd
|
201
|
ili9341_WriteData(0x01);
|
|
Jerome Coutant
1:2371382139dd
|
202
|
|
|
Jerome Coutant
1:2371382139dd
|
203
|
ili9341_WriteReg(LCD_PGAMMA);
|
|
Jerome Coutant
1:2371382139dd
|
204
|
ili9341_WriteData(0x0F);
|
|
Jerome Coutant
1:2371382139dd
|
205
|
ili9341_WriteData(0x29);
|
|
Jerome Coutant
1:2371382139dd
|
206
|
ili9341_WriteData(0x24);
|
|
Jerome Coutant
1:2371382139dd
|
207
|
ili9341_WriteData(0x0C);
|
|
Jerome Coutant
1:2371382139dd
|
208
|
ili9341_WriteData(0x0E);
|
|
Jerome Coutant
1:2371382139dd
|
209
|
ili9341_WriteData(0x09);
|
|
Jerome Coutant
1:2371382139dd
|
210
|
ili9341_WriteData(0x4E);
|
|
Jerome Coutant
1:2371382139dd
|
211
|
ili9341_WriteData(0x78);
|
|
Jerome Coutant
1:2371382139dd
|
212
|
ili9341_WriteData(0x3C);
|
|
Jerome Coutant
1:2371382139dd
|
213
|
ili9341_WriteData(0x09);
|
|
Jerome Coutant
1:2371382139dd
|
214
|
ili9341_WriteData(0x13);
|
|
Jerome Coutant
1:2371382139dd
|
215
|
ili9341_WriteData(0x05);
|
|
Jerome Coutant
1:2371382139dd
|
216
|
ili9341_WriteData(0x17);
|
|
Jerome Coutant
1:2371382139dd
|
217
|
ili9341_WriteData(0x11);
|
|
Jerome Coutant
1:2371382139dd
|
218
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
219
|
ili9341_WriteReg(LCD_NGAMMA);
|
|
Jerome Coutant
1:2371382139dd
|
220
|
ili9341_WriteData(0x00);
|
|
Jerome Coutant
1:2371382139dd
|
221
|
ili9341_WriteData(0x16);
|
|
Jerome Coutant
1:2371382139dd
|
222
|
ili9341_WriteData(0x1B);
|
|
Jerome Coutant
1:2371382139dd
|
223
|
ili9341_WriteData(0x04);
|
|
Jerome Coutant
1:2371382139dd
|
224
|
ili9341_WriteData(0x11);
|
|
Jerome Coutant
1:2371382139dd
|
225
|
ili9341_WriteData(0x07);
|
|
Jerome Coutant
1:2371382139dd
|
226
|
ili9341_WriteData(0x31);
|
|
Jerome Coutant
1:2371382139dd
|
227
|
ili9341_WriteData(0x33);
|
|
Jerome Coutant
1:2371382139dd
|
228
|
ili9341_WriteData(0x42);
|
|
Jerome Coutant
1:2371382139dd
|
229
|
ili9341_WriteData(0x05);
|
|
Jerome Coutant
1:2371382139dd
|
230
|
ili9341_WriteData(0x0C);
|
|
Jerome Coutant
1:2371382139dd
|
231
|
ili9341_WriteData(0x0A);
|
|
Jerome Coutant
1:2371382139dd
|
232
|
ili9341_WriteData(0x28);
|
|
Jerome Coutant
1:2371382139dd
|
233
|
ili9341_WriteData(0x2F);
|
|
Jerome Coutant
1:2371382139dd
|
234
|
ili9341_WriteData(0x0F);
|
|
Jerome Coutant
1:2371382139dd
|
235
|
|
|
Jerome Coutant
1:2371382139dd
|
236
|
ili9341_WriteReg(LCD_SLEEP_OUT);
|
|
Jerome Coutant
1:2371382139dd
|
237
|
LCD_Delay(200);
|
|
Jerome Coutant
1:2371382139dd
|
238
|
ili9341_WriteReg(LCD_DISPLAY_ON);
|
|
Jerome Coutant
1:2371382139dd
|
239
|
/* GRAM start writing */
|
|
Jerome Coutant
1:2371382139dd
|
240
|
ili9341_WriteReg(LCD_GRAM);
|
|
Jerome Coutant
1:2371382139dd
|
241
|
}
|
|
Jerome Coutant
1:2371382139dd
|
242
|
|
|
Jerome Coutant
1:2371382139dd
|
243
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
244
|
* @brief Disables the Display.
|
|
Jerome Coutant
1:2371382139dd
|
245
|
* @param None
|
|
Jerome Coutant
1:2371382139dd
|
246
|
* @retval LCD Register Value.
|
|
Jerome Coutant
1:2371382139dd
|
247
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
248
|
uint16_t ili9341_ReadID(void)
|
|
Jerome Coutant
1:2371382139dd
|
249
|
{
|
|
Jerome Coutant
1:2371382139dd
|
250
|
LCD_IO_Init();
|
|
Jerome Coutant
1:2371382139dd
|
251
|
return ((uint16_t)ili9341_ReadData(LCD_READ_ID4, LCD_READ_ID4_SIZE));
|
|
Jerome Coutant
1:2371382139dd
|
252
|
}
|
|
Jerome Coutant
1:2371382139dd
|
253
|
|
|
Jerome Coutant
1:2371382139dd
|
254
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
255
|
* @brief Enables the Display.
|
|
Jerome Coutant
1:2371382139dd
|
256
|
* @param None
|
|
Jerome Coutant
1:2371382139dd
|
257
|
* @retval None
|
|
Jerome Coutant
1:2371382139dd
|
258
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
259
|
void ili9341_DisplayOn(void)
|
|
Jerome Coutant
1:2371382139dd
|
260
|
{
|
|
Jerome Coutant
1:2371382139dd
|
261
|
/* Display On */
|
|
Jerome Coutant
1:2371382139dd
|
262
|
ili9341_WriteReg(LCD_DISPLAY_ON);
|
|
Jerome Coutant
1:2371382139dd
|
263
|
}
|
|
Jerome Coutant
1:2371382139dd
|
264
|
|
|
Jerome Coutant
1:2371382139dd
|
265
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
266
|
* @brief Disables the Display.
|
|
Jerome Coutant
1:2371382139dd
|
267
|
* @param None
|
|
Jerome Coutant
1:2371382139dd
|
268
|
* @retval None
|
|
Jerome Coutant
1:2371382139dd
|
269
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
270
|
void ili9341_DisplayOff(void)
|
|
Jerome Coutant
1:2371382139dd
|
271
|
{
|
|
Jerome Coutant
1:2371382139dd
|
272
|
/* Display Off */
|
|
Jerome Coutant
1:2371382139dd
|
273
|
ili9341_WriteReg(LCD_DISPLAY_OFF);
|
|
Jerome Coutant
1:2371382139dd
|
274
|
}
|
|
Jerome Coutant
1:2371382139dd
|
275
|
|
|
Jerome Coutant
1:2371382139dd
|
276
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
277
|
* @brief Writes to the selected LCD register.
|
|
Jerome Coutant
1:2371382139dd
|
278
|
* @param LCD_Reg: address of the selected register.
|
|
Jerome Coutant
1:2371382139dd
|
279
|
* @retval None
|
|
Jerome Coutant
1:2371382139dd
|
280
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
281
|
void ili9341_WriteReg(uint8_t LCD_Reg)
|
|
Jerome Coutant
1:2371382139dd
|
282
|
{
|
|
Jerome Coutant
1:2371382139dd
|
283
|
LCD_IO_WriteReg(LCD_Reg);
|
|
Jerome Coutant
1:2371382139dd
|
284
|
}
|
|
Jerome Coutant
1:2371382139dd
|
285
|
|
|
Jerome Coutant
1:2371382139dd
|
286
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
287
|
* @brief Writes data to the selected LCD register.
|
|
Jerome Coutant
1:2371382139dd
|
288
|
* @param LCD_Reg: address of the selected register.
|
|
Jerome Coutant
1:2371382139dd
|
289
|
* @retval None
|
|
Jerome Coutant
1:2371382139dd
|
290
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
291
|
void ili9341_WriteData(uint16_t RegValue)
|
|
Jerome Coutant
1:2371382139dd
|
292
|
{
|
|
Jerome Coutant
1:2371382139dd
|
293
|
LCD_IO_WriteData(RegValue);
|
|
Jerome Coutant
1:2371382139dd
|
294
|
}
|
|
Jerome Coutant
1:2371382139dd
|
295
|
|
|
Jerome Coutant
1:2371382139dd
|
296
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
297
|
* @brief Reads the selected LCD Register.
|
|
Jerome Coutant
1:2371382139dd
|
298
|
* @param RegValue: Address of the register to read
|
|
Jerome Coutant
1:2371382139dd
|
299
|
* @param ReadSize: Number of bytes to read
|
|
Jerome Coutant
1:2371382139dd
|
300
|
* @retval LCD Register Value.
|
|
Jerome Coutant
1:2371382139dd
|
301
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
302
|
uint32_t ili9341_ReadData(uint16_t RegValue, uint8_t ReadSize)
|
|
Jerome Coutant
1:2371382139dd
|
303
|
{
|
|
Jerome Coutant
1:2371382139dd
|
304
|
/* Read a max of 4 bytes */
|
|
Jerome Coutant
1:2371382139dd
|
305
|
return (LCD_IO_ReadData(RegValue, ReadSize));
|
|
Jerome Coutant
1:2371382139dd
|
306
|
}
|
|
Jerome Coutant
1:2371382139dd
|
307
|
|
|
Jerome Coutant
1:2371382139dd
|
308
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
309
|
* @brief Get LCD PIXEL WIDTH.
|
|
Jerome Coutant
1:2371382139dd
|
310
|
* @param None
|
|
Jerome Coutant
1:2371382139dd
|
311
|
* @retval LCD PIXEL WIDTH.
|
|
Jerome Coutant
1:2371382139dd
|
312
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
313
|
uint16_t ili9341_GetLcdPixelWidth(void)
|
|
Jerome Coutant
1:2371382139dd
|
314
|
{
|
|
Jerome Coutant
1:2371382139dd
|
315
|
/* Return LCD PIXEL WIDTH */
|
|
Jerome Coutant
1:2371382139dd
|
316
|
return ILI9341_LCD_PIXEL_WIDTH;
|
|
Jerome Coutant
1:2371382139dd
|
317
|
}
|
|
Jerome Coutant
1:2371382139dd
|
318
|
|
|
Jerome Coutant
1:2371382139dd
|
319
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
320
|
* @brief Get LCD PIXEL HEIGHT.
|
|
Jerome Coutant
1:2371382139dd
|
321
|
* @param None
|
|
Jerome Coutant
1:2371382139dd
|
322
|
* @retval LCD PIXEL HEIGHT.
|
|
Jerome Coutant
1:2371382139dd
|
323
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
324
|
uint16_t ili9341_GetLcdPixelHeight(void)
|
|
Jerome Coutant
1:2371382139dd
|
325
|
{
|
|
Jerome Coutant
1:2371382139dd
|
326
|
/* Return LCD PIXEL HEIGHT */
|
|
Jerome Coutant
1:2371382139dd
|
327
|
return ILI9341_LCD_PIXEL_HEIGHT;
|
|
Jerome Coutant
1:2371382139dd
|
328
|
}
|
|
Jerome Coutant
1:2371382139dd
|
329
|
|
|
Jerome Coutant
1:2371382139dd
|
330
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
331
|
* @}
|
|
Jerome Coutant
1:2371382139dd
|
332
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
333
|
|
|
Jerome Coutant
1:2371382139dd
|
334
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
335
|
* @}
|
|
Jerome Coutant
1:2371382139dd
|
336
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
337
|
|
|
Jerome Coutant
1:2371382139dd
|
338
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
339
|
* @}
|
|
Jerome Coutant
1:2371382139dd
|
340
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
341
|
|
|
Jerome Coutant
1:2371382139dd
|
342
|
/**
|
|
Jerome Coutant
1:2371382139dd
|
343
|
* @}
|
|
Jerome Coutant
1:2371382139dd
|
344
|
*/
|
|
Jerome Coutant
1:2371382139dd
|
345
|
|
|
Jerome Coutant
1:2371382139dd
|
346
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|