gui_x.c
来自「GUI多任务测试 测试程序 MT_MultiTasking.c」· C语言 代码 · 共 143 行
C
143 行
/*
*********************************************************************************************************
* uC/GUI
* Universal graphic software for embedded applications
*
* (c) Copyright 2002, Micrium Inc., Weston, FL
* (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
* 礐/GUI is protected by international copyright laws. Knowledge of the
* source code may not be used to write a similar product. This file may
* only be used in accordance with a license and should not be redistributed
* in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File : GUI_X.C
Purpose : Config / System dependent externals for GUI
---------------------------END-OF-HEADER------------------------------
*/
#include "includes.h"
#include "GUI.h"
#include "GUI_X.h"
#include "TScreen.h"
static OS_EVENT *DispSem;
static OS_EVENT *EventMbox;
static OS_EVENT *KeySem;
static int KeyPressed;
static char KeyIsInited;
/*********************************************************************
*
* Global data
*/
//volatile int OS_TimeMS;
/*********************************************************************
*
* Timing:
* GUI_X_GetTime()
* GUI_X_Delay(int)
Some timing dependent routines of emWin require a GetTime
and delay function. Default time unit (tick), normally is
1 ms.
*/
int GUI_X_GetTime(void)
{
return ((int)OSTimeGet());
}
void GUI_X_Delay(int period)
{
INT32U ticks;
ticks = (period * 1000) / OS_TICKS_PER_SEC;
OSTimeDly((INT16U)ticks);
}
void GUI_X_Unlock(void)
{
OSSemPost(DispSem);
}
void GUI_X_Lock(void)
{
U8 err;
OSSemPend(DispSem, 0, &err);
}
U32 GUI_X_GetTaskId(void)
{
return ((U32)(OSTCBCur->OSTCBPrio)); /* < 64(任务优先级) */
}
void GUI_X_WaitEvent (void)
{
INT8U err;
(void)OSMboxPend(EventMbox, 0, &err);
}
void GUI_X_SignalEvent (void)
{
(void)OSMboxPost(EventMbox, (void *)1);
}
void GUI_X_InitOS(void)
{
DispSem = OSSemCreate(1);
EventMbox = OSMboxCreate((void *)0);
}
/*********************************************************************
*
* GUI_X_Init()
*
* Note:
* GUI_X_Init() is called from GUI_Init is a possibility to init
* some hardware which needs to be up and running before the GUI.
* If not required, leave this routine blank.
*/
void GUI_X_Init(void) {
SetTSInterrupt();
GUI_TOUCH_SetDefaultCalibration();
/*
#if TOUCH_NEED_CALIBRATE
GUI_X_ExecCalibration();
#endif
*/
}
void GUI_TOUCH_X_ActivateX(void) {}
void GUI_TOUCH_X_ActivateY(void) {}
int GUI_TOUCH_X_MeasureX(void) {
return TX;
}
int GUI_TOUCH_X_MeasureY(void){
return TY;
}
/*********************************************************************
*
* GUI_X_ExecIdle
*
* Note:
* Called if WM is in idle state
*/
void GUI_X_ExecIdle(void) {GUI_X_Delay(1);}
/*********************************************************************
*
* Logging: Publics referenced by upper layers
*
Note:
These routines are needed only in higher debug levels.
*/
void GUI_X_Log(const char *s) {}
void GUI_X_ErrorOut(const char *s){}
void GUI_X_Warn(const char *s){}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?