【iCore4 双核心板】4.3寸液晶模块程序发布

一、说明

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(115200); BSP_SDRAM_Init(); lcd.initialize(); ads7843.initialize(); //GUI初始化 GUI_Init(); GUI_SetBkColor(GUI_BLACK);               GUI_Clear(); pwm.initialize(80); //液晶亮度设置 GUI_Delay(100); LCD_ON; //打开液晶 if(BSP_SD_Init() != 0){ //SD卡初始化 GUI_SetColor(GUI_RED); GUI_SetFont(&GUI_FontFixedsys16); GUI_DispStringHCenterAt("SD Error!",480/2,272/2); while(1){ } } res = f_mount(&fatfs,"0:",1); if(res != RES_OK){ GUI_SetColor(GUI_RED); GUI_SetFont(&GUI_FontFixedsys16); GUI_DispStringHCenterAt("f_mount Error!",480/2,272/2); while(1){ } } 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(50,70,220,185);
        gui_frame(260,70,430,185);

        GUI_SetColor(GUI_BLACK);
        GUI_SetFont(&GUI_FontFixedsys16);
        GUI_DispStringAt("X Position",65,62);
        GUI_DispStringAt("Y Position",275,62);
        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[0]);
        TEXT_SetTextColor(hItem, GUI_WHITE);
        TEXT_SetFont(hItem, &GUI_FontFixedsys16);
        
        hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_1);
        TEXT_SetText(hItem, message[1]);
        TEXT_SetTextColor(hItem, GUI_WHITE);
        TEXT_SetFont(hItem, &GUI_FontFixedsys16);        
    
        hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
        EDIT_SetDecMode(hItem,pen.x0,0,479,0,0);
        EDIT_SetText(hItem, "000");
        EDIT_SetFocussable(hItem,0);
        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,0,271,0,0);
        EDIT_SetText(hItem, "271");
        EDIT_SetFocussable(hItem,0);
        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, 0, 0);
    while(1){
        if(touch_flag == 1){
            touch_flag = 0;
            EDIT_SetValue(h_edit_0,pen.x0);
            EDIT_SetValue(h_edit_1,pen.y0);
        }
        GUI_Exec();
    }
}

 

posted @ 2017-07-10 11:57  XiaomaGee  阅读(1116)  评论(0编辑  收藏  举报