1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
27
28
32
33
36
39
40
43
44
45
46
47
48
49
50
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
81
82
83
84
85
86
91
92
93
94
95
101
102
103
104
105
112
116
117
124
128
129
136
143
144
151
158
159
165
166
171
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
251
252
253
254
259
264
265
270
275
276
281
/* ... */
#include "GUI.h"
#include "GUIDRV_FlexColor.h"
#include "main.h"
#include "ili9325/ili9325.h"
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
#define XSIZE_PHYS 240
#define YSIZE_PHYS 320
/* ... */
#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
/* ... */
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)
/* ... */
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);
/* ... */
static void LcdWriteReg(U16 Data)
{
STM_FSMC_BANK3_WriteReg(Data);
}{ ... }
/* ... */
static void LcdWriteData(U16 Data)
{
STM_FSMC_BANK3_WriteData (Data);
}{ ... }
/* ... */
static void LcdWriteDataMultiple(U16 * pData, int NumItems)
{
while (NumItems--)
{
STM_FSMC_BANK3_WriteData(*pData++);
}while (NumItems--) { ... }
}{ ... }
/* ... */
static void LcdReadDataMultiple(U16 * pData, int NumItems)
{
while (NumItems--)
{
*pData++ = STM_FSMC_BANK3_ReadData();
}while (NumItems--) { ... }
}{ ... }
/* ... */
/* ... */
void LCD_LL_Init(void)
{
ili9325_Init();
}{ ... }
/* ... */
void LCD_X_Config(void)
{
GUI_DEVICE * pDevice;
CONFIG_FLEXCOLOR Config = {0};
GUI_PORT_API PortAPI = {0};
pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_565, 0, 0);
LCD_SetSizeEx (0, XSIZE_PHYS , YSIZE_PHYS);
LCD_SetVSizeEx(0, VXSIZE_PHYS, VYSIZE_PHYS);
Config.Orientation = GUI_SWAP_XY | GUI_MIRROR_Y;
GUIDRV_FlexColor_Config(pDevice, &Config);
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);
}{ ... }
/* ... */
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;
}{ ... }
/* ... */
static void STM_FSMC_BANK3_WriteData(uint16_t Data)
{
FMC_BANK3->RAM = Data;
}{ ... }
/* ... */
static void STM_FSMC_BANK3_WriteReg(uint8_t Reg)
{
FMC_BANK3->REG = Reg;
}{ ... }
/* ... */
static uint16_t STM_FSMC_BANK3_ReadData(void)
{
return FMC_BANK3->RAM;
}{ ... }