STM32
直播中

乔丽娜

7年用户 1059经验值
私信 关注
[问答]

emWin GUIBuilder做的一个界面在F429I-DISCO上不显示是怎么回事?

用的是STM32Cube_FW_F4_V1.11.0ProjectsSTM32F429I-DiscoveryApplicationsSTemWinSTemWin_HelloWorld  这个例程,把builder生成的.c文件加入了工程,然后用生成的一个函数---CreateWindow();替换了MainTask()函数里的代码。编译通过后,下载到板子里,黑屏。调了好长时间,就是什么都不显示。。下面是Builder生成的代码:

  • /*********************************************************************
  • *                                                                    *
  • *                SEGGER Microcontroller GmbH   Co. KG                *
  • *        Solutions for real time microcontroller applications        *
  • *                                                                    *
  • **********************************************************************
  • *                                                                    *
  • * C-file generated by:                                               *
  • *                                                                    *
  • *        GUI_Builder for emWin version 5.28                          *
  • *        Compiled Jan 30 2015, 16:41:06                              *
  • *        (c) 2015 Segger Microcontroller GmbH   Co. KG               *
  • *                                                                    *
  • **********************************************************************
  • *                                                                    *
  • *        Internet: www.segger.com  Support: support@segger.com       *
  • *                                                                    *
  • **********************************************************************
  • */

  • // USER START (Optionally insert additional includes)
  • // USER END

  • #include "DIALOG.h"

  • /*********************************************************************
  • *
  • *       Defines
  • *
  • **********************************************************************
  • */
  • #define ID_WINDOW_0 (GUI_ID_USER + 0x06)
  • #define ID_BUTTON_0 (GUI_ID_USER + 0x07)
  • #define ID_BUTTON_1 (GUI_ID_USER + 0x08)


  • // USER START (Optionally insert additional defines)
  • // USER END

  • /*********************************************************************
  • *
  • *       Static data
  • *
  • **********************************************************************
  • */

  • // USER START (Optionally insert additional static data)
  • // USER END

  • /*********************************************************************
  • *
  • *       _aDialogCreate
  • */
  • static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  •   { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 240, 320, 0, 0x0, 0 },
  •   { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 78, 136, 80, 20, 0, 0x0, 0 },
  •   { BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 68, 69, 80, 20, 0, 0x0, 0 },
  •   // USER START (Optionally insert additional widgets)
  •   // USER END
  • };

  • /*********************************************************************
  • *
  • *       Static code
  • *
  • **********************************************************************
  • */

  • // USER START (Optionally insert additional static code)
  • // USER END

  • /*********************************************************************
  • *
  • *       _cbDialog
  • */
  • static void _cbDialog(WM_MESSAGE * pMsg) {
  •   int NCode;
  •   int Id;
  •   // USER START (Optionally insert additional variables)
  •   // USER END

  •   switch (pMsg->MsgId) {
  •   case WM_NOTIFY_PARENT:
  •     Id    = WM_GetId(pMsg->hWinSrc);
  •     NCode = pMsg->Data.v;
  •     switch(Id) {
  •     case ID_BUTTON_0: // Notifications sent by 'Button'
  •       switch(NCode) {
  •       case WM_NOTIFICATION_CLICKED:
  •         // USER START (Optionally insert code for reacting on notification message)
  •         // USER END
  •         break;
  •       case WM_NOTIFICATION_RELEASED:
  •         // USER START (Optionally insert code for reacting on notification message)
  •         // USER END
  •         break;
  •       // USER START (Optionally insert additional code for further notification handling)
  •       // USER END
  •       }
  •       break;
  •     case ID_BUTTON_1: // Notifications sent by 'Button'
  •       switch(NCode) {
  •       case WM_NOTIFICATION_CLICKED:
  •         // USER START (Optionally insert code for reacting on notification message)
  •         // USER END
  •         break;
  •       case WM_NOTIFICATION_RELEASED:
  •         // USER START (Optionally insert code for reacting on notification message)
  •         // USER END
  •         break;
  •       // USER START (Optionally insert additional code for further notification handling)
  •       // USER END
  •       }
  •       break;
  •     // USER START (Optionally insert additional code for further Ids)
  •     // USER END
  •     }
  •     break;
  •   // USER START (Optionally insert additional message handling)
  •   // USER END
  •   default:
  •     WM_DefaultProc(pMsg);
  •     break;
  •   }
  • }

  • /*********************************************************************
  • *
  • *       Public code
  • *
  • **********************************************************************
  • */
  • /*********************************************************************
  • *
  • *       CreateWindow
  • */
  • WM_HWIN CreateWindow(void);
  • WM_HWIN CreateWindow(void) {
  •   WM_HWIN hWin;

  •   hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  •   return hWin;
  • }

  • // USER START (Optionally insert additional public code)
  • // USER END

  • /*************************** End of file ****************************/

回帖(1)

张丽

2024-5-6 11:12:50
void MainTask(void) {
  GUI_Clear();
  GUI_SetFont( GUI_Font20_1);
  //GUI_DispStringAt("Hello world!", (LCD_GetXSize()-100)/2, (LCD_GetYSize()-20)/2);
  CreateWindows();
        while(1){
                GUI_Delay(10);
        }
}


复制以上代码即可运行,是因为你没有对界面进行刷新. 
举报

更多回帖

发帖
×
20
完善资料,
赚取积分