/******************************************************************* * * _DemoSetDesktopColor Demonstrates the use of WM_SetDesktopColor */ static void _DemoSetDesktopColor(void) { GUI_SetBkColor(GUI_BLUE); GUI_Clear(); _DrawInfoText("WM_SetDesktopColor()"); GUI_Delay(SPEED*3/2); WM_SetDesktopColor(GUI_BLACK); GUI_Delay(SPEED/2); /* Set background color and invalidate desktop color. This is needed for the later redrawing demo. */ GUI_SetBkColor(GUI_BLACK); WM_SetDesktopColor(GUI_INVALID_COLOR); }
/********************************************************************* * * GUIDEMO_DemoFrameWin */ void GUIDEMO_DemoFrameWin(void) { FRAMEWIN_Handle hFrame; LISTBOX_Handle hListBox; int xSize = LCD_GetXSize(); int ySize = LCD_GetYSize(); int i, x, y, w, h; const GUI_FONT* pFont = &GUI_FontComic18B_1; GUI_COLOR DesktopColorOld; #if GUIDEMO_LARGE GUIDEMO_ShowIntro("Frame Window & Listbox", NULL); #else GUIDEMO_ShowIntro("Frame Window\n & Listbox", NULL); #endif DesktopColorOld = GUIDEMO_SetBkColor(GUI_RED); DesktopColorOld = WM_SetDesktopColor(DesktopColorOld); /* Automatically update desktop window */ x = BORDER; #if GUIDEMO_LARGE y = 75; #else y = BORDER; #endif w = xSize - x - BORDER; h = ySize - y - BORDER; if (w > 140) { w = 140; } if (h > 120) { h = 120; } hFrame = FRAMEWIN_Create("Select language", NULL, WM_CF_SHOW, x, y, w, h); FRAMEWIN_SetActive(hFrame, 1); FRAMEWIN_SetMoveable(hFrame, 1); FRAMEWIN_AddMaxButton(hFrame, FRAMEWIN_BUTTON_RIGHT, 0); FRAMEWIN_AddMinButton(hFrame, FRAMEWIN_BUTTON_RIGHT, 1); FRAMEWIN_SetFont(hFrame, &GUI_Font13_ASCII); hListBox = LISTBOX_CreateAsChild(_asLang, WM_GetClientWindow(hFrame), 0, 0, 0, 0, WM_CF_SHOW | WM_SF_ANCHOR_LEFT | WM_SF_ANCHOR_TOP | WM_SF_ANCHOR_RIGHT | WM_SF_ANCHOR_BOTTOM); WM_SetFocus(hListBox); LISTBOX_SetFont(hListBox, pFont); GUIDEMO_Wait(); for (i = 0; (i < 10) && !GUIDEMO_CheckCancel(); i++) { LISTBOX_IncSel(hListBox); GUIDEMO_Delay(250); } for (i = 0; (i < 10) && !GUIDEMO_CheckCancel(); i++) { LISTBOX_DecSel(hListBox); GUIDEMO_Delay(250); } GUIDEMO_Delay(500); LISTBOX_Delete(hListBox); FRAMEWIN_Delete(hFrame); WM_SetDesktopColor(DesktopColorOld); }
void GUIDEMO_Messagebox(void) { GUI_COLOR Color; GUIDEMO_ShowIntro("Message boxes", "Message boxes" "\ncan easily be created"); Color = WM_SetDesktopColor(GUI_RED); GUI_MessageBox("Message", "Text", 0); GUI_Delay(1000); GUI_MessageBox("2. Message", "Text", 0); GUI_Delay(1000); WM_SetDesktopColor(Color); GUIDEMO_NotifyStartNext(); }
/********************************************************************* * * MainTask * ********************************************************************** */ void customer(WM_MESSAGE * pMsg) { current_interface = PORTABLE_CUSTOMER; if(pMsg) { WM_DeleteWindow(pMsg->hWin); #if 0 WM_HideWindow(pMsg->hWin); #endif } WM_SetDesktopColor(GUI_WHITE); /* Automacally update desktop window */ WM_SetCreateFlags(WM_CF_MEMDEV); /* Use memory devices on all windows to avoid flicker */ //PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX); //FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX); //PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX); //BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX); //CHECKBOX_SetDefaultSkin(CHECKBOX_SKIN_FLEX); //DROPDOWN_SetDefaultSkin(DROPDOWN_SKIN_FLEX); //SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX); //SLIDER_SetDefaultSkin(SLIDER_SKIN_FLEX); //HEADER_SetDefaultSkin(HEADER_SKIN_FLEX); //RADIO_SetDefaultSkin(RADIO_SKIN_FLEX); current_handle = GUI_CreateDialogBox(_aDialogCreate_Cus, GUI_COUNTOF(_aDialogCreate_Cus), &_cbCallback_Cus, 0, 0, 0); h_cus = current_handle; }
portTASK_FUNCTION(vLcdTask, pvParameters) { lcdInit( (uint32_t)&_aVRAM[0]); GUI_Init(); WM_SetDesktopColor(GUI_GREEN); WM_SetCreateFlags(WM_CF_MEMDEV); // hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0); /* Create Mutex lock*/ //M vCardUID( Card_Type, bUid); //M vCardDisplay( ); while ( 1 ) { while( xSemaphoreTake(xSemaDataAvail, portMAX_DELAY ) != pdTRUE ); if( Card_Type[0] ) {//M vCardUID( Card_Type, bUid); //M vCardDisplay( ); if( vCardPresent ) vCardDisplay( ); else vCardUID( Card_Type, bUid, nCardDetected, nCardPrevious); } else vCardReset( ); xSemaphoreGive( xSemaGUIend ); // GUI_Delay(10); vTaskDelay( 10 ); } }
/********************************************************************* * * MainTask */ void MainTask(void) { GUI_Init(); WM_SetDesktopColor(0xB00000); GUI_Exec(); while(1) { _DemoDropDown(); _DemoDropDownAsChild(); } }
void MainTask(void) { GUI_Init(); WM_SetDesktopColor(0xB00000); GUI_Exec(); while(1) { _DemoListBox(); _DemoListBoxAsChild(); } }
/********************************************************************* * * GUIDEMO_Dialog */ void GUIDEMO_Dialog(void) { int i; WM_HWIN hWin; GUI_COLOR DesktopColorOld; GUIDEMO_ShowIntro("Dialog boxes", "\nDialog boxes\ncan easily be created"); GUIDEMO_HideInfoWin(); DesktopColorOld = GUIDEMO_SetBkColor(GUI_RED); DesktopColorOld = WM_SetDesktopColor(DesktopColorOld); /* Automatically update desktop window */ hWin = GUI_CreateDialogBox(aDialogCreate, GUI_COUNTOF(aDialogCreate), _cbCallback, 0, 0, 0); for (i = 0; i < GUI_COUNTOF(_aID); i++) { GUIDEMO_Delay(_aID[i].Time); GUI_SendKeyMsg(_aID[i].Id, 1); } #if !(GUIDEMO_TINY) #if !(GUIDEMO_LARGE) if (LCD_GetYSize() < 120) { } else #endif { GUIDEMO_Delay(1000); for (i = 0; i <= 100; i += 10) { if (WM_IsWindow(hWin)) { SLIDER_SetValue(WM_GetDialogItem(hWin, GUI_ID_SLIDER0), i); } GUIDEMO_Delay(100); } } #endif GUIDEMO_Delay(800); if (WM_IsWindow(hWin)) { WM_MoveTo(hWin, 20, 20); GUIDEMO_Delay(500); } if (WM_IsWindow(hWin)) { WM_MoveTo(hWin, 60, 20); GUIDEMO_Delay(800); } /* Cleanup ... */ if (WM_IsWindow(hWin)) { WM_DeleteWindow(hWin); } GUIDEMO_NotifyStartNext(); WM_SetDesktopColor(DesktopColorOld); /* Restore old settings */ }
/********************************************************************* * * GUIDEMO_Dialog */ void GUIDEMO_Dialog(void) { int i; WM_HWIN hWin; GUI_COLOR DesktopColorOld; GUIDEMO_ShowIntro("Dialog boxes", "\nDialog boxes\ncan easily be created"); GUIDEMO_HideInfoWin(); DesktopColorOld = WM_SetDesktopColor(GUI_RED); /* Automatically update desktop window */ hWin = GUI_CreateDialogBox(aDialogCreate, GUI_COUNTOF(aDialogCreate), _cbCallback, 0, 0, 0); for (i = 0; i < GUI_COUNTOF(_aID); i++) { GUIDEMO_Delay(_aID[i].Time); GUI_SendKeyMsg(_aID[i].Id, 1); /* 把消息发送至指定键,把键盘数据发送到输入焦点所在窗口,1表示放开状态 */ } #if !(GUIDEMO_TINY) #if !(GUIDEMO_LARGE) if (LCD_GetYSize() < 120) { } else #endif { GUIDEMO_Delay(1000); for (i = 0; i <= 100; i += 10) { if (WM_IsWindow(hWin)) { /* 确定指定句柄是否是有效的窗口句柄,0:句柄不是有效的窗口句柄,1:句柄是有效的窗口句柄 */ SLIDER_SetValue(WM_GetDialogItem(hWin, GUI_ID_SLIDER0), i); /* 返回对话框项目(小工具)的窗口句柄, 设置滑动条的当前值 */ } GUIDEMO_Delay(100); } } #endif GUIDEMO_Delay(800); if (WM_IsWindow(hWin)) { WM_MoveTo(hWin, 20, 20); /* 将指定窗口移动到某个位置。 */ GUIDEMO_Delay(500); } if (WM_IsWindow(hWin)) { WM_MoveTo(hWin, 60, 20); GUIDEMO_Delay(800); } /* Cleanup ... */ if (WM_IsWindow(hWin)) { WM_DeleteWindow(hWin); /* 删除窗口。 */ } GUIDEMO_NotifyStartNext(); WM_SetDesktopColor(DesktopColorOld); /* Restore old settings */ }
/********************************************************************* * * MainTask */ void MainTask(void) { int Index; GUI_Init(); // // Check if recommended memory for the sample is available // if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) { GUI_ErrorOut("Not enough memory available."); return; } #if GUI_SUPPORT_MEMDEV WM_SetCreateFlags(WM_CF_MEMDEV); #endif WM_SetDesktopColor(GUI_BLACK); // // Initialize the temperature arrays // _InitRandomData(_aTemp1, GUI_COUNTOF(_aTemp1)); _InitRandomData(_aTemp2, GUI_COUNTOF(_aTemp2)); // // Execute the intro dialog // GUI_ExecDialogBox(_aDialogIntro, GUI_COUNTOF(_aDialogIntro), _cbDialogIntro, WM_HBKWIN, 0, 0); // // Execute the color and the temperature dialog // _hDialogColor = GUI_CreateDialogBox(_aDialogColor, GUI_COUNTOF(_aDialogColor), _cbDialogColor, WM_HBKWIN, 0, 0); _hDialogMain = GUI_CreateDialogBox(_aDialogMain, GUI_COUNTOF(_aDialogMain), _cbDialogMain, WM_HBKWIN, 0, 0); // // Add new temperatures... // Index = GUI_COUNTOF(_aTemp1) - 1; while (1) { WM_HWIN hItem; GUI_Delay(100); // Wait a while // // Shift the color arrays // memmove(_aTemp1, _aTemp1 + 1, sizeof(_aTemp1) - 2); memmove(_aTemp2, _aTemp2 + 1, sizeof(_aTemp2) - 2); // // Add new values // _aTemp1[Index] = _GetRandomValue(_aTemp1[Index - 1]); _aTemp2[Index] = _GetRandomValue(_aTemp2[Index - 1]); // // Update windows // hItem = WM_GetClientWindow(WM_GetDialogItem(_hDialogMain, ID_TEMPERATURE)); WM_InvalidateWindow(hItem); _SetProgbarValue(GUI_ID_PROGBAR0, _aTemp1[Index]); _SetProgbarValue(GUI_ID_PROGBAR1, _aTemp2[Index]); } }
void vCardDisplay( void ) { char fullname[64]; if( empty == 2 ) return; WM_SetDesktopColor(GUI_WHITE); GUI_SetColor(GUI_BLACK); GUI_SetBkColor(GUI_WHITE); GUI_Clear(); GUI_GIF_Draw((const void *)aclogo_silica_11022010, sizeof(aclogo_silica_11022010), 100, 0); strcpy( fullname, data->nameFirstname ); strcat( fullname, " " ); strcat( fullname, data->nameLastname ); GUI_SetFont(&GUI_Font24B_ASCII); GUI_DispStringAt( fullname, 20, 70); GUI_SetFont(&GUI_Font16B_ASCII); GUI_DispStringAt( data->CompName, 20, X_firm); GUI_SetFont(&GUI_Font13_ASCII); GUI_DispStringAt( data->CompStreet, 20, X_firm+16); GUI_DispStringAt( data->CompCity, 20, X_firm+16+13); strcpy( fullname, data->CompZip ); strcat( fullname, " " ); strcat( fullname, data->CompState ); strcat( fullname, " " ); strcat( fullname, data->CompCountry ); GUI_DispStringAt( fullname, 20, X_firm+16+13+13); strcpy( fullname, "TEL : " ); strcat( fullname, data->CompPhone ); GUI_DispStringAt( fullname, 20, X_tel); strcpy( fullname, "FAX : " ); strcat( fullname, data->CompFax ); GUI_DispStringAt( fullname, 20, X_tel+13); strcpy( fullname, "CELL : " ); strcat( fullname, data->ContactCellPho ); GUI_DispStringAt( fullname, 20, X_tel+13+13); GUI_SetColor( (GUI_COLOR)0x007f7f7f ); GUI_FillRect( 0, 214, 319, 239 ); GUI_SetBkColor((GUI_COLOR)0x007f7f7f); GUI_SetColor(GUI_RED); GUI_SetFont(&GUI_Font16B_ASCII); GUI_DispStringAt( "The Engineering of Distribution.", 20, 220); empty = 2; }
void MainTask(void) { int Cnt = 0; WM_HWIN hDlg, hGraph = 0; GUI_Init(); GUI_CURSOR_Show(); WM_SetDesktopColor(GUI_BLACK); #if GUI_SUPPORT_MEMDEV WM_SetCreateFlags(WM_CF_MEMDEV); #endif hDlg = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0); while (1) { GUI_Delay(10); } }
void MainTask(void) { GUI_Init(); /* Use memory devices for all windows */ WM_SetCreateFlags(WM_CF_MEMDEV); WM_EnableMemdev(WM_HBKWIN); WM_SetDesktopColor(GUI_GREEN); while(1) { _Font = 0; _Color = 0; _pcbCallback = 0; GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbDialog, 0, 0, 0); GUI_Delay(1000); } }
/******************************************************************* * * _DemoTransWindow */ static void _DemoTransWindow(void) { WM_HWIN hTransWin; WM_HWIN hFrameWin; WM_SetDesktopColor(GUI_RED); hTransWin = WM_CreateWindow(10, 10, 72, 52, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_STAYONTOP, _cbTransWindow, 0); hFrameWin = FRAMEWIN_Create("Framewin", 0, WM_CF_SHOW, 100, 70, 120, 100); FRAMEWIN_SetActive(hFrameWin, 1); FRAMEWIN_SetMoveable(hFrameWin, 1); GUI_CURSOR_Show(); while (1) { WM_InvalidateWindow(hTransWin); GUI_Delay(20); } }
void MainTask(void) { int XSize, YSize; #if GUI_SUPPORT_MEMDEV WM_SetCreateFlags(WM_CF_MEMDEV); #endif GUI_Init(); XSize = LCD_GetXSize(); YSize = LCD_GetYSize(); GUI_DrawBitmap(&bmLogoBitmap, (XSize - bmLogoBitmap.XSize) / 2, (YSize - bmLogoBitmap.YSize) / 3); GUI_SetFont(&GUI_Font24B_ASCII); GUI_DispStringHCenterAt("www.segger.com", XSize / 2, (YSize - bmLogoBitmap.YSize) / 3 + bmLogoBitmap.YSize + 10); GUI_Delay(1000); WM_SetDesktopColor(GUI_BLACK); /* Not required since desktop is not visible */ GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbCallback, 0, 0, 0); }
/********************************************************************* * * MainTask */ void MainTask(void) { int Index; GUI_Init(); #if GUI_SUPPORT_MEMDEV WM_SetCreateFlags(WM_CF_MEMDEV); #endif WM_SetDesktopColor(GUI_BLACK); // // Initialize the temperature arrays // _InitRandomData(_aTemp1, GUI_COUNTOF(_aTemp1)); _InitRandomData(_aTemp2, GUI_COUNTOF(_aTemp2)); // // Execute the intro dialog // GUI_ExecDialogBox(_aDialogIntro, GUI_COUNTOF(_aDialogIntro), _cbDialogIntro, WM_HBKWIN, 0, 0); // // Execute the color and the temperature dialog // _hDialogColor = GUI_CreateDialogBox(_aDialogColor, GUI_COUNTOF(_aDialogColor), _cbDialogColor, WM_HBKWIN, 0, 0); _hDialogMain = GUI_CreateDialogBox(_aDialogMain, GUI_COUNTOF(_aDialogMain), _cbDialogMain, WM_HBKWIN, 0, 0); // // Add new temperatures... // Index = GUI_COUNTOF(_aTemp1) - 1; while (1) { WM_HWIN hItem; GUI_Delay(100); // Wait a while // // Shift the color arrays // memmove(_aTemp1, _aTemp1 + 1, sizeof(_aTemp1) - 2); memmove(_aTemp2, _aTemp2 + 1, sizeof(_aTemp2) - 2); // // Add new values // _aTemp1[Index] = _GetRandomValue(_aTemp1[Index - 1]); _aTemp2[Index] = _GetRandomValue(_aTemp2[Index - 1]); // // Update windows // hItem = WM_GetClientWindow(WM_GetDialogItem(_hDialogMain, ID_TEMPERATURE)); WM_InvalidateWindow(hItem); _SetProgbarValue(GUI_ID_PROGBAR0, _aTemp1[Index]); _SetProgbarValue(GUI_ID_PROGBAR1, _aTemp2[Index]); } }
/********************************************************************* * * MainTask * ********************************************************************** */ void LimitSpeedT(WM_MESSAGE * pMsg) { current_interface = PORTABLE_LIMIT_SPEED_T; if(pMsg) { WM_DeleteWindow(pMsg->hWin); flag_paint = 0; } WM_SetDesktopColor(GUI_BLACK); /* Automacally update desktop window */ WM_SetCreateFlags(WM_CF_MEMDEV); /* Use memory devices on all windows to avoid flicker */ current_handle = GUI_CreateDialogBox(_aDialogCreate_LimT, GUI_COUNTOF(_aDialogCreate_LimT), &_cbCallback_LimT, 0, 0, 0); }
/********************************************************************* * * MainTask */ void MainTask(void) { GUI_Init(); // // Use memory devices for all windows // #if GUI_SUPPORT_MEMDEV WM_SetCreateFlags(WM_CF_MEMDEV); WM_EnableMemdev(WM_HBKWIN); #endif WM_SetDesktopColor(GUI_GREEN); while(1) { _Font = _Color = 0; GUI_ExecDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), &_cbDialog, 0, 0, 0); GUI_Delay(1000); } }
/********************************************************************* * * MainTask * ********************************************************************** */ void home(WM_MESSAGE * pMsg) { current_interface = HOME; if(pMsg) { WM_DeleteWindow(pMsg->hWin); #if 0 WM_HideWindow(pMsg->hWin); #endif } WM_SetDesktopColor(GUI_WHITE); /* Automacally update desktop window */ WM_SetCreateFlags(WM_CF_MEMDEV); /* Use memory devices on all windows to avoid flicker */ current_handle = GUI_CreateDialogBox(_aDialogCreate_Home, GUI_COUNTOF(_aDialogCreate_Home), &_cbCallback_Home, 0, 0, 0); h_home = current_handle; }
void vCardUID( char *cardType, uint8_t *bUidPresent, uint8_t *nCardDetected, uint8_t *nCardPrevious ){ char msg[20]; /* if( empty == 1 || empty == 2 ) { // to trovato almeno una vCard return; }*/ if (nCardDetected==nCardPrevious){ return; } WM_SetDesktopColor(GUI_BLACK); GUI_SetBkColor(GUI_BLACK); GUI_SetColor(GUI_GREEN); GUI_Clear(); // GUI_SetFont(&GUI_Font32B_ASCII); // GUI_DispStringAt( cardType, 120-strlen(cardType)*10/2, 20); if( bUidPresent != NULL ) { int i=0; for (i=0;i<nCardDetected;i++){ sprintf( msg, "UID %02X : %02X%02X%02X%02X", i+1, bUidPresent[4*i+0], bUidPresent[4*i+1], bUidPresent[4*i+2], bUidPresent[4*i+3] ); GUI_DispStringAt( msg, 0, 20*i+20); } /* sprintf( msg, "UID 01 : %02X%02X%02X%02X", bUidPresent[0], bUidPresent[1], bUidPresent[2], bUidPresent[3] ); GUI_DispStringAt( msg, 0, 80); sprintf( msg, "UID 02 : %02X%02X%02X%02X", bUidPresent[4], bUidPresent[5], bUidPresent[6], bUidPresent[7] ); GUI_DispStringAt( msg, 0, 120); */ } GUI_SetColor( (GUI_COLOR)0x003f3f3f ); GUI_FillRect( 0, 214, 319, 239 ); GUI_SetBkColor((GUI_COLOR)0x003f3f3f); GUI_SetColor(GUI_RED); GUI_SetFont(&GUI_Font24B_ASCII); GUI_DispStringAt( "Reading Card", 80, 215); empty = 1; }
/********************************************************************* * * MainTask * ********************************************************************** */ void LimitSpeedH(WM_MESSAGE * pMsg) { WM_HWIN hGraph = 0; if(pMsg) { WM_DeleteWindow(pMsg->hWin); } WM_SetDesktopColor(GUI_WHITE); /* Automacally update desktop window */ WM_SetCreateFlags(WM_CF_MEMDEV); /* Use memory devices on all windows to avoid flicker */ //PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX); //FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX); //PROGBAR_SetDefaultSkin(PROGBAR_SKIN_FLEX); //BUTTON_SetDefaultSkin(BUTTON_SKIN_FLEX); //CHECKBOX_SetDefaultSkin(CHECKBOX_SKIN_FLEX); //DROPDOWN_SetDefaultSkin(DROPDOWN_SKIN_FLEX); //SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX); //SLIDER_SetDefaultSkin(SLIDER_SKIN_FLEX); //HEADER_SetDefaultSkin(HEADER_SKIN_FLEX); //RADIO_SetDefaultSkin(RADIO_SKIN_FLEX); current_handle = GUI_CreateDialogBox(_aDialogCreate_Lim, GUI_COUNTOF(_aDialogCreate_Lim), &_cbCallback_Lim, 0, 0, 0); current_interface = PORTABLE_LIMIT_SPEED; }
void vCardReset( void ){ /* if( empty == 0 ) { return; } */ WM_SetDesktopColor(GUI_BLACK); GUI_SetBkColor(GUI_BLACK); GUI_SetColor(GUI_GREEN); //GUI_Clear(); GUI_SetFont(&GUI_Font32B_ASCII); GUI_DispStringAt( "NESSUNA", 120-7*10/2, 50); GUI_DispStringAt( "MEDICINA", 120-7*10/2, 80); GUI_DispStringAt( "PRESENTE", 120-7*10/2, 110); showTime(NULL, NULL, NULL, NULL); empty = 0; }
/********************************************************************* * * MainTask */ void MainTask(void) { GUI_Init(); WM_SetDesktopColor(GUI_BLUE); //!< SetDesktopColor /* The First window to display the Temperature Curve */ { hWM_HBKWIN_CURVE = WM_CreateWindow(0,0,400,240,WM_CF_SHOW | WM_CF_MEMDEV ,0,0); btn = BUTTON_CreateAsChild(315, 10, 75, 35,hWM_HBKWIN_CURVE, ID_CURVE_BTN_SWTITCH_2_PARA, WM_CF_SHOW); btnClear = BUTTON_CreateAsChild(315, 60, 75, 35,hWM_HBKWIN_CURVE, 202, WM_CF_SHOW); /** PWM Edit **/ { /* Edit to display the PWM1 */ Edit_PWM1 = EDIT_CreateEx (370, 170, 25, 20,hWM_HBKWIN_CURVE, WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_PWM1, 3); EDIT_SetDecMode(Edit_PWM1,0,0,255,0,0); EDIT_SetValue(Edit_PWM1,0); /* Edit to display the PWM2 */ Edit_PWM2 = EDIT_CreateEx (370, 190, 25, 20,hWM_HBKWIN_CURVE, WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_PWM2, 3); EDIT_SetDecMode(Edit_PWM2,0,0,255,0,0); EDIT_SetValue(Edit_PWM2,0); /* Edit to display the PWM3 */ Edit_PWM3 = EDIT_CreateEx (370, 210, 25, 20,hWM_HBKWIN_CURVE, WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_PWM3, 3); EDIT_SetDecMode(Edit_PWM3,0,0,255,0,0); EDIT_SetValue(Edit_PWM3,0); } // Set Callback function for background window WM_SetCallback(hWM_HBKWIN_CURVE, _cbBk); } { hWM_HBKWIN_CFG_PID = WM_CreateWindow(0,0,400,240,WM_CF_HIDE | WM_CF_MEMDEV ,0,0); //Add the | WM_CF_MEMDEV flah btn1 = BUTTON_CreateAsChild(320, 30 , 60, 35,hWM_HBKWIN_CFG_PID, ID_CFG_PID_BTN_SWTITCH_2_CURVE, WM_CF_SHOW); btnClear1 = BUTTON_CreateAsChild(320, 75, 60, 35,hWM_HBKWIN_CFG_PID, 203, WM_CF_SHOW); BUTTON_SetText(btn1,"PID_Set"); BUTTON_SetText(btnClear1,"Back"); BUTTON_SetText(btn ,"Running"); BUTTON_SetText(btnClear,"PID_Set"); WM_SetCallback(hWM_HBKWIN_CFG_PID, _cbBk_CFG_PID); } //!< Create a graph widget { hGraph = GRAPH_CreateEx(8, 10, 300, 220, hWM_HBKWIN_CURVE, WM_CF_SHOW | WM_CF_CONST_OUTLINE | WM_CF_MEMDEV_ON_REDRAW , 0, 100); //GRAPH_DATA_YT_MirrorX(hGraph , 1); //!< Create a YT_data hData = GRAPH_DATA_YT_Create(GUI_BLUE, 292,0, 0); // Set the MaxItemNum to 0 hData2 = GRAPH_DATA_YT_Create(GUI_RED,292,0,0); GRAPH_AttachData(hGraph, hData); //!< Attach the data to graph GRAPH_AttachData(hGraph, hData2); //!< Attach the data to graph } WM_ShowWindow(hWM_HBKWIN_CURVE); WM_HideWindow(hWM_HBKWIN_CFG_PID); /* WM_BringToTop(hWM_HBKWIN); WM_BringToBottom(hWM_HBKWIN_CFG_PID); WM_MoveTo(hWM_HBKWIN_CFG_PID,400,240); WM_ResizeWindow(hWM_HBKWIN_CFG_PID,1,1); */ #ifdef PWM_TEXT /** PWM Text **/ { /* Edit to display the PWM1 */ Text_PWM1 = TEXT_CreateEx (310, 170, 30, 20,hWM_HBKWIN_CURVE, WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_TXT_PWM1, "PMW1"); /* Edit to display the PWM2 */ Text_PWM2 = TEXT_CreateEx (310, 190, 30, 20,hWM_HBKWIN_CURVE, WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_TXT_PWM2, "PWM2"); /* Edit to display the PWM3 */ Text_PWM3 = TEXT_CreateEx (310, 210, 30, 20,hWM_HBKWIN_CURVE, WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_TXT_PWM3, "PWM3"); } #endif #ifdef EDIT_AD { /* Edit to display the AD1 */ Edit_AD1 = EDIT_CreateEx (350, 120, 35, 20,hWM_HBKWIN_CURVE, WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_AD1, 5); EDIT_SetDecMode(Edit_AD1,0,0,4095,0,0); EDIT_SetValue(Edit_AD1,0); /* Edit to display the AD2 */ Edit_AD2 = EDIT_CreateEx (350, 140, 35, 20,hWM_HBKWIN_CURVE, WM_CF_SHOW,EDIT_CF_HCENTER | EDIT_CF_VCENTER,ID_CFG_PID_EDT_AD2, 5); EDIT_SetDecMode(Edit_AD2,0,0,4095,0,0); EDIT_SetValue(Edit_AD2,0); EDIT_SetFloatMode( Edit_AD1,1.0, 0.0,99.9,1,/*1 bit after dot*/ 0 ); EDIT_SetFloatMode( Edit_AD2,0.0, 0.0,99.9,1,/*1 bit after dot*/ 0 ); } #endif //!< Graph configuration { hScale = GRAPH_SCALE_Create(28, GUI_TA_RIGHT, GRAPH_SCALE_CF_VERTICAL, 20); GRAPH_SCALE_SetTextColor(hScale,GUI_GREEN); GRAPH_SCALE_SetFactor(hScale,0.5); GRAPH_SCALE_SetNumDecs(hScale,1); GRAPH_AttachScale(hGraph, hScale); GRAPH_SetGridDistX(hGraph,0); // Hide the X Grid GRAPH_SetGridDistY(hGraph,20); GRAPH_SetGridVis(hGraph,1); //!< Display the Grid GRAPH_SetBorder(hGraph,30,5,5,5); //!< Set the frame border //GRAPH_SetGridFixedX(hGraph,1); //GRAPH_SetVSizeX(hGraph,500); //加入此会导致死掉 程序卡死在获取此指针上面. //GRAPH_SetGridFixedY(hGraph,1); GRAPH_SetColor(hGraph,GUI_BLUE,GRAPH_CI_BORDER); GRAPH_SetColor(hGraph,GUI_WHITE,GRAPH_CI_BK); GRAPH_SetColor(hGraph,GUI_WHITE,GRAPH_CI_FRAME); } /* Button Configuration */ { BUTTON_SetBkColor(btn,BUTTON_CI_UNPRESSED,GUI_LIGHTBLUE); BUTTON_SetBkColor(btn,BUTTON_CI_PRESSED,GUI_RED); BUTTON_SetFocusColor(btn,GUI_YELLOW); } while(1) { GUI_Exec(); OSTimeDlyHMSM(0,0,0,50); //#define DRAWPOINT #ifdef DRAWPOINT itoa(usValue, buf, 10); BUTTON_SetText(btn,buf); // GRAPH_DATA_YT_AddValue(hData,usValue/20); #endif } }
portTASK_FUNCTION(vLcdTaskOpenDay, pvParameters) { lcdInit( (uint32_t)&_aVRAM[0]); GUI_Init(); WM_SetDesktopColor(GUI_GREEN); WM_SetCreateFlags(WM_CF_MEMDEV); char messaggio[50],msgg[3][70]; statoDisplay=1; while ( 1 ) { while( xSemaphoreTake(xSemaDataAvail, portMAX_DELAY ) != pdTRUE ); if (fIntervalReached==1) { GUI_ClearRect(0,214,317,249); showTime(); fIntervalReached=0; } //CALCOLA STATO DISPLAY SITUAZIONE NORMALE if (!fAlarmTimeMatched) { Nodo_t *temp1 = lista; Nodo_t *temp2 = listaScheduled; int j=0; statoDisplay=1; while (temp2!=NULL) { if(confronta_tag(temp1->info,temp2->info)==1) { temp1=lista; temp2=temp2->prox; } else { if (temp1->prox!=NULL) { temp1=temp1->prox; } else { //temp2 non è presente nella scatola statoDisplay=2; int k=0,c=0; for (k=0; k<maxR; k++) { uint8_t tempTag[4]; for (c=0;c<4;c++){ tempTag[c] = l_tabellaMedicine[k][c]; } if (confronta_tag(temp2->info,tempTag)==1) { for (c=0;c<35;c++){ msgg[j][c] = l_tabellaMedicine[k][c+4]; } j++; temp1=lista; temp2=temp2->prox; } } }//FINE else //temp2 non è presente nella scatola } } if (statoDisplay==1) { if (statoDisplayP!=1){ GUI_Clear(); } GUI_DispStringAt( "Nessuna medicina", 120-7*10/2, 50); GUI_DispStringAt( "da assumere", 120-7*10/2, 100); showTime(); } if (statoDisplay==2) { if (statoDisplayP!=2){ GUI_Clear(); } GUI_Clear(); int c=0; GUI_DispStringAt( "Nella scatola manca:", 80, 20); for (c=0;c<j;c++){ GUI_DispStringAt( msgg[c], 80, 20*c+40); } showTime(); } statoDisplayP=statoDisplay; vTaskDelay(300); }//FINE if !fAlarmTimeMatched else { //fAlarmTimeMatched showTimeAlarm(bUidPresent,nCardDetected,nCardPrevious); if ((nCardDetected<nCardPrevious) /*&& (tag)*/) { //GUI_Clear(); if (tagRimosso[0] == ptrMedic->tag[0] && tagRimosso[1] == ptrMedic->tag[1] && tagRimosso[2] == ptrMedic->tag[2] && tagRimosso[3] == ptrMedic->tag[3] ){ //tag corretto GUI_SetColor(GUI_GREEN); GUI_Clear(); sprintf( messaggio, "Medicina Corretta!"); GUI_DispStringAt( messaggio, 40, 100); vTaskDelay(5000); if (nCardDetected<nCardTot) { GUI_DispStringAt( "Riposiziona la medicina", 0, 100); vTaskDelay(1000); } fAlarmTimeMatched=0; modifica=1; //MODIFICARE DOSI RIMANENTI int cc = 0; for (cc=0; cc<maxR; cc++) { if ((ptrMedic->tag[1] == l_tabellaMedicine[cc][1]) && (ptrMedic->tag[2] == l_tabellaMedicine[cc][2]) && (ptrMedic->tag[3] == l_tabellaMedicine[cc][3]) && (ptrMedic->tag[4] == l_tabellaMedicine[cc][4])) { uint8_t dose = l_tabellaMedicine[cc][55], rimasteInt = l_tabellaMedicine[cc][62], rimasteFraz = l_tabellaMedicine[cc][63]; uint16_t rimaste = (rimasteInt << 2) | rimasteFraz; //0b11 rimaste = rimaste-(uint16_t)dose; //SOLO QUANDO LA ASSUMO! uint8_t temp = rimaste; temp = temp&0b00000011; rimasteFraz = temp ; rimaste >>= 2; rimasteInt = (uint8_t) rimaste; l_tabellaMedicine[cc][62] = rimasteInt; l_tabellaMedicine[cc][63] = rimasteFraz; } } ptrMedic = ptrMedic->next; IP_RTC_TIME_T oraAllarme; oraAllarme.time[RTC_TIMETYPE_HOUR] = ptrMedic->oraA; oraAllarme.time[RTC_TIMETYPE_MINUTE] = ptrMedic->minA; oraAllarme.time[RTC_TIMETYPE_SECOND] = ptrMedic->secA; if (orarioDopoOrario(FullTime,oraAllarme)) { fAlarmTimeMatched = 1; } else{ FullTime.time[RTC_TIMETYPE_HOUR] = oraAllarme.time[RTC_TIMETYPE_HOUR]; FullTime.time[RTC_TIMETYPE_MINUTE] = oraAllarme.time[RTC_TIMETYPE_MINUTE]; FullTime.time[RTC_TIMETYPE_SECOND] = oraAllarme.time[RTC_TIMETYPE_SECOND]; Chip_RTC_SetFullAlarmTime(&FullTime); } } else{ //mostra che hai tolto il tag ERRATO! GUI_SetColor(GUI_RED); GUI_Clear(); sprintf( messaggio, "Medicina ERRATA!"); GUI_DispStringAt( messaggio, 40, 100); showTimeAlarm(bUidPresent, nCardDetected, nCardPrevious); vTaskDelay(2000); modifica=1; } }
/********************************************************************* * * MainTask */ void MainTask(void) { TREEVIEW_ITEM_Handle hNode; WM_HWIN hTree; int xSize; int ySize; int yPos; int r; int TimeStart; int TimeUsed; int ySizeText; U32 BytesFree; U32 BytesUsed; char acBuffer[(TREEVIEW_DEPTH << 1) + 1]; char acNumNodes[30] = "Nodes: "; char acNumLeaves[30] = "Leaves: "; char acNumTotal[30] = "Total: "; char acTimeUsed[30] = "Time: "; char acBytesUsed[30] = "Memory: "; // // Initialize emWin // WM_SetCreateFlags(WM_CF_MEMDEV); GUI_Init(); xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); // // Set defaults for background and widgets // WM_SetDesktopColor(GUI_BLACK); SCROLLBAR_SetDefaultSkin(SCROLLBAR_SKIN_FLEX); SCROLLBAR_SetDefaultWidth(20); SCROLLBAR_SetThumbSizeMin(25); TEXT_SetDefaultFont(GUI_FONT_6X8); // // Draw info message before creating the widgets // GUI_DrawGradientV(0, 0, xSize - 1, ySize - 1, GUI_BLUE, GUI_BLACK); GUI_SetFont(GUI_FONT_20F_ASCII); GUI_DispStringHCenterAt("Filling TREEVIEW widget...", xSize >> 1, ySize / 3); GUI_X_Delay(1000); // // Create TREEVIEW // hTree = TREEVIEW_CreateEx(0, 0, xSize, ySize, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_TREEVIEW0); TREEVIEW_SetAutoScrollV(hTree, 1);//管理自动使用垂直滚动条。 TREEVIEW_SetSelMode(hTree, TREEVIEW_SELMODE_ROW); // // Fill TREEVIEW // hNode = TREEVIEW_InsertItem(hTree, TREEVIEW_ITEM_TYPE_NODE, 0, 0, "Tree"); BytesFree = GUI_ALLOC_GetNumFreeBytes(); TimeStart = GUI_GetTime(); r = _FillNode(hTree, hNode, NUM_CHILD_NODES, NUM_CHILD_ITEMS, TREEVIEW_DEPTH, TREEVIEW_DEPTH, acBuffer, acBuffer); TimeUsed = GUI_GetTime() - TimeStart; BytesUsed = BytesFree - GUI_ALLOC_GetNumFreeBytes(); if (r) { // // Error message // WM_DeleteWindow(hTree); GUI_MessageBox("Error", "Not enough memory available!", 0); } else { // // Show result // yPos = 20; ySizeText = GUI_GetYDistOfFont( TEXT_GetDefaultFont()) + 5; _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acNumNodes, _NumNodes); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acNumLeaves, _NumLeaves); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acNumTotal, _NumNodes + _NumLeaves); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acTimeUsed, TimeUsed); _MakeNumberText(hTree, xSize >> 1, &yPos, xSize >> 1, ySizeText, acBytesUsed, BytesUsed); WM_SetFocus(hTree); } while (1) { GUI_Delay(100); } }
void showCardUIDList( char *cardType, Nodo_t *lista, uint8_t *nCardDetected, uint8_t *nCardPrevious ){ char msg[35]; WM_SetDesktopColor(GUI_BLACK); GUI_SetBkColor(GUI_BLACK); GUI_SetColor(GUI_GREEN); if( lista != NULL ) { Nodo_t *testa=lista; int i=0,j=1; sprintf( msg, "ELENCO MEDICINE sched:"); GUI_DispStringAt( msg, 0, 20); while (lista != NULL ){ int k=0,c=0; for (k=0; k<maxR; k++) { uint8_t tempTag[4]; for (c=0;c<4;c++){ tempTag[c] = l_tabellaMedicine[k][c]; } if (confronta_tag(lista->info,tempTag)==1) { for (c=0;c<35;c++){ msg[c] = l_tabellaMedicine[k][c+4]; } GUI_DispStringAt( msg, 0, 20*j+20); j++; } else { //GUI_DispStringAt( "MEDICINA NON REGISTRATA", 0, 20*j+20); } } // /*FARE UNA FUNZIONE CONFRONTA-TAG*/ // uint8_t tempUID[4] = {0x6b,0xec,0x1d,0x9f};// {0x6b,0xec,0x1d,0x9f} = Neo BOROCILLINA; {0x9b,0x83,0x1e,0x9f} = TACHIPIRINA 1000; // int uu = confronta_tag(lista->info,tempUID); // if (uu==1){//lista->info[0]==0x6b && lista->info[1]==0xec && lista->info[2]==0x1d && lista->info[3]==0x9f){ // sprintf( msg, "Neo BOROCILLINA"); // GUI_DispStringAt( msg, 0, 20*j+20); // j++; // // } else { // if (lista->info[0]==0x9b && lista->info[1]==0x83 && lista->info[2]==0x1e && lista->info[3]==0x9f){ // sprintf( msg, "TACHIPIRINA 1000"); // GUI_DispStringAt( msg, 0, 20*j+20); // j++; // } else { // GUI_SetColor(GUI_YELLOW); // sprintf( msg, "UID %02X : %02X%02X%02X%02X", i+1, lista->info[0], lista->info[1], lista->info[2], lista->info[3] ); // GUI_DispStringAt( msg, 0, 20*j+20); // i++; // j++; // GUI_DispStringAt( "MEDICINA NON REGISTRATA", 0, 20*j+20); // j++; // GUI_SetColor(GUI_GREEN); // /*C'E' UN TAG NON REGISTRATO. DA FARE AVVISO CHE UNA MEDICINA NON E' INSERITA CORRETTAMENTE*/ // } // } lista=lista->prox; } lista = testa; } /*RETTANGOLO IN BASSO*/ // GUI_SetColor( (GUI_COLOR)0x003f3f3f ); // GUI_FillRect( 0, 214, 319, 239 ); // GUI_SetBkColor((GUI_COLOR)0x003f3f3f); // GUI_SetColor(GUI_RED); // GUI_SetFont(&GUI_Font24B_ASCII); // GUI_DispStringAt( "Reading Card", 80, 215); empty = 1; }