新手上路
- 积分
- 27
- 金钱
- 27
- 注册时间
- 2016-8-29
- 在线时间
- 12 小时
|
10金钱
[mw_shl_code=c,true]void LCD_X_Config(void) {
// GUI_DEVICE * pDevice;
// CONFIG_FLEXCOLOR Config = {0};
// GUI_PORT_API PortAPI = {0};
//
// Set display driver and color conversion
GUI_DEVICE_CreateAndLink(&GUIDRV_Template_API, GUICC_565, 0, 0);
//
// Display driver configuration, required for Lin-driver
LCD_SetSizeEx (0, t_lcddev.width , t_lcddev.height );
LCD_SetVSizeEx(0, t_lcddev.width +1, t_lcddev.height );
if (t_lcddev.id == 0x9341)
{
if (t_lcddev.dir == 0) //竖屏
{
GUI_TOUCH_Calibrate(GUI_COORD_X, 0, 240, 155, 3903);
GUI_TOUCH_Calibrate(GUI_COORD_Y, 0, 320, 188, 3935);
} else //横屏
{
GUI_TOUCH_SetOrientation(GUI_SWAP_XY | GUI_MIRROR_Y);
GUI_TOUCH_Calibrate(GUI_COORD_X, 0, 240 , 155, 3903);
GUI_TOUCH_Calibrate(GUI_COORD_Y, 0, 320 , 188, 3935);
}
}
}[/mw_shl_code]
这里的触摸屏与显示屏的校准出现问题,且问题只在横屏中有。
竖屏显示是正常的。但是横屏却会出现y轴坐标最多识别到240处,再向右走就没反应了!
用的原子的触摸值检测代码:
[mw_shl_code=c,true]void Mytouch_MainTask(void)
{
static GUI_PID_STATE TouchState;
static int xPhys, yPhys;
GUI_Init();
GUI_SetFont(&GUI_Font20_ASCII);
GUI_CURSOR_Show();
GUI_CURSOR_Select(&GUI_CursorCrossL);
GUI_SetColor(GUI_WHITE);
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
GUI_DispString("Measurement of\nA|D converter values");
while(1)
{
GUI_TOUCH_GetState(&TouchState);
xPhys = GUI_TOUCH_GetxPhys(); //Get the A|D measurement result in x
yPhys = GUI_TOUCH_GetyPhys(); //
GUI_SetColor(GUI_BLUE);
GUI_DispStringAt("Analog input:\n", 0 , 40);
GUI_GotoY(GUI_GetDispPosY() + 2);
GUI_DispString("x:");
GUI_DispDec( xPhys , 4 );
GUI_DispString("y:");
GUI_DispDec( yPhys , 4 );
GUI_SetColor(GUI_RED);
GUI_GotoY(GUI_GetDispPosY() + 4);
GUI_DispString("\nPosition:\n");
GUI_GotoY(GUI_GetDispPosY() + 2);
GUI_DispString("x:");
GUI_DispDec( TouchState.x , 4 );
GUI_DispString("y:");
GUI_DispDec( TouchState.y , 4 );
Delay_ms(50);
}
return ;
}[/mw_shl_code]
求@zuozhongkai @正点原子
|
|