/** * @brief Paints drowise button * @param hObj: button handle * @retval None */ static void _OnPaint_drowise(BUTTON_Handle hObj) { int Index; GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0; if(Index) { GUI_DrawBitmap(&bmdes_water_sub, 0, 0); } else { GUI_DrawBitmap(&bmwater_sub, 0, 0); } }
/** * @brief Paints Full Screen button * @param hObj: button handle * @retval None */ static void _OnPaint_fullscreen(BUTTON_Handle hObj) { int Index; GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0; if(Index) { GUI_DrawBitmap(&bmwindowfullscreen, 0, 0); } else { GUI_DrawBitmap(&bmwindownofullscreen, 0, 0); } }
/** * @brief Paints Close button * @param hObj: button handle * @retval None */ static void _OnPaint_close(BUTTON_Handle hObj) { int Index; GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); Index = (WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED) ? 1 : 0; if(Index) { GUI_DrawBitmap(&bmclose_pressed, 0, 0); } else { GUI_DrawBitmap(&bmclose_not_pressed, 0, 0); } }
/********************************************************************* * * _DrawBkCircle */ static void _DrawBkCircle(int DrawLogo) { static GUI_MEMDEV_Handle hMemStretch; GUI_MEMDEV_Handle hMemGradient; GUI_MEMDEV_Handle hMemCircle; GUI_MEMDEV_Handle hMemOld; int CircleWidth; int ySizeV; int xSize; int ySize; int i; U32 * pData; xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); ySizeV = LCD_GetVYSize(); if (ySizeV > ySize) { GUI_SetBkColor(BK_COLOR_1); GUI_ClearRect(0, 0, xSize, ySizeV); } if (hMemStretch == 0) { CircleWidth = (CIRCLE_RADIUS << 1) + 1; hMemCircle = GUI_MEMDEV_CreateFixed(0, 0, CircleWidth, CircleWidth, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_8888); hMemStretch = GUI_MEMDEV_CreateEx (0, 0, xSize, ySize, GUI_MEMDEV_NOTRANS); hMemGradient = GUI_MEMDEV_CreateFixed(0, 0, 1, CIRCLE_RADIUS, GUI_MEMDEV_NOTRANS, GUI_MEMDEV_APILIST_32, GUI_COLOR_CONV_8888); // // Initialize background // hMemOld = GUI_MEMDEV_Select(hMemCircle); GUI_SetBkColor(BK_COLOR_1); GUI_Clear(); // // Create Gradient // GUI_MEMDEV_Select(hMemGradient); GUI_DrawGradientV(0, 0, 0, CIRCLE_RADIUS, BK_COLOR_0, BK_COLOR_1); // // Get color and draw circles // pData = (U32 *)GUI_MEMDEV_GetDataPtr(hMemGradient); GUI_MEMDEV_Select(hMemCircle); for (i = 0; i < CIRCLE_RADIUS; i++, pData++) { GUI_SetColor(*pData); GUI_DrawCircle(CIRCLE_RADIUS, CIRCLE_RADIUS, i); } // // Stretch and display // GUI_MEMDEV_Select(hMemStretch); GUI_MEMDEV_DrawPerspectiveX(hMemCircle, 0, 0, ySize, ySize, xSize, 0); GUI_MEMDEV_Delete(hMemCircle); GUI_MEMDEV_Delete(hMemGradient); GUI_MEMDEV_Select(hMemOld); } GUI_MEMDEV_Write(hMemStretch); if (DrawLogo) { GUI_DrawBitmap(&bmSTLogo70x35, LOGO_DIST_BORDER, LOGO_DIST_BORDER); } }
static int _ExecKeyboard(void) { int i; int Key; BUTTON_Handle ahButton[52]; BUTTON_Handle hButtonESC; EDIT_Handle hEdit; GUI_RECT rText = {000,0, LCD_XSIZE, 20}; GUI_SetBkColor(GUI_RED); GUI_Clear(); GUI_DrawBitmap(&bmSeggerLogoBlue, 0, 0); GUI_SetFont(&GUI_FontComic18B_ASCII); GUI_SetColor(GUI_WHITE); GUI_DispStringInRect("emWin", &rText, GUI_TA_RIGHT | GUI_TA_VCENTER); rText.y0 +=20; rText.y1 +=20; GUI_DispStringInRect("Touch screen demo", &rText, GUI_TA_RIGHT | GUI_TA_VCENTER); /* Create Keyboard Buttons */ for (i=0; i< 51; i++) { int Pos = (i < 47) ? i : i+4; int x0 = 5 + 28*(Pos%11); int y0 = 100 + 28*(Pos/11); char c = _acText[i]; int Id = c ? c : 1; char ac[2] = {0}; char *s= ac; ac[0] = c; ahButton[i] = BUTTON_Create( x0, y0, 25, 25, Id,BUTTON_CF_SHOW ); BUTTON_SetText (ahButton[i], s); #if GUI_SUPPORT_MEMDEV BUTTON_EnableMemdev(ahButton[i]); #endif } ahButton[i] = BUTTON_Create( 89, 212, 109, 25, ' ',BUTTON_CF_SHOW ); hButtonESC = BUTTON_Create( 230, 40, 80, 25, GUI_ID_CANCEL,BUTTON_CF_SHOW ); BUTTON_SetText (hButtonESC, "ESC"); hEdit = EDIT_Create( 5, 70, 310, 25, ' ', 80, 0 ); EDIT_SetFont(hEdit, &GUI_Font8x16); BUTTON_SetBkColor(ahButton[49], 0, GUI_RED); BUTTON_SetBkColor(ahButton[50], 0, GUI_BLUE); /* Handle Keyboard until ESC or ENTER is pressed */ do { Key = GUIDEMO_WaitKey(); switch (Key) { case 0: case GUI_ID_CANCEL: break; default: EDIT_AddKey(hEdit, Key); } } while ((Key != 'N') && (Key!=GUI_ID_CANCEL) && (Key!=0)); /* Cleanup */ for (i=0; i< countof(ahButton); i++) { BUTTON_Delete(ahButton[i]); } BUTTON_Delete(hButtonESC); EDIT_Delete(hEdit); return Key; }
/** * @brief Paints repeat button * @param repeat_status: repeat button status * @retval None */ static void _OnPaint_repeat(uint32_t repeat_status) { GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); if(PlayerSettings.b.repeat == REPEAT_NONE) { GUI_DrawBitmap(&bmrepeat_off, 0, 0); } else if(PlayerSettings.b.repeat == REPEAT_ONCE) { GUI_DrawBitmap(&bmrepeat1, 0, 0); } else if(PlayerSettings.b.repeat == REPEAT_ALL) { GUI_DrawBitmap(&bmrepeat_all, 0, 0); } }
/** * @brief Initializes the menu. * @param None. * @retval None. */ void k_InitMenu(void) { WM_HWIN hItem; uint8_t i = 0; GUI_SetLayerVisEx (0, 0); GUI_DrawBitmap(&bmbackground, 0,0); settings.d32 = k_BkupRestoreParameter(CALIBRATION_GENERAL_SETTINGS_BKP); GUI_SetLayerVisEx (0, 1); GUI_SelectLayer(1); GUI_Clear(); WM_SetCallback(WM_HBKWIN, _cbBk); WM_CreateWindowAsChild(0, 0, LCD_GetXSize(), 25, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS , _cbStatus, 0); hIcon = ICONVIEW_CreateEx(0, 26, LCD_GetXSize(), LCD_GetYSize()- 26, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_BGND , ICONVIEW_CF_AUTOSCROLLBAR_V, ID_ICONVIEW_MENU, 112, 105); ICONVIEW_SetFont(hIcon, &GUI_Font13B_ASCII); ICONVIEW_SetBkColor(hIcon, ICONVIEW_CI_SEL, GUI_LIGHTBLUE |GUI_TRANSPARENT); ICONVIEW_SetSpace(hIcon, GUI_COORD_Y, 10); ICONVIEW_SetFrame(hIcon, GUI_COORD_Y, 10); for (i = 0; i < k_ModuleGetNumber(); i++) { ICONVIEW_AddBitmapItem(hIcon,module_prop[i].module->icon, (char *)module_prop[i].module->name); } if(settings.b.enable_sprite) { _ShowSprites(); } hItem = BUTTON_CreateEx(0, 0, 40, 23, WM_HBKWIN, WM_CF_SHOW, 0, ID_BUTTON_BKGND); WM_SetCallback(hItem, _cbButton); }
/** * @brief Paints camera button * @param hObj: button handle * @retval None */ static void _OnPaint_camera(BUTTON_Handle hObj, uint32_t alarm_status, uint32_t camera_status) { GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); GUI_DrawBitmap(&bmcamera, 0, 0); if(HomeSettings.b.alarm == ALARM_ON) { if(HomeSettings.b.camera != CAM_DESACTIVATED) { GUI_DrawBitmap(&bmdes_camera, 0, 0); } } else { GUI_DrawBitmap(&bmcamera, 0, 0); } }
static void _DrawBk(int DrawLogo) { int xSize, ySize; xSize = LCD_GetXSize(); ySize = LCD_GetYSize(); GUI_DrawGradientV(0, 0, xSize, ySize, BK_COLOR_0, BK_COLOR_1); if (DrawLogo) { GUI_DrawBitmap(&bmSeggerLogo70x35, 5, 5); } }
/******************************************************************** * * _DrawBitmap */ static _DrawBitmap(const GUI_BITMAP* pBitmap, int x, int y, int Trans, int XOr) { GUI_LOGPALETTE Pal; GUI_BITMAP Bitmap; int PrevDM; memcpy(&Bitmap, pBitmap, sizeof(GUI_BITMAP)); memcpy(&Pal, Bitmap.pPal, sizeof(GUI_LOGPALETTE)); Bitmap.pPal = &Pal; Pal.HasTrans = Trans; PrevDM = GUI_SetDrawMode((XOr) ? GUI_DM_XOR : 0); GUI_DrawBitmap(&Bitmap, x, y); GUI_SetDrawMode(PrevDM); }
/********************************************************************* * * _Paint */ static void _Paint(xIconSelBtn_Handle hWin) { GUI_RECT WinRect; xIconSelBtn_OBJ tWidget; GUI_CONST_STORAGE GUI_BITMAP* pBMP; int xSize, ySize; if(!hWin) return; DEBUGOUT("xIconSelBtn hWin = 0x%08x\r\n", hWin); WM_GetWindowRectEx(hWin, &WinRect); GUI_MoveRect(&WinRect, -WinRect.x0, -WinRect.y0); DEBUGOUT("xIconSelBtn Paint(%d,%d,%d,%d)\r\n",WinRect.x0, WinRect.y0, WinRect.x1, WinRect.y1); BUTTON_GetUserData(hWin, &tWidget, sizeof(xIconSelBtn_OBJ)); tWidget.hThis = hWin; BUTTON_SetUserData(hWin, &tWidget, sizeof(xIconSelBtn_OBJ)); if(tWidget.pBkBMP) { GUI_DrawBitmap(tWidget.pBkBMP, WinRect.x0, WinRect.y0); } else { //Draw Window Frame Outline, and Background. GUI_SetColor(tWidget.aBkColor[0]); //Draw Window Frame Outline, and Background. GUI_FillRoundedRect(WinRect.x0, WinRect.y0, WinRect.x1, WinRect.y1, 1); } xSize = WinRect.x1 - WinRect.x0; ySize = WinRect.y1 - WinRect.y0; pBMP = tWidget.xIconArray[tWidget.SelectedIndex].pBMP; if(pBMP) { //Draw BMP in H & V center GUI_DrawBitmap(pBMP, WinRect.x0 + (xSize - pBMP->XSize)/2 , WinRect.y0 + (ySize - pBMP->YSize)/2 ); } }
void ANIM_prerenderFrames(void) { uint32_t i; uint32_t magicWord = 0xef32; /* Get the starting address of the prerendered frames */ uint32_t *addr = (uint32_t *)FRAMES_START; /* Get the end of the prerendered frames */ uint32_t *lastAddr = addr + FRAME_BUFFER_SIZE_WORDS * NUM_FRAMES; /* Get the address of the current frame buffer */ uint16_t *frameBuffer = FB_getActiveBuffer(); /* Check the last address for the magic word. * If this has been written the frames are already in flash * and we can skip the entire prerendering step */ if ( *lastAddr == magicWord ) { return; } MSC_Init(); /* Make emWin draw to the frame buffer */ FB_activateFrameBuffer(); /* Add meta data to frame buffer */ FB_writeControlSignals((uint8_t*)frameBuffer); /* Erase all the pages we are going to write to */ while ( addr < lastAddr ) { MSC_ErasePage(addr); addr += FRAME_BUFFER_SIZE_WORDS; } addr = (uint32_t *)FRAMES_START; for ( i=0; i<NUM_FRAMES; i++ ) { /* Render a frame */ GUI_DrawBitmap(frames[i], 0, 0); /* Copy entire frame buffer to flash */ MSC_WriteWord(addr, frameBuffer, FRAME_BUFFER_SIZE_BYTES); addr += FRAME_BUFFER_SIZE_WORDS; } /* Write magic word to indicate that the frames are ready in Flash */ MSC_WriteWord(lastAddr, &magicWord, 4); MSC_Deinit(); }
void GUIDEMO_Intro(void) { int xCenter = LCD_GET_XSIZE() / 2; int y; char acText[50] = "Version of uC/GUI: "; strcat(acText, GUI_GetVersionString()); GUI_SetBkColor(GUI_BLUE); GUI_SetColor(GUI_LIGHTRED); GUI_Clear(); GUI_SetFont(&GUI_Font24B_1); GUI_DispStringHCenterAt("uC/GUI", xCenter, y= 15); GUI_SetColor(GUI_WHITE); GUI_SetFont(&GUI_Font13H_ASCII); GUI_DispStringHCenterAt("Universal graphic software" "\nfor embedded applications" , xCenter, y += 30); GUI_SetColor(GUI_LIGHTRED); GUI_SetFont(&GUI_Font16_ASCII); GUI_DispStringHCenterAt("Any CPU - Any LCD - Any Application" , xCenter, y += 40); GUI_SetFont(&GUI_Font10S_ASCII); GUI_DispStringHCenterAt("Compiled " __DATE__ " "__TIME__, xCenter, y += 25); GUI_SetFont(&GUI_Font13HB_1); GUI_SetColor(GUI_WHITE); GUI_DispStringHCenterAt(acText, xCenter, y += 21); GUI_SetFont(&GUI_FontComic18B_1); GUI_SetColor(GUI_WHITE); GUI_DispStringHCenterAt("www.micrium.com", LCD_GET_XSIZE() / 2, LCD_GET_YSIZE() - 40); GUI_DrawBitmap(&bmMicriumLogo, (LCD_GET_XSIZE() - bmMicriumLogo.XSize) / 2, 150); GUI_SetFont(&GUI_Font10S_ASCII); GUI_DispStringAt("GUI_OS: ", 0,210); GUI_DispDecMin(GUI_OS); GUI_DispStringAt("GUI_ALLOC_SIZE: ",0, 220); GUI_DispDecMin(GUI_ALLOC_SIZE); GUI_DispStringAt("Compiler: " #ifdef _MSC_VER "Microsoft" #elif defined (NC308) "Mitsubishi NC308" #elif defined (NC30) "Mitsubishi NC30" #elif defined (__TID__) #if (((__TID__ >>8) &0x7f) == 48) /* IAR MC80 */ "IAR M32C" #elif (((__TID__ >>8) &0x7f) == 85) /* IAR V850 */ "IAR V850" #else /* IAR MC16 */ "IAR M32C" #endif #else "Unknown" #endif ,0, 230); GUIDEMO_Delay(5000); }
/** * @brief Paints Stop button * @param hObj: button handle * @retval None */ static void _OnPaint_stop(BUTTON_Handle hObj) { GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); if((RecorderMode == RECORDER_MODE_REC_IDLE)|| (RecorderMode == RECORDER_MODE_REC_DISABLED)) { GUI_DrawBitmap(&record_bmstop_des, 0, 0); } else { if((WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED)) { GUI_DrawBitmap(&record_bmstop_pressed, 0, 0); } else { GUI_DrawBitmap(&record_bmstop, 0, 0); } } }
/** * @brief Paints record button * @param hObj: button handle * @retval None */ static void _OnPaint_record(BUTTON_Handle hObj) { GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); if(RecorderMode == RECORDER_MODE_REC_DISABLED) { GUI_DrawBitmap(&bmrecord_disabled, 0, 0); } else if(RecorderMode == RECORDER_MODE_PLAYING) { GUI_DrawBitmap(&record_bmplay_pressed, 0, 0); } else if(RecorderMode == RECORDER_MODE_REC_IDLE) { if((WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED)) { GUI_DrawBitmap(&bmrecord_pressed, 0, 0); } else { GUI_DrawBitmap(&bmrecord, 0, 0); } } else if(RecorderMode == RECORDER_MODE_PLAY_IDLE) { if((WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED)) { GUI_DrawBitmap(&record_bmplay_pressed, 0, 0); } else { GUI_DrawBitmap(&record_bmplay, 0, 0); } } else if(RecorderMode == RECORDER_MODE_RECORDING) { if((WIDGET_GetState(hObj) & BUTTON_STATE_PRESSED)) { GUI_DrawBitmap(&bmcancel, 0, 0); } else { GUI_DrawBitmap(&bmcancel_unpressed, 0, 0); } } }
/********************************************************************* * * _cbBkWin */ static void _cbBkWin(WM_MESSAGE * pMsg) { const WM_KEY_INFO * pKeyInfo; int NCode; int Id; switch (pMsg->MsgId) { case WM_KEY: pKeyInfo = (const WM_KEY_INFO*)pMsg->Data.p; if (pKeyInfo->PressedCnt > 0) { switch (pKeyInfo->Key) { case GUI_KEY_TAB: WM_SetFocusOnNextChild(pMsg->hWin); break; case GUI_KEY_BACKTAB: WM_SetFocusOnPrevChild(pMsg->hWin); break; case GUI_KEY_ESCAPE: _Break = 1; break; } } break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); // Id of widget NCode = pMsg->Data.v; // Notification code switch (NCode) { case WM_NOTIFICATION_RELEASED: // React only if released switch (Id) { case GUI_ID_BUTTON0: _AppSelection = APP_DASHBOARD; break; case GUI_ID_BUTTON1: _AppSelection = APP_CASHTERMINAL; break; } break; } break; case WM_PAINT: GUI_DrawGradientV(0, 0, 639, 479, GUI_BLUE, GUI_BLACK); GUI_SetFont(&GUI_FontAA2_32); GUI_SetTextMode(GUI_TM_TRANS); GUI_SetColor(GUI_WHITE); GUI_DispStringHCenterAt("emWin VGA Demonstration\n", 400, 44); GUI_SetFont(&GUI_FontAA2_21); GUI_DispStringHCenterAt("Press the 'Dashboard' or the 'Cash Terminal'\nbutton to start one of the applications\n", 320, 150); GUI_DrawBitmap(&bmSeggerLogo, 30, 30); break; } }
/********************************************************************* * * _DispCursor */ static void _DispCursor(void) { int i, x, y; GUI_DispStringHCenterAt("Available cursors:", 160, 80); for (i = 0; i < 12; i++) { x = 160 - (_apCursor[i]->pBitmap->XSize / 2); y = 120 - (_apCursor[i]->pBitmap->YSize / 2); GUI_DrawBitmap(_apCursor[i]->pBitmap, x, y); GUI_DispStringHCenterAt(_aacCursorName[i], 160,145); GUI_Delay(750); GUI_ClearRect(0, 100, 319, 165); } GUI_ClearRect(0, 80, 319, 100); GUI_Delay(500); }
void DispInit(void) { LcdInit(); LCD_OFF(); GUI_Init(); GUI_SetBkColor(GUI_BLACK); GUI_Clear(); GUI_SetDrawMode(GUI_DRAWMODE_NORMAL); GUI_DrawBitmap(&bm_yanghe_logo,0,0); LCD_ON(); Delay_Ms(2000); GUI_SetFont(&GUI_NOW_FONT); Display_Welcome(); }
/** * @brief Paints cam5_1 button * @param hObj: button handle * @retval None */ static void _OnPaint_cam5_1(BUTTON_Handle hObj, uint32_t alarm_status, uint32_t camera_status) { GUI_SetBkColor(FRAMEWIN_GetDefaultClientColor()); GUI_Clear(); GUI_DrawBitmap(&bmB6_OFF, 0, 0); if(HomeSettings.b.alarm == ALARM_ON) { if(HomeSettings.b.camera == CAM_5) { GUI_DrawBitmap(&bmB6_ON, 0, 0); } else { GUI_DrawBitmap(&bmB6_DES, 0, 0); } } else { GUI_DrawBitmap(&bmB6_OFF, 0, 0); } }
void GUI_DrawStreamedBitmap(const GUI_BITMAP_STREAM *pBitmapHeader, int x, int y) { GUI_BITMAP Bitmap = {0}; GUI_LOGPALETTE Palette; Bitmap.BitsPerPixel = pBitmapHeader->BitsPerPixel; Bitmap.BytesPerLine = pBitmapHeader->BytesPerLine; Bitmap.pData = ((U8*)pBitmapHeader)+16+4*pBitmapHeader->NumColors; Bitmap.pPal = &Palette; Bitmap.XSize = pBitmapHeader->XSize; Bitmap.YSize = pBitmapHeader->YSize; Palette.HasTrans = pBitmapHeader->HasTrans; Palette.NumEntries = pBitmapHeader->NumColors; Palette.pPalEntries = (const LCD_COLOR*)((U8*)pBitmapHeader+16); GUI_DrawBitmap(&Bitmap, x, y); }
void GUIDEMO_Touch(void) { #define ID_KEYBOARD 1 #define ID_TESTCAL 2 #define ID_CALIBRATE 3 int i, r; int XSize = LCD_GetXSize(); int YSize = LCD_GetYSize(); int XMid = XSize / 2; int YMid = YSize / 2; //GUIDEMO_NotifyStartNext(); GUIDEMO_HideInfoWin(); do { GUI_RECT rText;/*= {0, 80, XSize, 120};*/ BUTTON_Handle ahButton[3]; rText.x0=0; rText.y0=50; rText.x1=XSize; rText.y1=90; GUI_SetBkColor(GUI_BLUE); GUI_Clear(); GUI_DrawBitmap(&bmMicriumLogo, (XSize - 1 - bmMicriumLogo.XSize) / 2, 15); GUI_SetFont(&GUI_Font16B_1); GUI_DispStringInRect("µC/GUI Touch screen demo", &rText, GUI_TA_HCENTER | GUI_TA_VCENTER); ahButton[0] = BUTTON_Create( XMid - 50, YMid - 30, 100, 50, ID_CALIBRATE,BUTTON_CF_SHOW ); ahButton[1] = BUTTON_Create( XMid - 90, YMid + 30, 80, 30, ID_KEYBOARD, BUTTON_CF_SHOW ); ahButton[2] = BUTTON_Create( XMid + 10, YMid + 30, 80, 30, ID_TESTCAL,BUTTON_CF_SHOW ); BUTTON_SetText (ahButton[0], "Calibrate"); BUTTON_SetBkColor(ahButton[0], 0, GUI_RED); BUTTON_SetText (ahButton[1], "Keyboard"); BUTTON_SetText (ahButton[2], "Test calibration"); BUTTON_SetFont(ahButton[0], &GUI_FontComic18B_ASCII); r = GUIDEMO_WaitKey(); if (r==0) { r = ID_KEYBOARD; BUTTON_SetState(ahButton[1],BUTTON_STATE_PRESSED); GUIDEMO_Delay(500); } for (i=0; i< countof(ahButton); i++) { BUTTON_Delete(ahButton[i]); } switch (r) { case ID_KEYBOARD: init_uart0(); send_press_key(); break; case ID_CALIBRATE: _ExecCalibration(); break; case ID_TESTCAL: _TestCalibration(); break; } } while (r && (r!='n') && (r!='N')); }
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); }
/********************************************************************* * * _cbBkWindow */ static void _cbBkWindow(WM_MESSAGE * pMsg) { int xPos, yPos; xPos = LCD_GetXSize() / 2 - bmSeggerLogoBlue.XSize/2; yPos = LCD_GetYSize() / 2 - bmSeggerLogoBlue.YSize/2 ; switch (pMsg->MsgId) { case WM_PAINT: GUI_SetBkColor(GUI_BLUE); GUI_Clear(); GUI_SetColor(GUI_WHITE); GUI_SetFont(&GUI_Font24_ASCII); GUI_DispStringHCenterAt("DIALOG_SliderColor - Sample", 160, 5); GUI_DrawBitmap(&bmSeggerLogoBlue, xPos, yPos ); default: WM_DefaultProc(pMsg); } }
static void _cbClock(WM_MESSAGE *pMsg) { int NCode, Id; //PARAM pParam; switch (pMsg->MsgId) { case WM_PAINT: GUI_SetBkColor(GUI_WHITE); GUI_Clear(); GUI_SetColor(GUI_BLACK); _ShowButton(pMsg->hWin); GUI_DrawBitmap(&bmwatch, 37, 0); //GUI_AA_FillPolygon(pParam.aPoint1, GUI_COUNTOF(_aNeedle[0]), MAG * LCD_GetXSize() / 2, MAG * (LCD_GetYSize() / 2)); // GUI_AA_FillPolygon(pParam.aPoint2, GUI_COUNTOF(_aNeedle[1]), MAG * LCD_GetXSize() / 2, MAG * (LCD_GetYSize() / 2)); //GUI_AA_FillPolygon(pParam.aPoint3, GUI_COUNTOF(_aNeedle[2]), MAG * LCD_GetXSize() / 2, MAG * (LCD_GetYSize() / 2)); GUI_FillCircle(160, 120, 3); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); /* Id of widget */ NCode = pMsg->Data.v; /* Notification code */ switch (NCode) { case WM_NOTIFICATION_CLICKED: switch (Id) { case BUTTON_ID_EXIT: GUI_SetAppIndex(APP_MainMenu); GUI_SetAppDirection(MEMDEV_ANIMATION_LEFT); _MoveShiftWindow(&pMsg->hWin, MEMDEV_ANIMATION_RIGHT, 1, 1); GUI_SetCancel(APP_Clock); GUI_ClearHalt(); break; default: break; } } break; default: WM_DefaultProc(pMsg); } }
/********************************************************************* * * _cbCallback */ static void _cbCallback(WM_MESSAGE * pMsg) { WM_HWIN hDlg; WM_HWIN hWinSrc; int Id; int NCode; hWinSrc = pMsg->hWinSrc; hDlg = pMsg->hWin; switch (pMsg->MsgId) { case WM_PAINT: GUI_SetColor(GUI_BLACK); GUI_DrawBitmap(&bmLogoBitmap, 30, 80); GUI_SetFont(&GUI_Font24B_ASCII); GUI_SetFont(&GUI_Font16B_ASCII); GUI_DispStringHCenterAt("www.segger.com", 30 + bmLogoBitmap.XSize / 2, 80 + bmLogoBitmap.YSize); GUI_DispStringHCenterAt("Virtual screen sample", 160, 20); break; case WM_INIT_DIALOG: FRAMEWIN_SetFont(hDlg, &GUI_Font24B_ASCII); FRAMEWIN_SetTextAlign(hDlg, GUI_TA_HCENTER); break; case WM_NOTIFY_PARENT: Id = WM_GetId(hWinSrc); /* Id of widget */ NCode = pMsg->Data.v; /* Notification code */ switch (NCode) { case WM_NOTIFICATION_RELEASED: switch (Id) { case ID_BUTTON_SETUP: ExecSetup(); break; case ID_BUTTON_CALIBRATION: ExecCalibration(); break; case ID_BUTTON_ABOUT: ExecAbout(); break; } break; } break; default: WM_DefaultProc(pMsg); } }
/** * @brief Callback function of the Camera frame * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbCameraWindow(WM_MESSAGE * pMsg) { GUI_RECT r; switch (pMsg->MsgId) { case WM_CREATE: CAMERA_Init(); break; case WM_PAINT: if(IsFrameAvailable() > 0) { GUI_DrawBitmap(&frame0, 0, 0); } else { WM_GetInsideRect(&r); GUI_ClearRectEx(&r); if(CAMERA_GetState() == CAMERA_ERROR) { GUI_DispStringAt("Error while Initializing Camera Interface", 45, 120); GUI_DispStringAt("Please, check if the camera module is mounted.", 35, 140); } } break; case WM_POST_PAINT: if(IsFrameAvailable() > 0) { if(camera_disabled == 0) { CAMERA_Resume(); } } break; default: WM_DefaultProc(pMsg); } }
/* ******************************************************************* * * main() * ******************************************************************* */ void MainTask_test(void) { int Cnt =0; int i,YPos; int LCDXSize = LCD_GET_XSIZE(); int LCDYSize = LCD_GET_YSIZE(); const GUI_BITMAP *pBitmap; GUI_Init(); GUI_SetBkColor(GUI_RED); GUI_Clear(); GUI_Delay(1000); GUI_SetBkColor(GUI_BLUE); GUI_Clear(); GUI_Delay(1000); GUI_SetColor(GUI_WHITE); for (i=0; i<1000; i+=10) { GUI_DrawHLine(i,0,100); GUI_DispStringAt("Line ",0,i); GUI_DispDecMin(i); } GUI_Delay(1000); GUI_SetColor(0x0); GUI_SetBkColor(0xffffff); for (i=0; i<160; i++) { int len = (i<80) ? i : 160-i; GUI_DrawHLine(i,20,len+20); } GUI_Delay(1000); GUI_Clear(); if (LCD_GET_YSIZE()>(100+bmMicriumLogo_1bpp.YSize)) { pBitmap=&bmMicriumLogo; } else { GUI_SetColor(GUI_BLUE); pBitmap=&bmMicriumLogo_1bpp; } GUI_DrawBitmap(pBitmap,(LCDXSize-pBitmap->XSize)/2,10); YPos=20+pBitmap->YSize; GUI_SetFont(&GUI_FontComic24B_1); GUI_DispStringHCenterAt("www.micrium.com",LCDXSize/2,YPos); GUI_Delay(1000); GUI_SetColor(GUI_RED); GUI_DispStringHCenterAt("© 2004\n", LCDXSize/2,YPos+30); GUI_SetFont(&GUI_Font10S_1); GUI_DispStringHCenterAt("Micriµm Inc.",LCDXSize/2,YPos+60);; GUI_Delay(1000); }
/* Bounces a small text around the screen */ void drawingLoop(void) { int x = 43; int y = 27; int dx = 1; int dy = 2; while (1) { /* Draw something */ GUI_MULTIBUF_Begin(); GUI_DrawGradientV(0, 0, LCD_WIDTH, LCD_HEIGHT, GUI_BLUE, GUI_GREEN); GUI_DrawBitmap(&bmlogo, x, y); GUI_MULTIBUF_End(); /* Drawing finished. Buffers will be flipped */ GUI_Delay(30); /* Move the image around the screen. Bounce when it hits edges */ if ( x + dx + bmlogo.XSize > LCD_WIDTH ) { dx = -dx; } if ( y + dy + bmlogo.YSize > LCD_HEIGHT ) { dy = -dy; } if ( x + dx < 0 ) { dx = -dx; } if ( y + dy < 0 ) { dy = -dy; } x += dx; y += dy; } }
/** * @brief Callback routine of Info dialog * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */ static void _cbFileInfoDialog(WM_MESSAGE * pMsg) { int NCode; int Id; WM_HWIN hItem; switch (pMsg->MsgId) { case WM_INIT_DIALOG: hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_OK_MESSAGE); WM_SetCallback(hItem, _cbButton_okMessage); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_FILENAME); TEXT_SetFont(hItem, &GUI_FontAvantGarde32); hItem = WM_GetDialogItem(pMsg->hWin, (ID_TEXT_FILENAME+2)); TEXT_SetFont(hItem, &GUI_FontAvantGarde32); break; case WM_PAINT: GUI_DrawBitmap(&bmwarning, 260, 60); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BUTTON_OK_MESSAGE: /* Notifications sent by 'OK' */ switch(NCode) { case WM_NOTIFICATION_RELEASED: GUI_EndDialog(pMsg->hWin, 0); break; } break; } break; default: WM_DefaultProc(pMsg); break; } }
/** * @brief wt_InitBackGround * @param * @retval None */ void wt_InitBackGround(void) { // uint32_t i = 0; sprintf((char *)StatusText, "就绪..."); GUI_SelectLayer(0); GUI_SetLayerVisEx (0, 0); GUI_DrawBitmap(&bm_BackGround480x272A, 0,0); GUI_SetLayerVisEx (0, 1); GUI_SelectLayer(1); GUI_SetBkColor(GUI_TRANSPARENT); GUI_Clear(); // creat title hWin_Title = GUI_CreateDialogBox(_aTitleDialogCreate, GUI_COUNTOF(_aTitleDialogCreate), _cbTitle, WM_HBKWIN, 0, 0); //creat status hWin_Statue = WM_CreateWindowAsChild(0,LCD_GetYSize()-25,LCD_GetXSize(), 25, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS , _cbStatus, 0); }