你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

emWin GUIBuilder做的一个界面在F429I-DISCO上不显示

[复制链接]
Yuancheer 提问时间:2016-2-12 01:02 /
本帖最后由 yuiij 于 2016-2-12 01:04 编辑

用的是STM32Cube_FW_F4_V1.11.0\Projects\STM32F429I-Discovery\Applications\STemWin\STemWin_HelloWorld  这个例程,把builder生成的.c文件加入了工程,然后用生成的一个函数---CreateWindow();替换了MainTask()函数里的代码。编译通过后,下载到板子里,黑屏。调了好长时间,就是什么都不显示。。下面是Builder生成的代码:
  1. /*********************************************************************
  2. *                                                                    *
  3. *                SEGGER Microcontroller GmbH & Co. KG                *
  4. *        Solutions for real time microcontroller applications        *
  5. *                                                                    *
  6. **********************************************************************
  7. *                                                                    *
  8. * C-file generated by:                                               *
  9. *                                                                    *
  10. *        GUI_Builder for emWin version 5.28                          *
  11. *        Compiled Jan 30 2015, 16:41:06                              *
  12. *        (c) 2015 Segger Microcontroller GmbH & Co. KG               *
  13. *                                                                    *
  14. **********************************************************************
  15. *                                                                    *
  16. *        Internet: www.segger.com  Support: support@segger.com       *
  17. *                                                                    *
  18. **********************************************************************
  19. */

  20. // USER START (Optionally insert additional includes)
  21. // USER END

  22. #include "DIALOG.h"

  23. /*********************************************************************
  24. *
  25. *       Defines
  26. *
  27. **********************************************************************
  28. */
  29. #define ID_WINDOW_0 (GUI_ID_USER + 0x06)
  30. #define ID_BUTTON_0 (GUI_ID_USER + 0x07)
  31. #define ID_BUTTON_1 (GUI_ID_USER + 0x08)


  32. // USER START (Optionally insert additional defines)
  33. // USER END

  34. /*********************************************************************
  35. *
  36. *       Static data
  37. *
  38. **********************************************************************
  39. */

  40. // USER START (Optionally insert additional static data)
  41. // USER END

  42. /*********************************************************************
  43. *
  44. *       _aDialogCreate
  45. */
  46. static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
  47.   { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 240, 320, 0, 0x0, 0 },
  48.   { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 78, 136, 80, 20, 0, 0x0, 0 },
  49.   { BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 68, 69, 80, 20, 0, 0x0, 0 },
  50.   // USER START (Optionally insert additional widgets)
  51.   // USER END
  52. };

  53. /*********************************************************************
  54. *
  55. *       Static code
  56. *
  57. **********************************************************************
  58. */

  59. // USER START (Optionally insert additional static code)
  60. // USER END

  61. /*********************************************************************
  62. *
  63. *       _cbDialog
  64. */
  65. static void _cbDialog(WM_MESSAGE * pMsg) {
  66.   int NCode;
  67.   int Id;
  68.   // USER START (Optionally insert additional variables)
  69.   // USER END

  70.   switch (pMsg->MsgId) {
  71.   case WM_NOTIFY_PARENT:
  72.     Id    = WM_GetId(pMsg->hWinSrc);
  73.     NCode = pMsg->Data.v;
  74.     switch(Id) {
  75.     case ID_BUTTON_0: // Notifications sent by 'Button'
  76.       switch(NCode) {
  77.       case WM_NOTIFICATION_CLICKED:
  78.         // USER START (Optionally insert code for reacting on notification message)
  79.         // USER END
  80.         break;
  81.       case WM_NOTIFICATION_RELEASED:
  82.         // USER START (Optionally insert code for reacting on notification message)
  83.         // USER END
  84.         break;
  85.       // USER START (Optionally insert additional code for further notification handling)
  86.       // USER END
  87.       }
  88.       break;
  89.     case ID_BUTTON_1: // Notifications sent by 'Button'
  90.       switch(NCode) {
  91.       case WM_NOTIFICATION_CLICKED:
  92.         // USER START (Optionally insert code for reacting on notification message)
  93.         // USER END
  94.         break;
  95.       case WM_NOTIFICATION_RELEASED:
  96.         // USER START (Optionally insert code for reacting on notification message)
  97.         // USER END
  98.         break;
  99.       // USER START (Optionally insert additional code for further notification handling)
  100.       // USER END
  101.       }
  102.       break;
  103.     // USER START (Optionally insert additional code for further Ids)
  104.     // USER END
  105.     }
  106.     break;
  107.   // USER START (Optionally insert additional message handling)
  108.   // USER END
  109.   default:
  110.     WM_DefaultProc(pMsg);
  111.     break;
  112.   }
  113. }

  114. /*********************************************************************
  115. *
  116. *       Public code
  117. *
  118. **********************************************************************
  119. */
  120. /*********************************************************************
  121. *
  122. *       CreateWindow
  123. */
  124. WM_HWIN CreateWindow(void);
  125. WM_HWIN CreateWindow(void) {
  126.   WM_HWIN hWin;

  127.   hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
  128.   return hWin;
  129. }

  130. // USER START (Optionally insert additional public code)
  131. // USER END

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

替换MainTask里的代码

替换MainTask里的代码
收藏 评论6 发布时间:2016-2-12 01:02

举报

6个回答
mark0668 回答时间:2016-2-12 23:10:38
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);
        }
}


复制以上代码即可运行,是因为你没有对界面进行刷新.
feiting94 回答时间:2016-2-12 09:10:24
MainTask() 函数不能删掉的, 你的 主函数应该调用的是 MainTask();
然后MainTask() 改为调用 CreateWindow()
Yuancheer 回答时间:2016-2-12 09:53:54
feiting94 发表于 2016-2-12 09:10
MainTask() 函数不能删掉的, 你的 主函数应该调用的是 MainTask();
然后MainTask() 改为调用 CreateWindow ...

是的,我没动main函数里的代码,就是把Create Window放在MainTask里调用的。
zcl201207 回答时间:2016-2-12 23:09:31
modu8888 回答时间:2017-9-27 09:06:39
请问楼主:我没有用操作系统,在main.c中先声明,再调用,也出不来啊。

声明:
extern WM_HWIN CreateFramewin(void);

调用:
        CreateFramewin();
modu8888 回答时间:2017-9-27 12:23:01
搞清楚了。原来需要在主循环中添加GUI_Delay(M)。据说目的是运行GUI_Exec()。
关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版