Select one of the symbols to view example projects that use it.
 
Outline
#include "GUI.h"
#include "GUIDRV_FlexColor.h"
#include "main.h"
#include "ili9325/ili9325.h"
#define XSIZE_PHYS
#define YSIZE_PHYS
#define VXSIZE_PHYS
#define VYSIZE_PHYS
LCD_CONTROLLER_TypeDef
#define FMC_BANK3_BASE
#define FMC_BANK3
LcdWriteReg(unsigned short)
LcdWriteData(unsigned short)
LcdWriteDataMultiple(unsigned short *, int)
LcdReadDataMultiple(unsigned short *, int)
LCD_LL_Init()
LCD_X_Config()
LCD_X_DisplayDriver(unsigned int, unsigned int, void *)
STM_FSMC_BANK3_WriteData(uint16_t)
STM_FSMC_BANK3_WriteReg(uint8_t)
STM_FSMC_BANK3_ReadData()
Files
loading...
CodeScopeSTM32 Libraries and SamplesSTemWinConfig/LCDConf.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file lcdconf.c * @author MCD Application Team * @brief This file implements the configuration for the GUI library ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ #include "GUI.h" #include "GUIDRV_FlexColor.h" #include "main.h" #include "ili9325/ili9325.h" /** @addtogroup LCD CONFIGURATION * @{ *//* ... */ /** @defgroup LCD CONFIGURATION * @brief This file contains the LCD Configuration * @{ *//* ... */ /** @defgroup LCD CONFIGURATION_Private_TypesDefinitions * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup LCD CONFIGURATION_Private_Defines * @{ *//* ... */ // // Physical display size // #define XSIZE_PHYS 240 #define YSIZE_PHYS 320 /********************************************************************* * * Configuration checking * ********************************************************************** *//* ... */ #ifndef VXSIZE_PHYS #define VXSIZE_PHYS XSIZE_PHYS #endif #ifndef VYSIZE_PHYS #define VYSIZE_PHYS YSIZE_PHYS #endif #ifndef XSIZE_PHYS #error Physical X size of display is not defined! #endif #ifndef YSIZE_PHYS #error Physical Y size of display is not defined! #endif #ifndef GUICC_565 #error Color conversion not defined! #endif #ifndef GUIDRV_FLEXCOLOR #error No display driver defined! #endif /********************************************************************* * * Defines, sfrs * ********************************************************************** *//* ... */ // // COG interface register addr. // typedef struct { __IO uint16_t REG; __IO uint16_t RAM; ...}LCD_CONTROLLER_TypeDef; #define FMC_BANK3_BASE ((uint32_t)(0x60000000 | 0x08000000)) #define FMC_BANK3 ((LCD_CONTROLLER_TypeDef *) FMC_BANK3_BASE) /********************************************************************* * * Local functions * ********************************************************************** *//* ... */ static void STM_FSMC_BANK3_WriteData(uint16_t Data); static void STM_FSMC_BANK3_WriteReg(uint8_t Reg); static uint16_t STM_FSMC_BANK3_ReadData(void); /******************************************************************** * * LcdWriteReg * * Function description: * Sets display register *//* ... */ static void LcdWriteReg(U16 Data) { STM_FSMC_BANK3_WriteReg(Data); }{ ... } /******************************************************************** * * LcdWriteData * * Function description: * Writes a value to a display register *//* ... */ static void LcdWriteData(U16 Data) { STM_FSMC_BANK3_WriteData (Data); }{ ... } /******************************************************************** * * LcdWriteDataMultiple * * Function description: * Writes multiple values to a display register. *//* ... */ static void LcdWriteDataMultiple(U16 * pData, int NumItems) { while (NumItems--) { STM_FSMC_BANK3_WriteData(*pData++); }while (NumItems--) { ... } }{ ... } /******************************************************************** * * LcdReadDataMultiple * * Function description: * Reads multiple values from a display register. *//* ... */ static void LcdReadDataMultiple(U16 * pData, int NumItems) { while (NumItems--) { *pData++ = STM_FSMC_BANK3_ReadData(); }while (NumItems--) { ... } }{ ... } /********************************************************************* * * Public functions * ********************************************************************** *//* ... */ /** * @brief Initializes the LCD. * @param None * @retval LCD state *//* ... */ void LCD_LL_Init(void) { /* LCD Init */ ili9325_Init(); }{ ... } /********************************************************************* * * LCD_X_Config * * Function description: * Called during the initialization process in order to set up the * display driver configuration. * *//* ... */ void LCD_X_Config(void) { GUI_DEVICE * pDevice; CONFIG_FLEXCOLOR Config = {0}; GUI_PORT_API PortAPI = {0}; // // Set display driver and color conversion // pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_565, 0, 0); // // Display driver configuration, required for Lin-driver // LCD_SetSizeEx (0, XSIZE_PHYS , YSIZE_PHYS); LCD_SetVSizeEx(0, VXSIZE_PHYS, VYSIZE_PHYS); // // Orientation // Config.Orientation = GUI_SWAP_XY | GUI_MIRROR_Y; GUIDRV_FlexColor_Config(pDevice, &Config); // // Set controller and operation mode // PortAPI.pfWrite16_A0 = LcdWriteReg; PortAPI.pfWrite16_A1 = LcdWriteData; PortAPI.pfWriteM16_A1 = LcdWriteDataMultiple; PortAPI.pfReadM16_A1 = LcdReadDataMultiple; GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66708, GUIDRV_FLEXCOLOR_M16C0B16); }{ ... } /********************************************************************* * * LCD_X_DisplayDriver * * Function description: * This function is called by the display driver for several purposes. * To support the according task the routine needs to be adapted to * the display controller. Please note that the commands marked with * 'optional' are not cogently required and should only be adapted if * the display controller supports these features. * * Parameter: * LayerIndex - Index of layer to be configured * Cmd - Please refer to the details in the switch statement below * pData - Pointer to a LCD_X_DATA structure * * Return Value: * < -1 - Error * -1 - Command not handled * 0 - Ok *//* ... */ int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData) { int r; (void) LayerIndex; (void) pData; switch (Cmd) { case LCD_X_INITCONTROLLER: { LCD_LL_Init(); return 0; ...}case LCD_X_INITCONTROLLER: default: r = -1;default }switch (Cmd) { ... } return r; }{ ... } /** * @brief Writes register value. * @param Data: * @retval None *//* ... */ static void STM_FSMC_BANK3_WriteData(uint16_t Data) { /* Write 16-bit Reg */ FMC_BANK3->RAM = Data; }{ ... } /** * @brief Writes register address. * @param Reg: * @retval None *//* ... */ static void STM_FSMC_BANK3_WriteReg(uint8_t Reg) { /* Write 16-bit Index, then write register */ FMC_BANK3->REG = Reg; }{ ... } /** * @brief Reads register value. * @param None * @retval Read value *//* ... */ static uint16_t STM_FSMC_BANK3_ReadData(void) { return FMC_BANK3->RAM; }{ ... }