Problem In WM with memdev in FlexColor Driver

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Problem In WM with memdev in FlexColor Driver

      Hello,

      I am using NXP LPC1768 controller with SSD1963. The lib version is 5.38b. I config Emwin display driver as 'GUIDRV_FlexColor'. The problem is my screen becomes blank when i use the cmd "WM_SetCreateFlags(WM_CF_MEMDEV);"(Line 124). And it is work fine without the cmd,but flickering problems arise.
      The memory size I allocate in "GUIConf.c" is 32KB. I simulate the code in Win32 with same memory size ,and is work fine(both with and without the cmd).
      I also run the example " MEMDEV_Banding.c "in my board and its work fine.
      I don't know where is the problem, is the FlexColor driver do not support memdev? Or soming wrong in my driver?
      Here is the code:

      C Source Code: emwintask.c

      1. #include "DIALOG.h"
      2. //main window widgets
      3. #define ID_WINDOW_0 (GUI_ID_USER + 0x00)
      4. #define ID_BUTTON_0 (GUI_ID_USER + 0x01)
      5. #define ID_BUTTON_1 (GUI_ID_USER + 0x02)
      6. #define ID_BUTTON_2 (GUI_ID_USER + 0x03)
      7. #define ID_TEXT_0 (GUI_ID_USER + 0x04)
      8. #define ID_TEXT_1 (GUI_ID_USER + 0x05)
      9. #define ID_MENU_0 (GUI_ID_USER + 0x08)
      10. /*********************************************************************
      11. *
      12. * _aDialogCreate
      13. */
      14. static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
      15. { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 480, 272, 0, 0x0, 0 },
      16. { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 320, 200, 50, 50, 0, 0x0, 0 },
      17. { BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 400, 200, 50, 50, 0, 0x0, 0 },
      18. { BUTTON_CreateIndirect, "Button", ID_BUTTON_2, 240, 200, 50, 50, 0, 0x0, 0 },
      19. { TEXT_CreateIndirect, "Text", ID_TEXT_0, 320, 60, 150, 60, 0, 0x64, 0 },
      20. { TEXT_CreateIndirect, "Text", ID_TEXT_1, 160, 60, 150, 60, 0, 0x64, 0 },
      21. };
      22. /*********************************************************************
      23. *
      24. * _cbDialog
      25. */
      26. int a = 0;
      27. static void _cbDialog(WM_MESSAGE * pMsg) {
      28. WM_HWIN hItem;
      29. int NCode;
      30. int Id;
      31. switch (pMsg->MsgId) {
      32. case WM_INIT_DIALOG:
      33. hItem = pMsg->hWin;
      34. WINDOW_SetBkColor(hItem, GUI_MAKE_COLOR(0x00000000));
      35. //
      36. // Initialization of 'Button'
      37. //
      38. hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
      39. BUTTON_SetFont(hItem, GUI_FONT_32B_ASCII);
      40. BUTTON_SetText(hItem, "+");
      41. //
      42. // Initialization of 'Button'
      43. //
      44. hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
      45. BUTTON_SetFont(hItem, GUI_FONT_32B_ASCII);
      46. BUTTON_SetText(hItem, "-");
      47. //
      48. // Initialization of 'Button'
      49. //
      50. hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2);
      51. BUTTON_SetFont(hItem, GUI_FONT_32B_ASCII);
      52. BUTTON_SetText(hItem, "M");
      53. //
      54. // Initialization of 'Text'
      55. //
      56. hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
      57. TEXT_SetFont(hItem, GUI_FONT_D36X48);
      58. TEXT_SetText(hItem, "33");
      59. TEXT_SetTextColor(hItem, GUI_MAKE_COLOR(0x00FFFFFF));
      60. //
      61. // Initialization of 'Text'
      62. //
      63. hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
      64. TEXT_SetFont(hItem, GUI_FONT_D36X48);
      65. TEXT_SetText(hItem, "11");
      66. TEXT_SetTextColor(hItem, GUI_MAKE_COLOR(0x00FFFFFF));
      67. break;
      68. case WM_NOTIFY_PARENT:
      69. Id = WM_GetId(pMsg->hWinSrc);
      70. NCode = pMsg->Data.v;
      71. switch(Id) {
      72. case ID_BUTTON_0: // Notifications sent by 'Button'
      73. switch(NCode) {
      74. case WM_NOTIFICATION_CLICKED:
      75. hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
      76. TEXT_SetText(hItem, "36");
      77. break;
      78. case WM_NOTIFICATION_RELEASED:
      79. break;
      80. }
      81. break;
      82. case ID_BUTTON_1: // Notifications sent by 'Button'
      83. switch(NCode) {
      84. case WM_NOTIFICATION_CLICKED:
      85. hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
      86. TEXT_SetText(hItem, "30");
      87. break;
      88. case WM_NOTIFICATION_RELEASED:
      89. break;
      90. }
      91. break;
      92. }
      93. break;
      94. default:
      95. WM_DefaultProc(pMsg);
      96. break;
      97. }
      98. }
      99. /*********************************************************************
      100. *
      101. * CreateWindow
      102. */
      103. WM_HWIN CreateWindow(void);
      104. WM_HWIN CreateWindow(void) {
      105. WM_HWIN hWin;
      106. hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
      107. return hWin;
      108. }
      109. /*********************************************************************
      110. *
      111. * MainTask
      112. */
      113. int keys_a = 0;
      114. WM_HWIN hwin_main,hwin_menu;
      115. void MainTask(void) {
      116. WM_SetCreateFlags(WM_CF_MEMDEV); //HERE IS THE PROBLEM
      117. GUI_Init();
      118. hwin_main = CreateWindow();
      119. WM_ShowWindow(hwin_main);
      120. while(1){
      121. GUI_Delay(10);
      122. }
      123. }
      Display All
      Could you please help me with this problem?

      Thanks in advance.
      Regards

      The post was edited 1 time, last by QuE ().

    • Add the driver code:

      C Source Code: LCDConf.c

      1. #include "GUI.h"
      2. #include "GUIDRV_FlexColor.h"
      3. /*********************************************************************
      4. *
      5. * Layer configuration (to be modified)
      6. *
      7. **********************************************************************
      8. */
      9. //
      10. // Physical display size
      11. //
      12. #define XSIZE_PHYS 480
      13. #define YSIZE_PHYS 272
      14. //
      15. // Color conversion
      16. //
      17. #define COLOR_CONVERSION GUICC_M565
      18. //
      19. // Display driver
      20. //
      21. #define DISPLAY_DRIVER GUIDRV_FLEXCOLOR
      22. //
      23. // Buffers / VScreens
      24. //
      25. #define NUM_BUFFERS 1 // Number of multiple buffers to be used
      26. #define NUM_VSCREENS 1 // Number of virtual screens to be used
      27. /*********************************************************************
      28. *
      29. * Configuration checking
      30. *
      31. **********************************************************************
      32. */
      33. #ifndef VRAM_ADDR
      34. #define VRAM_ADDR 0 // TBD by customer: This has to be the frame buffer start address
      35. #endif
      36. #ifndef XSIZE_PHYS
      37. #error Physical X size of display is not defined!
      38. #endif
      39. #ifndef YSIZE_PHYS
      40. #error Physical Y size of display is not defined!
      41. #endif
      42. #ifndef COLOR_CONVERSION
      43. #error Color conversion not defined!
      44. #endif
      45. #ifndef DISPLAY_DRIVER
      46. #error No display driver defined!
      47. #endif
      48. #ifndef NUM_VSCREENS
      49. #define NUM_VSCREENS 1
      50. #else
      51. #if (NUM_VSCREENS <= 0)
      52. #error At least one screeen needs to be defined!
      53. #endif
      54. #endif
      55. #if (NUM_VSCREENS > 1) && (NUM_BUFFERS > 1)
      56. #error Virtual screens and multiple buffers are not allowed!
      57. #endif
      58. /*********************************************************************
      59. *
      60. * Local functions
      61. *
      62. **********************************************************************
      63. */
      64. /********************************************************************
      65. *
      66. * LcdWriteReg
      67. *
      68. * Function description:
      69. * Sets display register
      70. */
      71. extern void LCDDRV_WRCMD(U16 cmd);
      72. /********************************************************************
      73. *
      74. * LcdWriteData
      75. *
      76. * Function description:
      77. * Writes a value to a display register
      78. */
      79. extern void LCDDRV_WRData(U16 data);
      80. /********************************************************************
      81. *
      82. * LcdWriteDataMultiple
      83. *
      84. * Function description:
      85. * Writes multiple values to a display register.
      86. */
      87. extern void LCDDRV_WRDataMulti(U16 * pdata, int nums);
      88. /********************************************************************
      89. *
      90. * LcdReadData
      91. *
      92. * Function description:
      93. * Reads multiple values from a display register.
      94. */
      95. extern U16 LCDDRV_RDData(void);
      96. /********************************************************************
      97. *
      98. * LcdReadDataMultiple
      99. *
      100. * Function description:
      101. * Reads multiple values from a display register.
      102. */
      103. extern void LCDDRV_RDDataMulti(U16 * pdata, int nums);
      104. /*********************************************************************
      105. *
      106. * Public code
      107. *
      108. **********************************************************************
      109. */
      110. /*********************************************************************
      111. *
      112. * LCD_X_Config
      113. *
      114. * Purpose:
      115. * Called during the initialization process in order to set up the
      116. * display driver configuration.
      117. *
      118. */
      119. void LCD_X_Config(void) {
      120. GUI_DEVICE * pDevice;
      121. CONFIG_FLEXCOLOR Config = {0};
      122. GUI_PORT_API PortAPI = {0};
      123. //
      124. // At first initialize use of multiple buffers on demand
      125. //
      126. #if (NUM_BUFFERS > 1)
      127. GUI_MULTIBUF_Config(NUM_BUFFERS);
      128. #endif
      129. //
      130. // Set display driver and color conversion for 1st layer
      131. //
      132. pDevice = GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0);
      133. //
      134. // Display driver configuration, required for Lin-driver
      135. //
      136. LCD_SetSizeEx (0, XSIZE_PHYS , YSIZE_PHYS);
      137. LCD_SetVSizeEx(0, XSIZE_PHYS , YSIZE_PHYS);
      138. //
      139. // Display driver configuration
      140. //
      141. GUIDRV_FlexColor_SetReadFunc66720_B16(pDevice,GUIDRV_FLEXCOLOR_READ_FUNC_II);
      142. PortAPI.pfWrite16_A0 = LCDDRV_WRCMD;
      143. PortAPI.pfWrite16_A1 = LCDDRV_WRData;
      144. PortAPI.pfWriteM16_A1 = LCDDRV_WRDataMulti;
      145. PortAPI.pfRead16_A1 = LCDDRV_RDData;
      146. PortAPI.pfReadM16_A1 = LCDDRV_RDDataMulti;
      147. GUIDRV_FlexColor_SetFunc(pDevice,&PortAPI,GUIDRV_FLEXCOLOR_F66720,GUIDRV_FLEXCOLOR_M16C0B16);
      148. //
      149. // Set user palette data (only required if no fixed palette is used)
      150. //
      151. #if defined(PALETTE)
      152. LCD_SetLUTEx(0, PALETTE);
      153. #endif
      154. }
      155. /*********************************************************************
      156. *
      157. * LCD_X_DisplayDriver
      158. *
      159. * Purpose:
      160. * This function is called by the display driver for several purposes.
      161. * To support the according task the routine needs to be adapted to
      162. * the display controller. Please note that the commands marked with
      163. * 'optional' are not cogently required and should only be adapted if
      164. * the display controller supports these features.
      165. *
      166. * Parameter:
      167. * LayerIndex - Index of layer to be configured
      168. * Cmd - Please refer to the details in the switch statement below
      169. * pData - Pointer to a LCD_X_DATA structure
      170. *
      171. * Return Value:
      172. * < -1 - Error
      173. * -1 - Command not handled
      174. * 0 - Ok
      175. */
      176. int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData) {
      177. int r;
      178. switch (Cmd) {
      179. case LCD_X_INITCONTROLLER: {
      180. //
      181. // Called during the initialization process in order to set up the
      182. // display controller and put it into operation. If the display
      183. // controller is not initialized by any external routine this needs
      184. // to be adapted by the customer...
      185. //
      186. // ...
      187. return 0;
      188. }
      189. case LCD_X_SETVRAMADDR: {
      190. //
      191. // Required for setting the address of the video RAM for drivers
      192. // with memory mapped video RAM which is passed in the 'pVRAM' element of p
      193. //
      194. LCD_X_SETVRAMADDR_INFO * p;
      195. p = (LCD_X_SETVRAMADDR_INFO *)pData;
      196. //...
      197. return 0;
      198. }
      199. case LCD_X_SETORG: {
      200. //
      201. // Required for setting the display origin which is passed in the 'xPos' and 'yPos' element of p
      202. //
      203. LCD_X_SETORG_INFO * p;
      204. p = (LCD_X_SETORG_INFO *)pData;
      205. //...
      206. return 0;
      207. }
      208. case LCD_X_SHOWBUFFER: {
      209. //
      210. // Required if multiple buffers are used. The 'Index' element of p contains the buffer index.
      211. //
      212. LCD_X_SHOWBUFFER_INFO * p;
      213. p = (LCD_X_SHOWBUFFER_INFO *)pData;
      214. //...
      215. return 0;
      216. }
      217. case LCD_X_SETLUTENTRY: {
      218. //
      219. // Required for setting a lookup table entry which is passed in the 'Pos' and 'Color' element of p
      220. //
      221. LCD_X_SETLUTENTRY_INFO * p;
      222. p = (LCD_X_SETLUTENTRY_INFO *)pData;
      223. //...
      224. return 0;
      225. }
      226. case LCD_X_ON: {
      227. //
      228. // Required if the display controller should support switching on and off
      229. //
      230. return 0;
      231. }
      232. case LCD_X_OFF: {
      233. //
      234. // Required if the display controller should support switching on and off
      235. //
      236. // ...
      237. return 0;
      238. }
      239. default:
      240. r = -1;
      241. }
      242. return r;
      243. }
      244. /*************************** End of file ****************************/
      Display All
    • add GUIConf.h

      C Source Code: GUIConf.h

      1. #ifndef GUICONF_H
      2. #define GUICONF_H
      3. /*********************************************************************
      4. *
      5. * Multi layer/display support
      6. */
      7. #define GUI_NUM_LAYERS 16 // Maximum number of available layers
      8. /*********************************************************************
      9. *
      10. * Multi tasking support
      11. */
      12. #define GUI_OS (0) // Compile with multitasking support
      13. /*********************************************************************
      14. *
      15. * Configuration of touch support
      16. */
      17. #define GUI_SUPPORT_TOUCH (0) // Support a touch screen (req. win-manager)
      18. /*********************************************************************
      19. *
      20. * Default font
      21. */
      22. #define GUI_DEFAULT_FONT &GUI_Font6x8
      23. /*********************************************************************
      24. *
      25. * Configuration of available packages
      26. */
      27. #define GUI_SUPPORT_MOUSE 0 // Support a mouse
      28. #define GUI_WINSUPPORT 1 // Use window manager
      29. #define GUI_SUPPORT_MEMDEV 1 // Memory device package available
      30. #define GUI_SUPPORT_DEVICES 1 // Enable use of device pointers
      31. #endif // Avoid multiple inclusion
      Display All