
Oct. 04, 2018
Page
11
of 18
Rev 1.00
M480 emWin
In the emWin_SimpleDemo_SD, a preprocessor symbol __USE_SD__ is defined to build the
sample and use a SD card to store the calibration parameter as shown below.
The touch resolution and the APROM offset store calibration parameters in the
M48XTouchPanel.h.
#ifndef __M48XTOUCHPANEL_H__
#define __M48XTOUCHPANEL_H__
#define __DEMO_TSFILE_ADDR__ 0x00040000
/* APROM offset */
#define __DEMO_TS_WIDTH__ 320
#define __DEMO_TS_HEIGHT__ 240
#endif
If APROM is used to store the calibration parameter, main function will load the parameter
from APROM. If the parameter doesn
’t exist, main function will call ts_calibrate() to generate
a copy.
/* Unlock protected registers */
SYS_UnlockReg();
/* Enable FMC ISP function */
FMC_Open();
/* If calibration parameter exists, call ts_calibrate to generate a copy */
if (FMC_Read(__DEMO_TSFILE_ 0x1C) != 0x55AAA55A)
{
FMC_ENABLE_AP_UPDATE();
ts_calibrate(__DEMO_TS_WIDTH__, __DEMO_TS_HEIGHT__);
// Erase page
FMC_Erase(__DEMO_TSFILE_ADDR__);
ts_writefile();
FMC_DISABLE_AP_UPDATE();
}
else
{