一、说明
1、本资料包程序包含两部分,"CAPTURE"为液晶显示截图,"tft4.3"为ARM程序。
2、此程序只适合iCore4液晶模块。
3、iCore4液晶界面显示基于STemWin5.32。
二、界面截图
1、上电从SD卡检测触摸校准文件,若校准文件不存在,直接进入校准界面进行触摸校准,若校准文件存在,可选择进入校准界面。
2、液晶显示与触摸测试,用触摸笔点击屏幕任何地方,则在界面上显示此处横纵坐标值。
三、代码包下载地址
链接:http://pan.baidu.com/s/1eR6vQJw 密码:vmoe
四、预定
五:核心代码
int main(void)
{
FRESULT res; __HAL_RCC_CRC_CLK_ENABLE(); //初始化
system_clock.initialize();
led.initialize();
usart6.initialize();
BSP_SDRAM_Init();
lcd.initialize();
ads7843.initialize();
//GUI初始化
GUI_Init();
GUI_SetBkColor(GUI_BLACK);
GUI_Clear(); pwm.initialize(); //液晶亮度设置
GUI_Delay();
LCD_ON; //打开液晶 if(BSP_SD_Init() != ){ //SD卡初始化
GUI_SetColor(GUI_RED);
GUI_SetFont(&GUI_FontFixedsys16);
GUI_DispStringHCenterAt("SD Error!",/,/);
while(){
}
}
res = f_mount(&fatfs,"0:",);
if(res != RES_OK){
GUI_SetColor(GUI_RED);
GUI_SetFont(&GUI_FontFixedsys16);
GUI_DispStringHCenterAt("f_mount Error!",/,/);
while(){
}
}
power_on.check_touch(); //检查触摸校准文件 frame.process(); //界面处理
}
static void _cbDialog(WM_MESSAGE * pMsg)
{
WM_HWIN hItem;
const void *pData;
unsigned long int FileSize; switch (pMsg->MsgId) {
case WM_PAINT:
gui_frame(,,,);
gui_frame(,,,); GUI_SetColor(GUI_BLACK);
GUI_SetFont(&GUI_FontFixedsys16);
GUI_DispStringAt("X Position",,);
GUI_DispStringAt("Y Position",,);
break;
case WM_INIT_DIALOG:
hItem = pMsg->hWin;
WINDOW_SetBkColor(hItem, 0x00CECECE); hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_0);
pData = _GetImageById(ID_IMAGE_0_IMAGE_0, &FileSize);
IMAGE_SetBMP(hItem, pData, FileSize); hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_1);
pData = _GetImageById(ID_IMAGE_1_IMAGE_0, &FileSize);
IMAGE_SetBMP(hItem, pData, FileSize); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
TEXT_SetText(hItem, message[]);
TEXT_SetTextColor(hItem, GUI_WHITE);
TEXT_SetFont(hItem, &GUI_FontFixedsys16); hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
TEXT_SetText(hItem, message[]);
TEXT_SetTextColor(hItem, GUI_WHITE);
TEXT_SetFont(hItem, &GUI_FontFixedsys16); hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
EDIT_SetDecMode(hItem,pen.x0,,,,);
EDIT_SetText(hItem, "");
EDIT_SetFocussable(hItem,);
EDIT_SetBkColor(hItem,EDIT_CI_ENABLED,GUI_BLACK);
EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, GUI_GREEN);
EDIT_SetFont(hItem, GUI_FONT_D64);
h_edit_0 = hItem; hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1);
EDIT_SetDecMode(hItem,pen.y0,,,,);
EDIT_SetText(hItem, "");
EDIT_SetFocussable(hItem,);
EDIT_SetBkColor(hItem,EDIT_CI_ENABLED,GUI_BLACK);
EDIT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
EDIT_SetTextColor(hItem, EDIT_CI_ENABLED, GUI_GREEN);
EDIT_SetFont(hItem, GUI_FONT_D64);
h_edit_1 = hItem;
break;
case WM_NOTIFY_PARENT: break;
default:
WM_DefaultProc(pMsg);
break;
}
}
static void frame_process(void)
{
GUI_CURSOR_Show();
WM_SetCreateFlags(WM_CF_MEMDEV);
GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, , );
while(){
if(touch_flag == ){
touch_flag = ;
EDIT_SetValue(h_edit_0,pen.x0);
EDIT_SetValue(h_edit_1,pen.y0);
}
GUI_Exec();
}
}