【iCore4 雙核心板】4.3寸液晶模組程式釋出

XiaomaGee發表於2017-07-10

一、說明

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();
    }
}

 

相關文章