/********************************************************************* * 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.32 - 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_Lin_Template.c Purpose : Display controller configuration (single layer) ---------------------------END-OF-HEADER------------------------------ */ /** ****************************************************************************** * @attention * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ #include "GUI.h" #include "GUIDRV_Lin.h" /********************************************************************* * * Layer configuration (to be modified) * ********************************************************************** */ // // Physical display size // #define XSIZE_PHYS 320 #define YSIZE_PHYS 240 // // Color conversion // #define COLOR_CONVERSION GUICC_8888 // // Display driver // #define DISPLAY_DRIVER GUIDRV_WIN32 // // Buffers / VScreens // #define NUM_BUFFERS 1 // Number of multiple buffers to be used #define NUM_VSCREENS 1 // Number of virtual screens to be used /********************************************************************* * * Configuration checking * ********************************************************************** */ #ifndef VRAM_ADDR #define VRAM_ADDR 0 // TBD by customer: This has to be the frame buffer start address #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 COLOR_CONVERSION #error Color conversion not defined! #endif #ifndef DISPLAY_DRIVER #error No display driver defined! #endif #ifndef NUM_VSCREENS #define NUM_VSCREENS 1 #else #if (NUM_VSCREENS <= 0) #error At least one screeen needs to be defined! #endif #endif #if (NUM_VSCREENS > 1) && (NUM_BUFFERS > 1) #error Virtual screens and multiple buffers are not allowed! #endif /********************************************************************* * * Public code * ********************************************************************** */ /********************************************************************* * * LCD_X_Config * * Purpose: * Called during the initialization process in order to set up the * display driver configuration. * */ void LCD_X_Config(void) { // // At first initialize use of multiple buffers on demand // #if (NUM_BUFFERS > 1) GUI_MULTIBUF_Config(NUM_BUFFERS); #endif // // Set display driver and color conversion for 1st layer // GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0); // // Display driver configuration, required for Lin-driver // if (LCD_GetSwapXY()) { LCD_SetSizeEx (0, YSIZE_PHYS, XSIZE_PHYS); LCD_SetVSizeEx(0, YSIZE_PHYS * NUM_VSCREENS, XSIZE_PHYS); } else { LCD_SetSizeEx (0, XSIZE_PHYS, YSIZE_PHYS); LCD_SetVSizeEx(0, XSIZE_PHYS, YSIZE_PHYS * NUM_VSCREENS); } LCD_SetVRAMAddrEx(0, (void *)VRAM_ADDR); // // Set user palette data (only required if no fixed palette is used) // #if defined(PALETTE) LCD_SetLUTEx(0, PALETTE); #endif // // Set custom functions for several operations to optimize native processes // LCD_SetDevFunc(0, LCD_DEVFUNC_COPYBUFFER, (void(*)(void))CUSTOM_LCD_CopyBuffer); LCD_SetDevFunc(0, LCD_DEVFUNC_COPYRECT, (void(*)(void))CUSTOM_LCD_CopyRect); LCD_SetDevFunc(0, LCD_DEVFUNC_FILLRECT, (void(*)(void))CUSTOM_LCD_FillRect); LCD_SetDevFunc(0, LCD_DEVFUNC_DRAWBMP_8BPP, (void(*)(void))CUSTOM_LCD_DrawBitmap8bpp); LCD_SetDevFunc(0, LCD_DEVFUNC_DRAWBMP_16BPP, (void(*)(void))CUSTOM_LCD_DrawBitmap16bpp); } /********************************************************************* * * LCD_X_DisplayDriver * * Purpose: * 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; switch (Cmd) { case LCD_X_INITCONTROLLER: { // // Called during the initialization process in order to set up the // display controller and put it into operation. If the display // controller is not initialized by any external routine this needs // to be adapted by the customer... // // ... return 0; } case LCD_X_SETVRAMADDR: { // // Required for setting the address of the video RAM for drivers // with memory mapped video RAM which is passed in the 'pVRAM' element of p // LCD_X_SETVRAMADDR_INFO * p; p = (LCD_X_SETVRAMADDR_INFO *)pData; //... return 0; } case LCD_X_SETORG: { // // Required for setting the display origin which is passed in the 'xPos' and 'yPos' element of p // LCD_X_SETORG_INFO * p; p = (LCD_X_SETORG_INFO *)pData; //... return 0; } case LCD_X_SHOWBUFFER: { // // Required if multiple buffers are used. The 'Index' element of p contains the buffer index. // LCD_X_SHOWBUFFER_INFO * p; p = (LCD_X_SHOWBUFFER_INFO *)pData; //... return 0; } case LCD_X_SETLUTENTRY: { // // Required for setting a lookup table entry which is passed in the 'Pos' and 'Color' element of p // LCD_X_SETLUTENTRY_INFO * p; p = (LCD_X_SETLUTENTRY_INFO *)pData; //... return 0; } case LCD_X_ON: { // // Required if the display controller should support switching on and off // return 0; } case LCD_X_OFF: { // // Required if the display controller should support switching on and off // // ... return 0; } default: r = -1; } return r; } /*************************** End of file ****************************/