GUI_SelLCD.c
上传用户:zbk8730
上传日期:2017-08-10
资源大小:12168k
文件大小:3k
源码类别:

uCOS

开发平台:

C/C++

  1. /*********************************************************************
  2. *                SEGGER MICROCONTROLLER SYSTEME GmbH                 *
  3. *        Solutions for real time microcontroller applications        *
  4. **********************************************************************
  5. *                                                                    *
  6. *        (c) 2002         SEGGER Microcontroller Systeme GmbH        *
  7. *                                                                    *
  8. *        Internet: www.segger.com    Support:  support@segger.com    *
  9. *                                                                    *
  10. **********************************************************************
  11. **** emWin/GSC Grafical user interface for embedded applications ****
  12. emWin is protected by international copyright laws. Knowledge of the
  13. source code may not be used to write a similar product. This file may
  14. only be used in accordance with a license and should not be re-
  15. distributed in any way. We appreciate your understanding and fairness.
  16. ----------------------------------------------------------------------
  17. File        : GUI_SelLCD.C
  18. Purpose     : emWin GSC, selection of LCD display
  19. ---------------------------END-OF-HEADER------------------------------
  20. */
  21. #include <stddef.h>           /* needed for definition of NULL */
  22. #include "GUI_Private.H"
  23. #include "GUIDebug.h"
  24. #include "LCD_Private.h"      /* Required for configuration, APIList */
  25. #if (LCD_NUM_DISPLAYS > 1) && (GUI_SUPPORT_MEMDEV)
  26. /*
  27.       *************************************************
  28.       *                                               *
  29.       *             LCD Device                        *
  30. *       (if memory devices are supported)       *
  31.       *                                               *
  32.       *************************************************
  33. */
  34. const tLCDDEV_APIList LCD_L0_1_APIList = {
  35. #if LCD_YMAG_1 == 1
  36.   LCD_L0_1_Color2Index,
  37.   LCD_L0_1_DrawBitmap,
  38.   LCD_L0_1_DrawHLine,
  39.   LCD_L0_1_DrawVLine,
  40.   LCD_L0_1_FillRect,
  41.   LCD_L0_1_GetPixelIndex,
  42.   LCD_L0_1_GetRect,
  43.   LCD_L0_1_Index2Color,
  44.   LCD_L0_1_SetPixelIndex,
  45.   LCD_L0_1_XorPixel
  46. #else
  47.   LCD_L0_1_Color2Index,
  48.   LCD_L0_1_MAG_DrawBitmap,
  49.   LCD_L0_1_MAG_DrawHLine,
  50.   LCD_L0_1_MAG_DrawVLine,
  51.   LCD_L0_1_MAG_FillRect,
  52.   LCD_L0_1_MAG_GetPixelIndex,
  53.   LCD_L0_1_GetRect,          /* Original routine is o.k. here, since we use the logical
  54.                                  coordinates for clipping, which are not magnified */
  55.   LCD_L0_1_Index2Color,
  56.   LCD_L0_1_MAG_SetPixelIndex,
  57.   LCD_L0_1_MAG_XorPixel
  58. #endif
  59. };
  60. /***********************************************************
  61. *
  62. *                 GUI_SelLCD
  63. *
  64. ************************************************************
  65. */
  66. const tLCDDEV_APIList * const aAPI[] = {
  67.   &LCD_L0_APIList
  68. #if LCD_NUM_DISPLAYS >1
  69.   ,&LCD_L0_1_APIList
  70. #endif
  71. };
  72. unsigned int GUI_SelLCD(unsigned int Index) {
  73.   unsigned int OldIndex = 0;
  74.   if (Index < LCD_NUM_DISPLAYS) {
  75.     GUI_LOCK();
  76.     GUI_SetDefault();
  77.     OldIndex = (GUI_Context.pDeviceAPI == aAPI[0]) ? 0 : 1;
  78.     GUI_Context.pDeviceAPI = aAPI[Index];
  79.     LCD_SetClipRectMax();
  80.   }
  81.   GUI_UNLOCK();
  82.   return OldIndex;
  83. }
  84. #else
  85. void GUI_SelLCD_(void) {}
  86. #endif