Hi.
I want to use multi page on a 480*320 lcd.
so edited a demo of multipage... but with FRAMEWIN_AddMinButton() after two (or more\less) times minimize and reopening the window emwin hangs (?) and stops working!
this is my code:
Display All
in line 119 I defined a bmp for background (with size of 480*320). by removing this line everything goes OK!
my MCU has 132 KB of RAM.. if I use an MCU with 190 or 260 KB of RAM the problem can be solved? is there any solution?
thanks.
Sora.
I want to use multi page on a 480*320 lcd.
so edited a demo of multipage... but with FRAMEWIN_AddMinButton() after two (or more\less) times minimize and reopening the window emwin hangs (?) and stops working!
this is my code:
C Source Code
- #include "main.h"
- #include <stdlib.h>
- #include "GUI.h"
- #include "MULTIPAGE.h"
- #include <stdio.h>
- #include "fatfs.h"
- #define ID_BUTTON_0 (GUI_ID_USER + 0x06)
- #define ID_BUTTON_1 (GUI_ID_USER + 0x07)
- extern FATFS myFATFS;
- extern FIL myFILE;
- extern int size;
- uint8_t shomar, shomarconfirm = 0;
- uint16_t CNTold = 0;
- char chr[20];
- WM_HWIN hItemtext;
- void _DemoMultiPage(void);
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate3[] = {
- { WINDOW_CreateIndirect, "Dialog 3", 0, 0, 0, 190, 280, FRAMEWIN_CF_MOVEABLE },
- { RADIO_CreateIndirect, "", GUI_ID_RADIO0, 5, 30, 0, 0, 0, 3},
- { TEXT_CreateIndirect, "Option 1", GUI_ID_TEXT0, 25, 30, 50, 15, TEXT_CF_LEFT },
- { TEXT_CreateIndirect, "Option 2", GUI_ID_TEXT1, 25, 50, 50, 15, TEXT_CF_LEFT },
- { TEXT_CreateIndirect, "Option 3", GUI_ID_TEXT2, 25, 70, 50, 15, TEXT_CF_LEFT },
- { TEXT_CreateIndirect, "Dialog 3", 0, 5, 10, 50, 20, TEXT_CF_LEFT }
- };
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate4[] = {
- { WINDOW_CreateIndirect, "Dialog 4", 0, 0, 0, 190, 280, FRAMEWIN_CF_MOVEABLE },
- { MULTIEDIT_CreateIndirect, "Text", GUI_ID_MULTIEDIT0, 5, 30, 180, 100 },
- { BUTTON_CreateIndirect, "+1", ID_BUTTON_0, 10, 170, 80, 80, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "-1", ID_BUTTON_1, 100, 170, 80, 80, 0, 0x0, 0 },
- { TEXT_CreateIndirect, "Dialog 4", 0, 5, 10, 50, 20, TEXT_CF_LEFT }
- };
- static void _cbDialog3(WM_MESSAGE * pMsg) {
- WM_HWIN hDlg;
- hDlg = pMsg->hWin;
- switch (pMsg->MsgId) {
- default:
- WM_DefaultProc(pMsg);
- }
- }
- /*********************************************************************
- *
- * _cbDialog4
- */
- static void _cbDialog4(WM_MESSAGE * pMsg) {
- int NCode;
- int Id;
- WM_HWIN hDlg, hItem;
- hDlg = pMsg->hWin;
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- hItemtext = WM_GetDialogItem(hDlg, GUI_ID_MULTIEDIT0);
- MULTIEDIT_SetText(hItemtext, "MULTIEDIT widget");
- MULTIEDIT_SetInsertMode(hItemtext, 1);
- break;
- 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)
- shomar++;
- // 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)
- shomar--;
- // 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;
- default:
- WM_DefaultProc(pMsg);
- }
- }
- /*********************************************************************
- *
- * _cbBkWindow
- *
- * Purpose:
- * Callback routine of the background window, shows the sample title and draws the background
- */
- static void _cbBkWindow(WM_MESSAGE* pMsg) {
- switch (pMsg->MsgId) {
- case WM_PAINT:
- f_mount(&myFATFS, SDPath, 1);
- f_open(&myFILE, "asuka2.bmp", FA_READ);
- size = f_size(&myFILE);
- GUI_BMP_DrawEx(APP_GetData, &myFILE, 0, 0);
- f_close(&myFILE);
- //GUI_Clear();
- //GUI_SetColor(GUI_WHITE);
- //GUI_SetFont(GUI_FONT_20B_ASCII);
- //GUI_DispStringHCenterAt("WIDGET_Multipage - Sample", 160, 5);
- break;
- default:
- WM_DefaultProc(pMsg);
- }
- }
- /*********************************************************************
- *
- * _cbFrameWin
- *
- * Purpose:
- * Callback routine of the frame window behind the MULTIPAGE widget
- */
- static void _cbFrameWin(WM_MESSAGE* pMsg) {
- switch (pMsg->MsgId) {
- case WM_PAINT:
- GUI_Clear();
- GUI_SetColor(GUI_WHITE);
- GUI_SetFont(&GUI_Font24_ASCII);
- //GUI_DispStringHCenterAt("WIDGET_Multipage - Sample", 160, 5);
- break;
- default:
- WM_DefaultProc(pMsg);
- }
- }
- /*********************************************************************
- *
- * _DemoMultiPage
- *
- * Purpose:
- * Demonstrates the use of a multipage widget
- */
- void _DemoMultiPage(void) {
- WM_HWIN hMultiPage, hFrameWin, hDialog;
- /* Enable use of memory devices */
- WM_SetCreateFlags(WM_CF_MEMDEV);
- WM_EnableMemdev(WM_HBKWIN);
- WM_SetCallback(WM_HBKWIN, &_cbBkWindow); /* Use own callback routine for background window */
- /* Create the frame window */
- hFrameWin = FRAMEWIN_Create("FrameWindow", &_cbFrameWin, WM_CF_SHOW, 140, 10, 200, 300);
- //FRAMEWIN_SetClientColor(hFrameWin, GUI_GREEN);
- FRAMEWIN_SetActive(hFrameWin, 1);
- FRAMEWIN_AddMinButton(hFrameWin, FRAMEWIN_BUTTON_RIGHT, 0);
- //FRAMEWIN_SetMoveable(hFrameWin, 1);
- /* Create the MULTIPAGE widget */
- hMultiPage = MULTIPAGE_CreateEx(0, 0, 190, 280, WM_GetClientWindow(hFrameWin), WM_CF_SHOW, 0, 0);
- GUI_COUNTOF(_aDialogCreate3),
- &_cbDialog3, WM_UNATTACHED, 0, 0);
- MULTIPAGE_AddPage(hMultiPage, hDialog, "Page 3");
- GUI_Delay(10);
- hDialog = GUI_CreateDialogBox(_aDialogCreate4,
- GUI_COUNTOF(_aDialogCreate4),
- &_cbDialog4, WM_UNATTACHED, 0, 0);
- MULTIPAGE_AddPage(hMultiPage, hDialog, "Home");
- while (1) {
- GUI_Exec();
- sprintf(chr, "%d", shomar);
- MULTIEDIT_SetText(hItemtext, chr);
- }
- }
- void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
- {
- if(GPIO_Pin == RE_Flag_Pin)
- {
- if((TIM9->CNT - CNTold) > 100 & shomarconfirm == 0)
- {
- shomar++;
- shomarconfirm = 1;
- }
- else shomarconfirm = 0;
- CNTold = TIM9->CNT;
- }
- if(GPIO_Pin == RE_EXT_Pin)
- {
- if((TIM9->CNT - CNTold) > 100 & shomarconfirm == 0)
- {
- shomar--;
- shomarconfirm = 1;
- }
- else shomarconfirm = 0;
- CNTold = TIM9->CNT;
- }
- }
my MCU has 132 KB of RAM.. if I use an MCU with 190 or 260 KB of RAM the problem can be solved? is there any solution?
thanks.
Sora.