硬汉嵌入式论坛

 找回密码
 立即注册
查看: 2511|回复: 3
收起左侧

[GUI] KEIL提供的用于RT105X的emWin底层驱动文件

[复制链接]

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106865
QQ
发表于 2019-9-23 14:29:22 | 显示全部楼层 |阅读模式


路径:Keil\MDK-Middleware\7.9.0\emWin\Sample\LCDConf\GUIDRV_Lin\iMXRT1052_EVK


  1. /*********************************************************************
  2. *                    SEGGER Microcontroller GmbH                     *
  3. *        Solutions for real time microcontroller applications        *
  4. **********************************************************************
  5. *                                                                    *
  6. *        (c) 1996 - 2019  SEGGER Microcontroller GmbH                *
  7. *                                                                    *
  8. *        Internet: www.segger.com    Support:  support@segger.com    *
  9. *                                                                    *
  10. **********************************************************************

  11. ** emWin V5.50 - Graphical user interface for embedded applications **
  12. All  Intellectual Property rights  in the Software belongs to  SEGGER.
  13. emWin is protected by  international copyright laws.  Knowledge of the
  14. source code may not be used to write a similar product.  This file may
  15. only be used in accordance with the following terms:

  16. The software has been licensed to  ARM LIMITED whose registered office
  17. is situated at  110 Fulbourn Road,  Cambridge CB1 9NJ,  England solely
  18. for  the  purposes  of  creating  libraries  for  ARM7, ARM9, Cortex-M
  19. series,  and   Cortex-R4   processor-based  devices,  sublicensed  and
  20. distributed as part of the  MDK-ARM  Professional  under the terms and
  21. conditions  of  the   End  User  License  supplied  with  the  MDK-ARM
  22. Professional.
  23. Full source code is available at: www.segger.com

  24. We appreciate your understanding and fairness.
  25. ----------------------------------------------------------------------
  26. Licensing information
  27. Licensor:                 SEGGER Software GmbH
  28. Licensed to:              ARM Ltd, 110 Fulbourn Road, CB1 9NJ Cambridge, UK
  29. Licensed SEGGER software: emWin
  30. License number:           GUI-00181
  31. License model:            LES-SLA-20007, Agreement, effective since October 1st 2011
  32. Licensed product:         MDK-ARM Professional
  33. Licensed platform:        ARM7/9, Cortex-M/R4
  34. Licensed number of seats: -
  35. ----------------------------------------------------------------------
  36. File        : LCDConf.c
  37. Purpose     : Display controller configuration

  38. This file was created to be used with the iMXRT10520 EVK/EVKB board.

  39. It requires the proper fsl header files which are provided by NXP.

  40. ---------------------------END-OF-HEADER------------------------------
  41. */
  42. #include "GUI.h"
  43. #include "GUIDRV_Lin.h"
  44. #include "LCDConf.h"

  45. #include "fsl_common.h"
  46. #include "fsl_iomuxc.h"
  47. #include "fsl_gpio.h"
  48. #include "fsl_elcdif.h"

  49. /*********************************************************************
  50. *
  51. *       LCD configuration
  52. *
  53. **********************************************************************
  54. */
  55. #define LCD_BITS_PER_PIXEL 32
  56. #define LCD_BYTES_PER_PIXEL (LCD_BITS_PER_PIXEL / 8)

  57. #if LCD_BITS_PER_PIXEL == 16
  58.   #define DISPLAY_DRIVER      GUIDRV_LIN_16
  59.   #define COLOR_CONVERSION    GUICC_M565
  60.   #define PIXEL_FORMAT        kELCDIF_PixelFormatRGB565
  61.   #define LCD_DATA_BUS_WIDTH  kELCDIF_DataBus16Bit
  62. #else
  63.   #define DISPLAY_DRIVER      GUIDRV_LIN_32
  64.   #define COLOR_CONVERSION    GUICC_M8888I
  65.   #define PIXEL_FORMAT        kELCDIF_PixelFormatXRGB8888
  66.   #define LCD_DATA_BUS_WIDTH  kELCDIF_DataBus16Bit
  67. #endif

  68. /*********************************************************************
  69. *
  70. *       Layer configuration (to be modified)
  71. *
  72. **********************************************************************
  73. */
  74. #define XSIZE_PHYS 480
  75. #define YSIZE_PHYS 272

  76. //
  77. // Buffers / VScreens
  78. //
  79. #define NUM_BUFFERS  2 // Number of multiple buffers to be used (at least 1 buffer)
  80. #define NUM_VSCREENS 1 // Number of virtual  screens to be used (at least 1 screen)

  81. //
  82. // Define number of layers for this configuration file. Must be equal or less than in GUIConf.h!
  83. //
  84. #undef  GUI_NUM_LAYERS
  85. #define GUI_NUM_LAYERS 1

  86. /*********************************************************************
  87. *
  88. *       Configuration checking
  89. *
  90. **********************************************************************
  91. */
  92. #ifndef   VRAM_ADDR
  93. #ifdef __SES_ARM
  94.   #define VRAM_ADDR (U32)(&_aVRAM0[0])
  95. #else
  96.   #define VRAM_ADDR (U32)(0x80000000)
  97. #endif
  98. #endif
  99. #ifndef   XSIZE_PHYS
  100.   #error Physical X size of display is not defined!
  101. #endif
  102. #ifndef   YSIZE_PHYS
  103.   #error Physical Y size of display is not defined!
  104. #endif
  105. #ifndef   COLOR_CONVERSION
  106.   #error Color conversion not defined!
  107. #endif
  108. #ifndef   DISPLAY_DRIVER
  109.   #error No display driver defined!
  110. #endif

  111. #define LCD_HSW        41
  112. #define LCD_HFP        4
  113. #define LCD_HBP        8
  114. #define LCD_VSW        10
  115. #define LCD_VFP        4
  116. #define LCD_VBP        2
  117. #define LCD_POL_FLAGS  (kELCDIF_DataEnableActiveHigh | kELCDIF_VsyncActiveLow | kELCDIF_HsyncActiveLow | kELCDIF_DriveDataOnRisingClkEdge)

  118. //
  119. // LCD related GPIOs
  120. //
  121. #define LCD_DISP_GPIO GPIO1
  122. #define LCD_DISP_GPIO_PIN 2  // Reset
  123. #define LCD_BL_GPIO GPIO2
  124. #define LCD_BL_GPIO_PIN 31   // Backlight

  125. #ifdef __SES_ARM
  126. U32 _aVRAM0[XSIZE_PHYS * YSIZE_PHYS * NUM_BUFFERS * NUM_VSCREENS * LCD_BYTES_PER_PIXEL] __attribute__ ((section (".GUI_RAM")));
  127. #endif

  128. static volatile int               _PendingBuffer = -1;

  129. //
  130. // Clock config
  131. //
  132. const clock_arm_pll_config_t armPllConfig = {.loopDivider = 100U};
  133. const clock_sys_pll_config_t sysPllConfig = {.loopDivider = 1U};
  134. const clock_usb_pll_config_t usb1PllConfig = {.loopDivider = 0U};

  135. static U32 _aBufferAddress[NUM_BUFFERS] = {
  136.   VRAM_ADDR,
  137.   #if (NUM_BUFFERS > 1)
  138.     VRAM_ADDR + XSIZE_PHYS * YSIZE_PHYS * LCD_BYTES_PER_PIXEL,
  139.   #endif
  140.   #if (NUM_BUFFERS > 2)
  141.     VRAM_ADDR + XSIZE_PHYS * YSIZE_PHYS * LCD_BYTES_PER_PIXEL * 2
  142.   #endif
  143. };

  144. /*********************************************************************
  145. *
  146. *       Static code
  147. *
  148. **********************************************************************
  149. */

  150. /*********************************************************************
  151. *
  152. *       _InitPins
  153. */
  154. static void _InitPins(void) {
  155.   CLOCK_EnableClock(kCLOCK_Iomuxc);                       // iomuxc clock (iomuxc_clk_enable): 0x03u
  156.   
  157.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_00_LCD_CLK, 0U);        // GPIO_B0_00 is configured as LCD_CLK
  158.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_01_LCD_ENABLE, 0U);     // GPIO_B0_01 is configured as LCD_ENABLE
  159.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_02_LCD_HSYNC, 0U);      // GPIO_B0_02 is configured as LCD_HSYNC
  160.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_03_LCD_VSYNC, 0U);      // GPIO_B0_03 is configured as LCD_VSYNC
  161.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_04_LCD_DATA00, 0U);     // GPIO_B0_04 is configured as LCD_DATA00
  162.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_05_LCD_DATA01, 0U);     // GPIO_B0_05 is configured as LCD_DATA01
  163.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_06_LCD_DATA02, 0U);     // GPIO_B0_06 is configured as LCD_DATA02
  164.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_07_LCD_DATA03, 0U);     // GPIO_B0_07 is configured as LCD_DATA03
  165.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_08_LCD_DATA04, 0U);     // GPIO_B0_08 is configured as LCD_DATA04
  166.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_09_LCD_DATA05, 0U);     // GPIO_B0_09 is configured as LCD_DATA05
  167.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_10_LCD_DATA06, 0U);     // GPIO_B0_10 is configured as LCD_DATA06
  168.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_11_LCD_DATA07, 0U);     // GPIO_B0_11 is configured as LCD_DATA07
  169.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_12_LCD_DATA08, 0U);     // GPIO_B0_12 is configured as LCD_DATA08
  170.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_13_LCD_DATA09, 0U);     // GPIO_B0_13 is configured as LCD_DATA09
  171.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_14_LCD_DATA10, 0U);     // GPIO_B0_14 is configured as LCD_DATA10
  172.   IOMUXC_SetPinMux(IOMUXC_GPIO_B0_15_LCD_DATA11, 0U);     // GPIO_B0_15 is configured as LCD_DATA11
  173.   IOMUXC_SetPinMux(IOMUXC_GPIO_B1_00_LCD_DATA12, 0U);     // GPIO_B1_00 is configured as LCD_DATA12
  174.   IOMUXC_SetPinMux(IOMUXC_GPIO_B1_01_LCD_DATA13, 0U);     // GPIO_B1_01 is configured as LCD_DATA13
  175.   IOMUXC_SetPinMux(IOMUXC_GPIO_B1_02_LCD_DATA14, 0U);     // GPIO_B1_02 is configured as LCD_DATA14
  176.   IOMUXC_SetPinMux(IOMUXC_GPIO_B1_03_LCD_DATA15, 0U);     // GPIO_B1_03 is configured as LCD_DATA15

  177.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_00_LCD_CLK,       0x01B0B0u);  // GPIO_B0_00 PAD functional properties
  178.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_01_LCD_ENABLE,    0x01B0B0u);  // GPIO_B0_01 PAD functional properties
  179.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_02_LCD_HSYNC,     0x01B0B0u);  // GPIO_B0_02 PAD functional properties
  180.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_03_LCD_VSYNC,     0x01B0B0u);  // GPIO_B0_03 PAD functional properties
  181.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_04_LCD_DATA00,    0x01B0B0u);  // GPIO_B0_04 PAD functional properties
  182.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_05_LCD_DATA01,    0x01B0B0u);  // GPIO_B0_05 PAD functional properties
  183.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_06_LCD_DATA02,    0x01B0B0u);  // GPIO_B0_06 PAD functional properties
  184.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_07_LCD_DATA03,    0x01B0B0u);  // GPIO_B0_07 PAD functional properties
  185.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_08_LCD_DATA04,    0x01B0B0u);  // GPIO_B0_08 PAD functional properties
  186.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_09_LCD_DATA05,    0x01B0B0u);  // GPIO_B0_09 PAD functional properties
  187.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_10_LCD_DATA06,    0x01B0B0u);  // GPIO_B0_10 PAD functional properties
  188.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_11_LCD_DATA07,    0x01B0B0u);  // GPIO_B0_11 PAD functional properties
  189.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_12_LCD_DATA08,    0x01B0B0u);  // GPIO_B0_12 PAD functional properties
  190.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_13_LCD_DATA09,    0x01B0B0u);  // GPIO_B0_13 PAD functional properties
  191.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_14_LCD_DATA10,    0x01B0B0u);  // GPIO_B0_14 PAD functional properties
  192.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_15_LCD_DATA11,    0x01B0B0u);  // GPIO_B0_15 PAD functional properties
  193.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_00_LCD_DATA12,    0x01B0B0u);  // GPIO_B1_00 PAD functional properties
  194.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_01_LCD_DATA13,    0x01B0B0u);  // GPIO_B1_01 PAD functional properties
  195.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_02_LCD_DATA14,    0x01B0B0u);  // GPIO_B1_02 PAD functional properties
  196.   IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_03_LCD_DATA15,    0x01B0B0u);  // GPIO_B1_03 PAD functional properties
  197. }

  198. /*********************************************************************
  199. *
  200. *       _BootClockRUN
  201. */
  202. static void _BootClockRUN(void) {
  203.   //
  204.   // Boot ROM did initialize the XTAL, here we only sets external XTAL OSC freq
  205.   //
  206.   CLOCK_SetXtalFreq(24000000U);
  207.   CLOCK_SetRtcXtalFreq(32768U);
  208.   CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 0x1);                                  // Set PERIPH_CLK2 MUX to OSC
  209.   CLOCK_SetMux(kCLOCK_PeriphMux, 0x1);                                      // Set PERIPH_CLK MUX to PERIPH_CLK2
  210.   DCDC->REG3 = (DCDC->REG3 & (~DCDC_REG3_TRG_MASK)) | DCDC_REG3_TRG(0x12);
  211.   CLOCK_InitArmPll(&armPllConfig);                                          // Configure ARM PLL to 1200M
  212.   CLOCK_InitSysPll(&sysPllConfig);                                          // Configure SYS PLL to 528M
  213.   CLOCK_InitUsb1Pll(&usb1PllConfig);                                        // Configure USB1 PLL to 480M
  214.   CLOCK_SetDiv(kCLOCK_ArmDiv, 0x1);                                         // Set ARM PODF to 1, divide by 2
  215.   CLOCK_SetDiv(kCLOCK_AhbDiv, 0x0);                                         // Set AHB PODF to 0, divide by 1
  216.   CLOCK_SetDiv(kCLOCK_IpgDiv, 0x3);                                         // Set IPG PODF to 3, divede by 4
  217.   CLOCK_SetMux(kCLOCK_PrePeriphMux, 0x3);                                   // Set PRE_PERIPH_CLK to PLL1, 1200M
  218.   CLOCK_SetMux(kCLOCK_PeriphMux, 0x0);                                      // Set PERIPH_CLK MUX to PRE_PERIPH_CLK
  219.   //_BootClockGate();
  220.   CLOCK_DeinitAudioPll();
  221.   //CLOCK_DeinitVideoPll();
  222.   CLOCK_DeinitEnetPll();
  223.   CLOCK_DeinitUsb2Pll();
  224.   SystemCoreClockUpdate();
  225. }

  226. /*********************************************************************
  227. *
  228. *       _LCDOnOff
  229. */
  230. static void _LCDOnOff(int OnOff) {
  231.   gpio_pin_config_t config = {
  232.     kGPIO_DigitalOutput, 0, 0,
  233.   };   
  234.   //
  235.   // Backlight
  236.   //
  237.   config.outputLogic = OnOff;
  238.   GPIO_PinInit(LCD_BL_GPIO, LCD_BL_GPIO_PIN, &config);
  239. }

  240. /*********************************************************************
  241. *
  242. *       _InitPixelClock
  243. */
  244. static void _InitPixelClock(void) {
  245.     clock_video_pll_config_t config = {
  246.         .loopDivider = 31, .postDivider = 8, .numerator = 0, .denominator = 0,
  247.     };
  248.     CLOCK_InitVideoPll(&config);
  249.     CLOCK_SetMux(kCLOCK_LcdifPreMux, 2);
  250.     CLOCK_SetDiv(kCLOCK_LcdifPreDiv, 4);
  251.     CLOCK_SetDiv(kCLOCK_LcdifDiv, 1);
  252. }

  253. /*********************************************************************
  254. *
  255. *       _InitController
  256. *
  257. * Purpose:
  258. *   Should initialize the display controller
  259. */
  260. static void _InitController(void) {
  261.   const elcdif_rgb_mode_config_t LCDConfig = {
  262.     .panelWidth = XSIZE_PHYS,
  263.     .panelHeight = YSIZE_PHYS,
  264.     .hsw = LCD_HSW,
  265.     .hfp = LCD_HFP,
  266.     .hbp = LCD_HBP,
  267.     .vsw = LCD_VSW,
  268.     .vfp = LCD_VFP,
  269.     .vbp = LCD_VBP,
  270.     .polarityFlags = LCD_POL_FLAGS,
  271.     .bufferAddr = VRAM_ADDR,
  272.     .pixelFormat = PIXEL_FORMAT,
  273.     .dataBus = LCD_DATA_BUS_WIDTH,
  274.   };
  275.   gpio_pin_config_t GPIOConfig = {
  276.     kGPIO_DigitalOutput, 0, 0,
  277.   };
  278.   int i = 0x100U;
  279.   
  280.   _InitPins();
  281.   _BootClockRUN();
  282.   _InitPixelClock();
  283.   //
  284.   // Reset the LCD
  285.   //
  286.   GPIO_PinInit(LCD_DISP_GPIO, LCD_DISP_GPIO_PIN, &GPIOConfig);
  287.   GPIO_WritePinOutput(LCD_DISP_GPIO, LCD_DISP_GPIO_PIN, 0);
  288.   while (i--) {}
  289.   GPIO_WritePinOutput(LCD_DISP_GPIO, LCD_DISP_GPIO_PIN, 1);
  290.   //
  291.   // Init LCD controller
  292.   //
  293.   ELCDIF_RgbModeInit(LCDIF, &LCDConfig);
  294.   //
  295.   // Enable VSYNC interrupt
  296.   //   
  297.   EnableIRQ(LCDIF_IRQn);
  298.   ELCDIF_EnableInterrupts(LCDIF, kELCDIF_CurFrameDoneInterruptEnable);
  299.   NVIC_EnableIRQ(LCDIF_IRQn);
  300.   ELCDIF_RgbModeStart(LCDIF);
  301. }

  302. /*********************************************************************
  303. *
  304. *       _ClearCache
  305. */
  306. static void _ClearCache(U32 v) {
  307.   GUI_USE_PARA(v);
  308.   SCB_CleanInvalidateDCache();
  309. }

  310. /*********************************************************************
  311. *
  312. *       LCDIF_IRQHandler
  313. */
  314. void LCDIF_IRQHandler(void);
  315. void LCDIF_IRQHandler(void) {
  316.   U32 InterruptStatus;
  317.   //
  318.   // Get and clear interrupt status
  319.   //
  320.   InterruptStatus = ELCDIF_GetInterruptStatus(LCDIF);
  321.   ELCDIF_ClearInterruptStatus(LCDIF, InterruptStatus);
  322.   //
  323.   // If frame is done and pending buffer is not -1 confirm buffer
  324.   //
  325.   if (InterruptStatus & kELCDIF_CurFrameDone) {
  326.     if (_PendingBuffer >= 0) {
  327.       GUI_MULTIBUF_Confirm(_PendingBuffer);
  328.       _PendingBuffer = -1;
  329.     }
  330.   }
  331. #if defined __CORTEX_M && (__CORTEX_M == 4U)
  332.     __DSB();
  333. #endif
  334. }

  335. /*********************************************************************
  336. *
  337. *       _SwitchBuffer
  338. */
  339. static void _SwitchBuffer(int Index) {
  340.   U32 Addr;
  341.   //
  342.   // Calculate address of buffer to be used  as visible frame buffer
  343.   //
  344.   Addr = _aBufferAddress[Index];
  345.   //
  346.   // Reload configuration
  347.   //
  348.   ELCDIF_SetNextBufferAddr(LCDIF, Addr);
  349.   //
  350.   // Tell emWin that buffer is used
  351.   //
  352.   _PendingBuffer = Index;
  353.   while (_PendingBuffer >= 0) {
  354.   }
  355. }

  356. /*********************************************************************
  357. *
  358. *       Public code
  359. *
  360. **********************************************************************
  361. */
  362. /*********************************************************************
  363. *
  364. *       LCD_X_Config
  365. *
  366. * Purpose:
  367. *   Called during the initialization process in order to set up the
  368. *   display driver configuration.
  369. *   
  370. */
  371. void LCD_X_Config(void) {

  372. #if (NUM_BUFFERS > 1)
  373.   GUI_MULTIBUF_Config(NUM_BUFFERS);
  374. #endif
  375.   //
  376.   // Set display driver and color conversion for 1st layer
  377.   //
  378.   GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0);
  379.   //
  380.   // Display driver configuration
  381.   //
  382.   if (LCD_GetSwapXY()) {
  383.     LCD_SetSizeEx (0, YSIZE_PHYS, XSIZE_PHYS);
  384.     LCD_SetVSizeEx(0, YSIZE_PHYS, XSIZE_PHYS);
  385.   } else {
  386.     LCD_SetSizeEx (0, XSIZE_PHYS, YSIZE_PHYS);
  387.     LCD_SetVSizeEx(0, XSIZE_PHYS, YSIZE_PHYS);
  388.   }
  389.   LCD_SetVRAMAddrEx(0, (void *)_aBufferAddress[0]);
  390.   //
  391.   // Set user palette data (only required if no fixed palette is used)
  392.   //
  393.   #if defined(PALETTE)
  394.     LCD_SetLUTEx(0, PALETTE);
  395.   #endif
  396.   GUI_DCACHE_SetClearCacheHook(_ClearCache);
  397. }

  398. /*********************************************************************
  399. *
  400. *       LCD_X_DisplayDriver
  401. *
  402. * Purpose:
  403. *   This function is called by the display driver for several purposes.
  404. *   To support the according task the routine needs to be adapted to
  405. *   the display controller. Please note that the commands marked with
  406. *   'optional' are not cogently required and should only be adapted if
  407. *   the display controller supports these features.
  408. *
  409. * Parameter:
  410. *   LayerIndex - Index of layer to be configured
  411. *   Cmd        - Please refer to the details in the switch statement below
  412. *   pData      - Pointer to a LCD_X_DATA structure
  413. *
  414. * Return Value:
  415. *   < -1 - Error
  416. *     -1 - Command not handled
  417. *      0 - Ok
  418. */
  419. int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData) {
  420.   int r;

  421.   GUI_USE_PARA(LayerIndex);
  422.   switch (Cmd) {
  423.   //
  424.   // Required
  425.   //
  426.   case LCD_X_INITCONTROLLER: {
  427.     //
  428.     // Called during the initialization process in order to set up the
  429.     // display controller and put it into operation. If the display
  430.     // controller is not initialized by any external routine this needs
  431.     // to be adapted by the customer...
  432.     //
  433.     _InitController();
  434.     return 0;
  435.   }
  436.   case LCD_X_SHOWBUFFER: {
  437.     LCD_X_SHOWBUFFER_INFO * pInfo;

  438.     pInfo = (LCD_X_SHOWBUFFER_INFO *)pData;
  439.     _SwitchBuffer(pInfo->Index);
  440.     return 0;
  441.   }
  442.   case LCD_X_ON: {
  443.     _LCDOnOff(1);
  444.     return 0;
  445.   }
  446.   case LCD_X_OFF: {
  447.     _LCDOnOff(0);
  448.     return 0;
  449.   }
  450.   default:
  451.     r = -1;
  452.   }
  453.   return r;
  454. }

  455. /*************************** End of file ****************************/
复制代码


回复

使用道具 举报

32

主题

187

回帖

283

积分

高级会员

积分
283
发表于 2019-9-23 22:55:37 | 显示全部楼层
while (_PendingBuffer >= 0) 第381行的这个代码是啥意思,屏蔽了之后用多缓冲刷新速度快了一倍,加上就比较慢。另外还有一个,用多缓冲比不用多缓冲的刷新速度要多一点,这算正常么?
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106865
QQ
 楼主| 发表于 2019-9-24 00:35:39 | 显示全部楼层
loliko 发表于 2019-9-23 22:55
while (_PendingBuffer >= 0) 第381行的这个代码是啥意思,屏蔽了之后用多缓冲刷新速度快了一倍,加上就比 ...

多缓冲主要是解决撕裂问题的。

可以考虑直接在中断LCDIF_IRQHandler里面配置寄存器使用下一个缓冲,配置好后,

如果在显示屏拖动对话框没有撕裂感,特别是边界部分。
回复

使用道具 举报

1

主题

1

回帖

4

积分

新手上路

积分
4
发表于 2023-12-13 10:55:32 | 显示全部楼层
这个在哪下载啊大佬  我现在移植都不知道哪里要修改 例程里面Lib文件夹里面都都是ST的 源代码生成都困难 教教孩子吧
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-8 08:34 , Processed in 0.261837 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表