Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- SHLIU1@OANBE02333.nuvoton.com
- Date:
- 2021-02-25
- Revision:
- 4:3d28c66231b0
- Parent:
- 0:9d0785906425
- Child:
- 6:d15151941247
File content as of revision 4:3d28c66231b0:
#include "mbed.h"
#include "GUI.h"
#include "WM.h"
#include "FRAMEWIN.h"
#include "M48XTouchPanel.h"
#include "tslib.h"
//
// Enable emWin touch feature after calibration
//
volatile int g_enable_Touch;
//
// For touch sampling timer
//
Ticker s_ticker_emWinloop;
//
// emWin timer count
//
extern GUI_TIMER_TIME OS_TimeMS;
//
// Tick loop for emWin and touch
//
void task_emWinloop(void)
{
OS_TimeMS++;
#if GUI_SUPPORT_TOUCH
if ( OS_TimeMS % 10 == 0 )
{
if ( g_enable_Touch == 1 )
{
GUI_TOUCH_Exec();
}
}
#endif
}
//
// Extern emWin GUI layout
//
extern WM_HWIN CreateFramewin(void);
//
// emWin MainTask to create a GUI layout
//
void MainTask(void)
{
WM_HWIN hWin;
char acVersion[40] = "Framewin: Version of emWin: ";
printf("Main Task -> \n");
strcat(acVersion, GUI_GetVersionString());
hWin = CreateFramewin();
FRAMEWIN_SetText(hWin, acVersion);
while (1)
{
GUI_Delay(500);
}
}
//
// Main
//
int main(void)
{
#ifdef MBED_MAJOR_VERSION
printf("Mbed OS version %d.%d.%d\r\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
#endif
//
// Before touch calibration
//
g_enable_Touch = 0;
//
// Attach Mbed tick
//
s_ticker_emWinloop.attach(&task_emWinloop, 0.001);
#if GUI_SUPPORT_TOUCH
//
// Init emWin and touch calibration
//
GUI_Init();
Init_TouchPanel();
ts_calibrate(__DEMO_TS_WIDTH__, __DEMO_TS_HEIGHT__);
#endif
//
// After touch calibration
//
g_enable_Touch = 1;
//
// Create GUI layout
//
MainTask();
while(1);
}