本文整理汇总了C++中GUI_GetTime函数的典型用法代码示例。如果您正苦于以下问题:C++ GUI_GetTime函数的具体用法?C++ GUI_GetTime怎么用?C++ GUI_GetTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GUI_GetTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _DemoSineWave
/*******************************************************************
*
* _DemoSineWave
*/
static void _DemoSineWave(void) {
PARAM Param;
I16 * pStart;
int t0, Cnt = 0;
GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
GUI_HMEM hMem = GUI_ALLOC_AllocZero(405 * sizeof(I16));
GUI_SetColor(GUI_WHITE);
GUI_SetBkColor(GUI_RED);
GUI_ClearRect(0, 55, LCD_XSIZE, 75);
GUI_SetFont(&GUI_FontComic18B_1);
GUI_DispStringAt("Sine wave", 20, 55);
pStart = GUI_ALLOC_h2p(hMem);
_GetSineData(pStart, 405);
GUI_SetFont(&GUI_Font6x8);
t0 = GUI_GetTime();
while((GUI_GetTime() - t0) < 10000) {
int t1, tDiff2;
if (Cnt++ % 90) {
Param.aY++;
} else {
Param.aY = pStart;
}
t1 = GUI_GetTime();
GUI_MEMDEV_Draw(&Rect, _Draw2, &Param, 0, 0);
tDiff2 = GUI_GetTime() - t1;
if (tDiff2 < 100) {
GUI_Delay(100 - tDiff2);
}
}
GUI_ALLOC_Free(hMem);
}
示例2: _GetPixelsPerSecond
/**
* @brief Get the number of pixels per second
* @param None
* @retval Pixels per second
*/
static U32 _GetPixelsPerSecond(void) {
GUI_COLOR Color, BkColor;
U32 x0, y0, x1, y1, xSize, ySize;
I32 t, t0;
U32 Cnt, PixelsPerSecond, PixelCnt;
/* Find an area which is not obstructed by any windows */
xSize = LCD_GetXSize();
ySize = LCD_GetYSize();
Cnt = 0;
x0 = 0;
x1 = xSize - 1;
y0 = 65;
y1 = ySize - 60 - 1;
Color = GUI_GetColor();
BkColor = GUI_GetBkColor();
GUI_SetColor(BkColor);
/* Repeat fill as often as possible in 100 ms */
t0 = GUI_GetTime();
do {
GUI_FillRect(x0, y0, x1, y1);
GUI_Exec();
Cnt++;
t = GUI_GetTime();
} while ((t - (t0 + 100)) <= 0);
/* Compute result */
t -= t0;
PixelCnt = (x1 - x0 + 1) * (y1 - y0 + 1) * Cnt;
PixelsPerSecond = PixelCnt / t * 1000;
GUI_SetColor(Color);
return PixelsPerSecond;
}
示例3: GUIDEMO_Delay
int GUIDEMO_Delay(int t) {
int r = 0;
#if GUI_WINSUPPORT
int tRem, tEnd = GUI_GetTime() + t;
PROGBAR_Handle hProg;
WM_SetForegroundWindow(_ahButton[0]);
hProg = (t >100) ? PROGBAR_Create(_FrameWinPosX[1] + 10,
_FrameWinPosY[1] + 25,
_FrameWinSizeX[1] - 20,
7,
WM_CF_SHOW|WM_CF_STAYONTOP) : 0;
#if GUI_SUPPORT_MEMDEV
PROGBAR_EnableMemdev(hProg);
#endif
PROGBAR_SetMinMax(hProg, 0, t);
for (; tRem = tEnd - GUI_GetTime(), (tRem > 0) && !GUIDEMO_CheckCancel();) {
PROGBAR_SetValue(hProg, t - tRem);
WM_ExecIdle();
GUI_Delay(10);
}
PROGBAR_Delete(hProg);
_UpdateCmdWin();
WM_ExecIdle();
#else
GUI_Delay(t);
#endif
return r;
}
示例4: _MoveCursor
/*********************************************************************
*
* _MoveCursor
*/
static void _MoveCursor(){
int x, y, tm, cnt = 0;
int yStep=-1;
int xPos,yPos;
xPos = LCD_GetXSize() / 2 - bmSeggerLogoBlue.XSize/2;
yPos = LCD_GetYSize() / 2 - bmSeggerLogoBlue.YSize/2+25;
GUI_DispStringHCenterAt("Cursor shape can be changed\nand the cursor can be moved", 160, 75);
GUI_CURSOR_Show();
GUI_DrawBitmap(&bmSeggerLogoBlue, xPos, yPos );
y = 150;
for (x = 0; x < 320; x++) {
if ((x % 54) == 0) {
GUI_CURSOR_Select(_apCursor[cnt++]);
}
tm = GUI_GetTime();
y += yStep;
if(y<=80) yStep=1;
if(y>=150) yStep=-1;
GUI_CURSOR_SetPosition(x, y);
while ((GUI_GetTime() - tm) < 10);
}
for (x = 320; x > 0; x--) {
tm = GUI_GetTime();
if ((x % 54) == 0) {
GUI_CURSOR_Select(_apCursor[cnt++]);
}
y += yStep;
if(y<=80) yStep=1;
if(y>=150) yStep=-1;
GUI_CURSOR_SetPosition(x, y);
while ((GUI_GetTime() - tm) < 10);
}
GUI_CURSOR_Hide();
GUI_Delay(500);
}
示例5: _DemoRandomGraph
static void _DemoRandomGraph(void) {
PARAM Param;
int tDiff, t0, Cnt = 0;
GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
GUI_HMEM hMem = GUI_ALLOC_AllocZero((LCD_XSIZE - 20) * sizeof(I16));
_ShowText("Random graph");
Param.aY = (I16*)GUI_ALLOC_h2p(hMem);
/*
GUI_SetFont(&GUI_Font6x8);
GUI_DispStringAt("msec/graph:", 10, 50);
*/
_LabelMS();
t0 = GUI_GetTime();
while(((tDiff = (GUI_GetTime() - t0)) < 10000) && !GUIDEMO_CheckCancel()) {
int t1, tDiff2;
_GetRandomData(Param.aY, tDiff, (LCD_XSIZE - 20));
t1 = GUI_GetTime();
GUI_MEMDEV_Draw(&Rect, _Draw, &Param, 0, GUI_MEMDEV_NOTRANS);
tDiff2 = GUI_GetTime() - t1;
if (tDiff2 < 100) {
GUI_Delay(100 - tDiff2);
}
if(!((++Cnt)%10)) {
_DisplayTime(tDiff2);
/*
GUI_GotoXY(80, 50);
GUI_SetColor(GUI_WHITE);
GUI_SetBkColor(GUI_RED);
GUI_DispDecSpace(tDiff2, 3);
*/
}
}
GUI_ALLOC_Free(hMem);
}
示例6: GUIDEMO_Delay
int GUIDEMO_Delay(int t) {
int r = 0;
#if GUI_WINSUPPORT
int tm, value;
#if GUIDEMO_LARGE
PROGBAR_Handle hProg;
#endif
WM_SetForegroundWindow(_ahButton[0]);
#if GUIDEMO_LARGE
hProg = (t >100) ? PROGBAR_CreateAsChild(10, 10, 60, 7, _ahInfoWin[1], 0,
WM_CF_SHOW | WM_CF_STAYONTOP| WM_CF_MEMDEV) : 0;
PROGBAR_SetMinMax(hProg, 0, t);
#endif
tm = GUI_GetTime();
do {
value = GUI_GetTime() - tm;
#if GUIDEMO_LARGE
PROGBAR_SetValue(hProg, value);
WM_ExecIdle();
#endif
GUI_Delay(10);
} while ((value < t) && !GUIDEMO_CheckCancel());
#if GUIDEMO_LARGE
PROGBAR_Delete(hProg);
#endif
_UpdateCmdWin();
WM_ExecIdle();
#else
GUI_Delay(t);
#endif
return r;
}
示例7: _DemoRandomGraph
/*******************************************************************
*
* _DemoRandomGraph
*/
static void _DemoRandomGraph(void) {
PARAM Param;
int tDiff, t0;
GUI_RECT Rect = {19, (LCD_YSIZE - 20) - YSIZE, (LCD_XSIZE - 2), (LCD_YSIZE - 21)};
GUI_HMEM hMem = GUI_ALLOC_AllocZero((LCD_XSIZE - 20) * sizeof(I16));
GUI_SetColor(GUI_WHITE);
GUI_SetBkColor(GUI_RED);
GUI_ClearRect(0, 55, LCD_XSIZE, 75);
GUI_SetFont(&GUI_FontComic18B_1);
GUI_DispStringAt("Random graph", 20, 55);
GUI_Lock();
Param.aY = GUI_ALLOC_h2p(hMem);
GUI_SetFont(&GUI_Font6x8);
t0 = GUI_GetTime();
while((tDiff = (GUI_GetTime() - t0)) < 10000) {
int t1, tDiff2;
_GetRandomData(Param.aY, tDiff, (LCD_XSIZE - 20));
t1 = GUI_GetTime();
GUI_MEMDEV_Draw(&Rect, _Draw, &Param, 0, 0);
tDiff2 = GUI_GetTime() - t1;
if (tDiff2 < 100) {
GUI_Delay(100 - tDiff2);
}
}
GUI_Unlock();
GUI_ALLOC_Free(hMem);
}
示例8: GUI_Delay
void GUI_Delay(int Period) {
int EndTime = GUI_GetTime()+Period;
int tRem; /* remaining Time */
while (tRem = EndTime- GUI_GetTime(), tRem>0) {
GUI_Exec();
GUI_X_Delay((tRem >5) ? 5 : tRem);
}
}
示例9: _cbFrameWinControl
/*********************************************************************
*
* _cbFrameWinControl
*/
static void _cbFrameWinControl(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int xSize;
int ySize;
int NCode;
int Id;
switch (pMsg->MsgId) {
case WM_KEY:
WM_SendMessage(WM_HBKWIN, pMsg);
break;
case WM_INIT_DIALOG:
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_PROGBAR0);
PROGBAR_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
PROGBAR_SetFont(hItem, &GUI_FontD6x8);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_HALT);
BUTTON_SetFocussable(hItem, 0);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_NEXT);
BUTTON_SetFocussable(hItem, 0);
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT0);
TEXT_SetText(hItem, "Intro");
TEXT_SetFont(hItem, &GUI_Font8_ASCII);
break;
case WM_PAINT:
xSize = WM_GetWindowSizeX(pMsg->hWin);
ySize = WM_GetWindowSizeY(pMsg->hWin);
GUI_DrawGradientV(0, 0, xSize - 1, ySize - 1, 0xFFFFFF, 0xDCCEC0);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch (NCode) {
case WM_NOTIFICATION_RELEASED:
switch (Id) {
case GUI_ID_HALT:
if (_Halt) {
_Halt = 0;
_HaltTime = GUI_GetTime() - _HaltTimeStart;
WM_MakeModal(0);
} else {
_Halt = 1;
_HaltTimeStart = GUI_GetTime() - _HaltTime;
WM_MakeModal(pMsg->hWin);
}
break;
case GUI_ID_NEXT:
_Next = 1; // Will be set to 0 by GUIDEMO_GetNextState()
_ClearHalt(); // Clear _Halt, so the next sample demonstrates immediately
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
}
}
示例10: Run_SpeedTest
/**
* @brief Run speed test
* @param None
* @retval Pixels per second
*/
static int Run_SpeedTest(void) {
int TimeStart, i;
U32 PixelsPerSecond;
unsigned aColorIndex[8];
int xSize, ySize, vySize;
GUI_RECT Rect, ClipRect;
xSize = LCD_GetXSize();
ySize = LCD_GetYSize();
vySize = LCD_GetVYSize();
#if GUI_SUPPORT_CURSOR
GUI_CURSOR_Hide();
#endif
if (vySize > ySize) {
ClipRect.x0 = 0;
ClipRect.y0 = 0;
ClipRect.x1 = xSize;
ClipRect.y1 = ySize;
GUI_SetClipRect(&ClipRect);
}
Stop_Test = 0;
for (i = 0; i< 8; i++) {
aColorIndex[i] = GUI_Color2Index(_aColor[i]);
}
TimeStart = GUI_GetTime();
for (i = 0; ((GUI_GetTime() - TimeStart) < 5000) &&( Stop_Test == 0); i++) {
GUI_SetColorIndex(aColorIndex[i&7]);
/* Calculate random positions */
Rect.x0 = rand() % xSize - xSize / 2;
Rect.y0 = rand() % ySize - ySize / 2;
Rect.x1 = Rect.x0 + 20 + rand() % xSize;
Rect.y1 = Rect.y0 + 20 + rand() % ySize;
GUI_FillRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1);
/* Clip rectangle to visible area and add the number of pixels (for speed computation) */
if (Rect.x1 >= xSize) {
Rect.x1 = xSize - 1;
}
if (Rect.y1 >= ySize) {
Rect.y1 = ySize - 1;
}
if (Rect.x0 < 0 ) {
Rect.x0 = 0;
}
if (Rect.y1 < 0) {
Rect.y1 = 0;
}
GUI_Exec();
/* Allow short breaks so we do not use all available CPU time ... */
}
PixelsPerSecond = _GetPixelsPerSecond();
GUI_SetClipRect(NULL);
return PixelsPerSecond;
}
示例11: _LiftUp
/*******************************************************************
*
* _LiftUp
*/
static void _LiftUp(int dy) {
int i, tm;
for (i = 0; i < (dy/4); i++) {
tm = GUI_GetTime();
WM_MoveWindow(_hWindow1, 0, -4);
WM_MoveWindow(_hWindow2, 0, -4);
while ((GUI_GetTime() - tm) < 20) {
WM_Exec();
}
}
}
示例12: _Wait
/*******************************************************************
*
* _Wait
*/
static int _Wait(int Delay) {
int EndTime, r = 1;
EndTime = GUI_GetTime() + Delay;
while (GUI_GetTime() < EndTime) {
GUI_Exec();
if (GUI_GetKey() == GUI_ID_OK) {
r = 0;
break;
}
}
return r;
}
示例13: MainTask
void MainTask(void) {
static GUI_PID_STATE OldState;
GUI_PID_STATE CurrentState;
int tEnd;
GUI_Init();
BUTTON_SetReactOnLevel();
//
// Check if recommended memory for the sample is available
//
if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) {
GUI_ErrorOut("Not enough memory available.");
return;
}
do {
WM_HWIN hButton0, hButton1;
WM_SetCallback(WM_HBKWIN, _cbBkWin);
hButton0 = _CreateButton(100, 220, 170, 150, 5, 25, "Dashboard" , &bmDashboard , GUI_ID_BUTTON0);
hButton1 = _CreateButton(370, 220, 170, 150, 5, 25, "Cash Terminal", &bmCashTerminal, GUI_ID_BUTTON1);
WM_SetFocus(hButton0);
tEnd = GUI_GetTime() + 4000;
do {
GUI_PID_GetState(&CurrentState);
if ((OldState.x != CurrentState.x) || (OldState.y != CurrentState.y)) {
tEnd = GUI_GetTime() + 10000;
}
OldState = CurrentState;
GUI_Delay(100);
if (GUI_GetTime() >= tEnd) {
if (_AppSelectionOld) {
_AppSelection = ((_AppSelectionOld - 1) ^ 1) + 1;
} else {
_AppSelection = APP_DASHBOARD;
}
}
} while (!_AppSelection && !_Break);
WM_DeleteWindow(hButton0);
WM_DeleteWindow(hButton1);
if (!_Break) {
switch (_AppSelection) {
case APP_DASHBOARD:
AppDashBoard();
break;
case APP_CASHTERMINAL:
AppCashTerminal();
break;
}
GUI_CURSOR_Hide();
_AppSelectionOld = _AppSelection;
_AppSelection = 0;
}
} while (!_Break);
}
示例14: GUIDEMO_Speed
void GUIDEMO_Speed(void) {
int t = GUI_GetTime();
int i = 0;
int XSize = LCD_GET_XSIZE();
int YSize = LCD_GET_YSIZE();
I32 NumPixels=0;
U16 aColorIndex[8];
GUIDEMO_ShowIntro("High speed",
"Multi layer clipping"
"\nHighly optimized drivers"
);
for (i = 0; i< 8; i++) {
aColorIndex[i] = GUI_Color2Index(_aColor[i]);
}
for (i = 0; (((t + 8000) - (int)GUI_GetTime()) > 0) && !GUIDEMO_CheckCancel(); i++) {
GUI_RECT r;
GUI_SetColorIndex(aColorIndex[i&7]);
/* Calculate random positions */
r.x0 = rand() % XSize - XSize / 2;
r.y0 = rand() % YSize - YSize / 2;
r.x1 = r.x0 + rand() % XSize;
r.y1 = r.y0 + rand() % YSize;
GUI_FillRect(r.x0, r.y0, r.x1, r.y1);
/* Clip rectangle to visible area and add the number of pixels (for speed computation) */
if (r.x1 >= XSize)
r.x1 = XSize - 1;
if (r.y1 >= YSize)
r.y1 = YSize - 1;
if (r.x0 < 0 )
r.x0 = 0;
if (r.y1 < 0)
r.y1 = 0;
NumPixels += (r.x1 - r.x0) * (r.y1 - r.y0);
/* Allow short breaks so we do not use all available CPU time ... */
}
t = (GUI_GetTime() - t) / 100;
GUI_Clear();
GUIDEMO_NotifyStartNext();
#if GUIDEMO_LARGE
GUI_SetFont(&GUI_FontComic24B_ASCII);
#else
GUI_SetFont(&GUI_Font16B_ASCII);
#endif
GUI_SetColor(GUI_WHITE);
GUI_DispStringAt("Pixels/sec: ", 10, (LCD_GetYSize() - GUI_GetFontSizeY()) / 2);
if (t == 0)
t++;
GUI_DispDecMin(10 * (NumPixels / t));
GUIDEMO_Wait();
}
示例15: MainTask
void MainTask(void) {
int Cnt;
int TestTime;
GUI_Init();
while(1) {
Cnt = 0;
TestTime = GUI_GetTime() + 1000;
while ((TestTime - GUI_GetTime()) >= 0) {
_CalcPrimes(sizeof(_aIsPrime));
Cnt++;
}
_PrintResult(Cnt);
}
}