STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
LCDConf_Lin_Template.c
Go to the documentation of this file.
1 /*********************************************************************
2 * Portions COPYRIGHT 2015 STMicroelectronics *
3 * Portions SEGGER Microcontroller GmbH & Co. KG *
4 * Solutions for real time microcontroller applications *
5 **********************************************************************
6 * *
7 * (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG *
8 * *
9 * Internet: www.segger.com Support: support@segger.com *
10 * *
11 **********************************************************************
12 
13 ** emWin V5.28 - Graphical user interface for embedded applications **
14 All Intellectual Property rights in the Software belongs to SEGGER.
15 emWin is protected by international copyright laws. Knowledge of the
16 source code may not be used to write a similar product. This file may
17 only be used in accordance with the following terms:
18 
19 The software has been licensed to STMicroelectronics International
20 N.V. a Dutch company with a Swiss branch and its headquarters in Plan-
21 les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the
22 purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_
23 troller products commercialized by Licensee only, sublicensed and dis_
24 tributed under the terms and conditions of the End User License Agree_
25 ment supplied by STMicroelectronics International N.V.
26 Full source code is available at: www.segger.com
27 
28 We appreciate your understanding and fairness.
29 ----------------------------------------------------------------------
30 File : LCDConf_Lin_Template.c
31 Purpose : Display controller configuration (single layer)
32 ---------------------------END-OF-HEADER------------------------------
33 */
34 
54 #include "GUI.h"
55 #include "GUIDRV_Lin.h"
56 
57 /*********************************************************************
58 *
59 * Layer configuration (to be modified)
60 *
61 **********************************************************************
62 */
63 //
64 // Physical display size
65 //
66 #define XSIZE_PHYS 320
67 #define YSIZE_PHYS 240
68 
69 //
70 // Color conversion
71 //
72 #define COLOR_CONVERSION GUICC_8888
73 
74 //
75 // Display driver
76 //
77 #define DISPLAY_DRIVER GUIDRV_WIN32
78 
79 //
80 // Buffers / VScreens
81 //
82 #define NUM_BUFFERS 1 // Number of multiple buffers to be used
83 #define NUM_VSCREENS 1 // Number of virtual screens to be used
84 
85 /*********************************************************************
86 *
87 * Configuration checking
88 *
89 **********************************************************************
90 */
91 #ifndef VRAM_ADDR
92  #define VRAM_ADDR 0 // TBD by customer: This has to be the frame buffer start address
93 #endif
94 #ifndef XSIZE_PHYS
95  #error Physical X size of display is not defined!
96 #endif
97 #ifndef YSIZE_PHYS
98  #error Physical Y size of display is not defined!
99 #endif
100 #ifndef COLOR_CONVERSION
101  #error Color conversion not defined!
102 #endif
103 #ifndef DISPLAY_DRIVER
104  #error No display driver defined!
105 #endif
106 #ifndef NUM_VSCREENS
107  #define NUM_VSCREENS 1
108 #else
109  #if (NUM_VSCREENS <= 0)
110  #error At least one screeen needs to be defined!
111  #endif
112 #endif
113 #if (NUM_VSCREENS > 1) && (NUM_BUFFERS > 1)
114  #error Virtual screens and multiple buffers are not allowed!
115 #endif
116 
117 /*********************************************************************
118 *
119 * Public code
120 *
121 **********************************************************************
122 */
123 /*********************************************************************
124 *
125 * LCD_X_Config
126 *
127 * Purpose:
128 * Called during the initialization process in order to set up the
129 * display driver configuration.
130 *
131 */
132 void LCD_X_Config(void) {
133  //
134  // At first initialize use of multiple buffers on demand
135  //
136  #if (NUM_BUFFERS > 1)
138  #endif
139  //
140  // Set display driver and color conversion for 1st layer
141  //
143  //
144  // Display driver configuration, required for Lin-driver
145  //
146  if (LCD_GetSwapXY()) {
149  } else {
152  }
153  LCD_SetVRAMAddrEx(0, (void *)VRAM_ADDR);
154  //
155  // Set user palette data (only required if no fixed palette is used)
156  //
157  #if defined(PALETTE)
158  LCD_SetLUTEx(0, PALETTE);
159  #endif
160 
161  //
162  // Set custom functions for several operations to optimize native processes
163  //
164  LCD_SetDevFunc(0, LCD_DEVFUNC_COPYBUFFER, (void(*)(void))CUSTOM_LCD_CopyBuffer);
165  LCD_SetDevFunc(0, LCD_DEVFUNC_COPYRECT, (void(*)(void))CUSTOM_LCD_CopyRect);
166  LCD_SetDevFunc(0, LCD_DEVFUNC_FILLRECT, (void(*)(void))CUSTOM_LCD_FillRect);
167  LCD_SetDevFunc(0, LCD_DEVFUNC_DRAWBMP_8BPP, (void(*)(void))CUSTOM_LCD_DrawBitmap8bpp);
168  LCD_SetDevFunc(0, LCD_DEVFUNC_DRAWBMP_16BPP, (void(*)(void))CUSTOM_LCD_DrawBitmap16bpp);
169 }
170 
171 /*********************************************************************
172 *
173 * LCD_X_DisplayDriver
174 *
175 * Purpose:
176 * This function is called by the display driver for several purposes.
177 * To support the according task the routine needs to be adapted to
178 * the display controller. Please note that the commands marked with
179 * 'optional' are not cogently required and should only be adapted if
180 * the display controller supports these features.
181 *
182 * Parameter:
183 * LayerIndex - Index of layer to be configured
184 * Cmd - Please refer to the details in the switch statement below
185 * pData - Pointer to a LCD_X_DATA structure
186 *
187 * Return Value:
188 * < -1 - Error
189 * -1 - Command not handled
190 * 0 - Ok
191 */
192 int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData) {
193  int r;
194 
195  switch (Cmd) {
196  case LCD_X_INITCONTROLLER: {
197  //
198  // Called during the initialization process in order to set up the
199  // display controller and put it into operation. If the display
200  // controller is not initialized by any external routine this needs
201  // to be adapted by the customer...
202  //
203  // ...
204  return 0;
205  }
206  case LCD_X_SETVRAMADDR: {
207  //
208  // Required for setting the address of the video RAM for drivers
209  // with memory mapped video RAM which is passed in the 'pVRAM' element of p
210  //
212  p = (LCD_X_SETVRAMADDR_INFO *)pData;
213  //...
214  return 0;
215  }
216  case LCD_X_SETORG: {
217  //
218  // Required for setting the display origin which is passed in the 'xPos' and 'yPos' element of p
219  //
220  LCD_X_SETORG_INFO * p;
221  p = (LCD_X_SETORG_INFO *)pData;
222  //...
223  return 0;
224  }
225  case LCD_X_SHOWBUFFER: {
226  //
227  // Required if multiple buffers are used. The 'Index' element of p contains the buffer index.
228  //
230  p = (LCD_X_SHOWBUFFER_INFO *)pData;
231  //...
232  return 0;
233  }
234  case LCD_X_SETLUTENTRY: {
235  //
236  // Required for setting a lookup table entry which is passed in the 'Pos' and 'Color' element of p
237  //
239  p = (LCD_X_SETLUTENTRY_INFO *)pData;
240  //...
241  return 0;
242  }
243  case LCD_X_ON: {
244  //
245  // Required if the display controller should support switching on and off
246  //
247  return 0;
248  }
249  case LCD_X_OFF: {
250  //
251  // Required if the display controller should support switching on and off
252  //
253  // ...
254  return 0;
255  }
256  default:
257  r = -1;
258  }
259  return r;
260 }
261 
262 /*************************** End of file ****************************/
#define XSIZE_PHYS
#define YSIZE_PHYS
GUI_DEVICE * GUI_DEVICE_CreateAndLink(const GUI_DEVICE_API *pDeviceAPI, const LCD_API_COLOR_CONV *pColorConvAPI, U16 Flags, int LayerIndex)
int LCD_SetSizeEx(int LayerIndex, int xSize, int ySize)
#define LCD_X_ON
Definition: LCD.h:518
#define LCD_X_SHOWBUFFER
Definition: LCD.h:527
int LCD_SetVSizeEx(int LayerIndex, int xSize, int ySize)
#define LCD_DEVFUNC_DRAWBMP_16BPP
Definition: LCD.h:439
#define LCD_X_INITCONTROLLER
Definition: LCD.h:514
#define LCD_X_OFF
Definition: LCD.h:519
void LCD_X_Config(void)
Called during the initialization process in order to set up the display driver configuration.
#define LCD_DEVFUNC_FILLRECT
Definition: LCD.h:434
#define NUM_BUFFERS
#define COLOR_CONVERSION
#define LCD_DEVFUNC_COPYRECT
Definition: LCD.h:438
#define DISPLAY_DRIVER
int LCD_SetDevFunc(int LayerIndex, int IdFunc, void(*pDriverFunc)(void))
#define LCD_X_SETVRAMADDR
Definition: LCD.h:515
#define LCD_DEVFUNC_DRAWBMP_8BPP
Definition: LCD.h:440
#define LCD_DEVFUNC_COPYBUFFER
Definition: LCD.h:436
void LCD_SetLUTEx(int LayerIndex, const LCD_PHYSPALETTE *pPalette)
int LCD_SetVRAMAddrEx(int LayerIndex, void *pVRAM)
#define LCD_X_SETORG
Definition: LCD.h:516
#define LCD_X_SETLUTENTRY
Definition: LCD.h:517
#define VRAM_ADDR
#define NUM_VSCREENS
int LCD_GetSwapXY(void)
void GUI_MULTIBUF_Config(int NumBuffers)
int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void *pData)
This function is called by the display driver for several purposes. To support the according task the...