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_MspInit()
STM_FSMC_BANK3_Init()
STM_FSMC_BANK3_WriteData(uint16_t)
STM_FSMC_BANK3_WriteReg(uint8_t)
STM_FSMC_BANK3_ReadData()
Files
loading...
SourceVuSTM32 Libraries and SamplesSTemWin_HelloWorldSTemWin/Target/LCDConf_stm3240g_eval.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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/********************************************************************* * Portions COPYRIGHT 2016 STMicroelectronics * * Portions SEGGER Microcontroller GmbH & Co. KG * * Solutions for real time microcontroller applications * ********************************************************************** * * * (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG * * * * Internet: www.segger.com Support: support@segger.com * * * ********************************************************************** ** emWin V5.28 - Graphical user interface for embedded applications ** All Intellectual Property rights in the Software belongs to SEGGER. emWin is protected by international copyright laws. Knowledge of the source code may not be used to write a similar product. This file may only be used in accordance with the following terms: The software has been licensed to STMicroelectronics International N.V. a Dutch company with a Swiss branch and its headquarters in Plan- les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_ troller products commercialized by Licensee only, sublicensed and dis_ tributed under the terms and conditions of the End User License Agree_ ment supplied by STMicroelectronics International N.V. Full source code is available at: www.segger.com We appreciate your understanding and fairness. ---------------------------------------------------------------------- File : LCDConf.c Purpose : Display controller configuration (single layer) ---------------------------END-OF-HEADER------------------------------ *//* ... */ /** ****************************************************************************** * @file LCDConf_stm3240g_eval.c * @author MCD Application Team * @brief Driver for STM3240G-EVAL board LCD ****************************************************************************** * @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" /********************************************************************* * * Layer configuration (to be modified) * ********************************************************************** *//* ... */ // // 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); static void STM_FSMC_BANK3_Init(void); static void STM_FSMC_BANK3_MspInit(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 */ STM_FSMC_BANK3_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 Initializes STM_FSMC_BANK3 MSP. * @param None * @retval None *//* ... */ static void STM_FSMC_BANK3_MspInit(void) { GPIO_InitTypeDef GPIO_Init_Structure; /* Enable FSMC clock */ __HAL_RCC_FSMC_CLK_ENABLE(); /* Enable GPIOs clock */ __HAL_RCC_GPIOD_CLK_ENABLE(); __HAL_RCC_GPIOE_CLK_ENABLE(); __HAL_RCC_GPIOF_CLK_ENABLE(); __HAL_RCC_GPIOG_CLK_ENABLE(); /* Common GPIO configuration */ GPIO_Init_Structure.Mode = GPIO_MODE_AF_PP; GPIO_Init_Structure.Pull = GPIO_PULLUP; GPIO_Init_Structure.Speed = GPIO_SPEED_HIGH; GPIO_Init_Structure.Alternate = GPIO_AF12_FSMC; /* GPIOD configuration */ GPIO_Init_Structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_8 |\ GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 |\ GPIO_PIN_14 | GPIO_PIN_15; HAL_GPIO_Init(GPIOD, &GPIO_Init_Structure); /* GPIOE configuration */ GPIO_Init_Structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_3| GPIO_PIN_4 | GPIO_PIN_7 |\ GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 |\ GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15; HAL_GPIO_Init(GPIOE, &GPIO_Init_Structure); /* GPIOF configuration */ GPIO_Init_Structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4 |\ GPIO_PIN_5 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15; HAL_GPIO_Init(GPIOF, &GPIO_Init_Structure); /* GPIOG configuration */ GPIO_Init_Structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4 |\ GPIO_PIN_5 | GPIO_PIN_10; HAL_GPIO_Init(GPIOG, &GPIO_Init_Structure); }{ ... } /** * @brief Initializes LCD IO. * @param None * @retval None *//* ... */ static void STM_FSMC_BANK3_Init(void) { SRAM_HandleTypeDef hsram; FSMC_NORSRAM_TimingTypeDef SRAM_Timing; /*** Configure the SRAM Bank 3 ***/ /* Configure IPs */ hsram.Instance = FMC_NORSRAM_DEVICE; hsram.Extended = FMC_NORSRAM_EXTENDED_DEVICE; SRAM_Timing.AddressSetupTime = 5; SRAM_Timing.AddressHoldTime = 1; SRAM_Timing.DataSetupTime = 9; SRAM_Timing.BusTurnAroundDuration = 0; SRAM_Timing.CLKDivision = 2; SRAM_Timing.DataLatency = 2; SRAM_Timing.AccessMode = FSMC_ACCESS_MODE_A; hsram.Init.NSBank = FSMC_NORSRAM_BANK3; hsram.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE; hsram.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM; hsram.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16; hsram.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE; hsram.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW; hsram.Init.WrapMode = FSMC_WRAP_MODE_DISABLE; hsram.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS; hsram.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE; hsram.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE; hsram.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE; hsram.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE; hsram.Init.WriteBurst = FSMC_WRITE_BURST_DISABLE; /* Initialize the SRAM controller */ STM_FSMC_BANK3_MspInit(); HAL_SRAM_Init(&hsram, &SRAM_Timing, &SRAM_Timing); }{ ... } /** * @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; }{ ... }
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.