/********************************************************************* * * _LabelGraph */ static void _LabelGraph(void) { GUI_RECT Rect; int x; int y; int xSize; int ySize; WM_GetClientRect(&Rect); xSize = Rect.x1; ySize = Rect.y1; GUI_SetBkColor(_ColorBackGround); GUI_Clear(); GUI_SetColor(_ColorLabel); GUI_SetPenSize(1); GUI_ClearRect(0, (ySize - 21) - ySize, (xSize - 1), (ySize - 1)); GUI_DrawRect(25, 0, xSize, ySize - 20); GUI_SetFont(&GUI_Font6x8); for (x = 0; x < (xSize - 20); x += 40) { int xPos = x + 25; GUI_DrawVLine(xPos, (ySize - 20), (ySize - 14)); GUI_DispDecAt(x / 40, xPos - 2, (ySize - 9), 1); } for (y = 0; y < ySize - 20; y += 20) { int yPos = ySize - 20 - y; GUI_DrawHLine(yPos, 20, 25); GUI_GotoXY(1, yPos - 4); GUI_DispDecSpace(_TempMin + y, 3); } }
static void _DisplayTime(int tDiff) { #if GUIDEMO_LARGE GUI_GotoXY(80, 50); GUI_SetColor(GUI_WHITE); GUI_SetBkColor(GUI_RED); GUI_DispDecSpace(tDiff, 3); #else tDiff = tDiff; /* Avoid warning */ #endif }
static void _DisplayTime(int tDiff) { GUI_GotoXY(80, 50); GUIDEMO_SetColor(GUI_WHITE); GUIDEMO_SetBkColor(GUI_RED); GUI_DispDecSpace(tDiff, 3); }
void vHeartbeatTask (void * pvParameters){ int Key, Entries, ySize; uint16_t click_cnt=0; int8_t Item_nb; BUTTON_Handle hOK_Button, hTest_Key; LISTBOX_Handle hStationListBox; static enum GuiState eGuiState = SELECT; static const GUI_ConstString StationList[] = {"ZET", "RMFFM", "RMFMAXXX", "SKY.FM", "ESKA ROCK", "TERMINAL", NULL}; vSemaphoreCreateBinary(xButton_pushed_Semaphore); if(xDMAch1_Semaphore != NULL){ xSemaphoreTake(xButton_pushed_Semaphore, 0); }else{ // The semaphore was not created } BUTTON_Config(); //INT0 Button as source of interrupt xSemaphoreTake(xButton_pushed_Semaphore, 0); xListBoxQueue = xQueueCreate(2, sizeof(int8_t)); GUI_Init(); if(0){ _ExecCalibration(); }else{ _DefaultCalibration(); } GUI_SetBkColor(GUI_BLUE); GUI_Clear(); if (xSemaphoreTake(xDhcpCmplSemaphore_1, portMAX_DELAY) == pdTRUE) { /* OK button */ hOK_Button = BUTTON_CreateEx(120, 210, 80, 20, 0, WM_CF_SHOW, 0, 12); GUI_SetFont(&GUI_Font32_ASCII); BUTTON_SetText(hOK_Button, "OK"); /* Cancel button */ hTest_Key = BUTTON_CreateEx(120, 180, 80, 20, 0, WM_CF_SHOW, 0, 13); GUI_SetFont(&GUI_Font16B_ASCII); BUTTON_SetText(hTest_Key, "CLICK"); WM_SetStayOnTop(hTest_Key, 1); /* Station list */ Entries = 6;//countof(StationList) - 1; ySize = GUI_GetYDistOfFont(&GUI_Font16B_ASCII)*Entries; hStationListBox = LISTBOX_CreateEx(100, 10, 120, ySize, 0, WM_CF_SHOW, 0, 5, StationList); SCROLLBAR_CreateAttached(hStationListBox, SCROLLBAR_CF_VERTICAL); } while(1){ Key = GUI_GetKey(); //top = WM_GetStayOnTop(hTest_Key); switch(eGuiState){ case SELECT: switch (Key){ case 12: Item_nb = LISTBOX_GetSel(hStationListBox); if(Item_nb >= 0){ if(xQueueSendToBack(xListBoxQueue, &Item_nb, 50/portTICK_RATE_MS) == pdPASS){ /* OK button delete */ BUTTON_Delete(hOK_Button); GUI_SetBkColor(GUI_BLUE); GUI_ClearRect(120, 210, 200, 230); GUI_ClearKeyBuffer(); /* Listbox delete */ LISTBOX_Delete(hStationListBox); GUI_ClearRect(100, 10, 220, ySize+10); eGuiState = PLAYING; } } vTaskResume(xShoutcastTaskHandle); break; case 13: click_cnt++; GUI_SetFont(&GUI_Font16B_ASCII); Item_nb = LISTBOX_GetSel(hStationListBox); GUI_DispStringAt("CNT = ", 0, 210); GUI_DispDecSpace(Item_nb, 3); break; default: break; } break; case PLAYING: switch (Key){ case 13: click_cnt++; GUI_SetFont(&GUI_Font16B_ASCII); // Item_nb = LISTBOX_GetSel(hStationListBox); GUI_DispStringAt("CNT = ", 0, 210); GUI_DispDecSpace(123, 3); break; default: break; } } vTaskDelay(20/portTICK_RATE_MS); } }
/************************************************************************************** * FunctionName : _FillCalendar() * Description : 日历填写 * EntryParameter : None * ReturnValue : None **************************************************************************************/ void _FillCalendar(CLD_DAY *pDay, int year, U8 month, U8 day, U8 wekday) { const U8 cstmonth[][4] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEQ", "OCT", "NOV", "DEC" }; const U8 monthDay[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };//非闰年 const U8 monthDayLY[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };//闰年 int tmpWek; U8 i = 0; GUI_SetFont(&GUI_Font32_ASCII); GUI_SetColor(GUI_BLACK); // 设置蓝色 GUI_DispStringHCenterAt(cstmonth[month - 1], 120, 5); // 显示月份 GUI_GotoXY(170, 5); GUI_DispDecSpace(year, 5); //显示年份 最大可显示9999 tmpWek = wekday - (day % 7) + 1; // 获取本月第一天是星期几? if (tmpWek <= 0) tmpWek = 7 + wekday - (day % 7) + 1; for (i = 0; i < tmpWek; i++) // 存储上月的 { if (month == 1) { if ((year % 4) == 0 && (year % 100) != 0 || (year % 400) == 0)//闰年 pDay[i].Date = monthDayLY[12 - 1] - tmpWek + i + 1; else pDay[i].Date = monthDay[12 - 1] - tmpWek + i + 1; } else { if ((year % 4) == 0 && (year % 100) != 0 || (year % 400) == 0)//闰年 pDay[i].Date = monthDayLY[month - 2] - tmpWek + i + 1; else pDay[i].Date = monthDay[month - 2] - tmpWek + i + 1; } pDay[i].Color = GUI_GRAY; } if ((year % 4) == 0 && (year % 100) != 0 || (year % 400) == 0)//闰年 { for (i = 0; i < monthDayLY[month - 1]; i++) { pDay[i + tmpWek].Date = i + 1; // 存储本月的 pDay[i + tmpWek].Color = (day == i + 1) ? GUI_GREEN : GUI_BLACK; } } else { for (i = 0; i < monthDay[month - 1]; i++) { pDay[i + tmpWek].Date = i + 1; // 存储本月的 pDay[i + tmpWek].Color = (day == i + 1) ? GUI_GREEN : GUI_BLACK; } } if ((year % 4) == 0 && (year % 100) != 0 || (year % 400) == 0)//闰年 { for (i = 0; i < 42 - tmpWek - monthDayLY[month - 1]; i++) { if (month == 0x12) { pDay[i + tmpWek + monthDayLY[1 - 1]].Date = i + 1; } else { pDay[i + tmpWek + monthDayLY[month - 1]].Date = i + 1; // 存储下月的 } pDay[i + tmpWek + monthDayLY[month - 1]].Color = GUI_GRAY; } } else { for (i = 0; i < 42 - tmpWek - monthDay[month - 1]; i++) { if (month == 0x12) { pDay[i + tmpWek + monthDay[1 - 1]].Date = i + 1; } else { pDay[i + tmpWek + monthDay[month - 1]].Date = i + 1; // 存储下月的 } pDay[i + tmpWek + monthDay[month - 1]].Color = GUI_GRAY; } } for (i = 0; i < 42; i++) { GUI_SetFont(&GUI_Font24_ASCII); GUI_SetColor(pDay[i].Color); GUI_SetTextAlign(GUI_TA_HCENTER | GUI_TA_VCENTER); GUI_DispDecAt(pDay[i].Date, pDay[i].X, pDay[i].Y, ((pDay[i].Date > 10) ? 2 : 1)); } }