1. 程式人生 > >訊為itop4412開發板觸控式螢幕除錯

訊為itop4412開發板觸控式螢幕除錯

由於不同觸控式螢幕的xy座標會有不同,有時候xy座標需要反過來。下面的程式碼會告訴你怎樣調整xy座標。
程式碼分析
驅動位置:drivers/input/touchscreen/ft5x06_ts.c

static int __init ft5x0x_ts_init(void)
{
    int ret;
    int type;

    type = get_lcd_type();

#if 1
        //TP1_EN
    //printk("==%s: TP1_EN==\n", __FUNCTION__);
        ret = gpio_request(EXYNOS4_GPL0(2
), "TP1_EN"); if (ret) { printk(KERN_ERR "failed to request TP1_EN for " "I2C control\n"); //return err; } gpio_direction_output(EXYNOS4_GPL0(2), 1); s3c_gpio_cfgpin(EXYNOS4_GPL0(2), S3C_GPIO_OUTPUT); gpio_free(EXYNOS4_GPL0(2
)); mdelay(5); #endif #if 1 printk("==%s: reset==\n", __FUNCTION__); ret = gpio_request(EXYNOS4_GPX0(3), "GPX0_3"); if (ret) { gpio_free(EXYNOS4_GPX0(3)); ret = gpio_request(EXYNOS4_GPX0(3), "GPX0_3"); if(ret) { printk("ft5xox: Failed to request GPX0_3 \n"
); } } gpio_direction_output(EXYNOS4_GPX0(3), 0); mdelay(200); gpio_direction_output(EXYNOS4_GPX0(3), 1); s3c_gpio_cfgpin(EXYNOS4_GPX0(3), S3C_GPIO_OUTPUT); gpio_free(EXYNOS4_GPX0(3)); msleep(300); #endif //type = get_lcd_type(); if(0x00 == type) //9.7 { TOUCH_MAX_X = 1024; TOUCH_MAX_Y = 768; #ifdef CONFIG_VT //for Ubuntu touch_size = 1; scal_xy = 1; #else touch_size = 0; scal_xy = 1; #endif } else if(0x01 == type) //7.0 { #ifdef CONFIG_VT //for Ubuntu TOUCH_MAX_X = 800;//1280; TOUCH_MAX_Y = 1280;//800; scal_xy = 1; touch_size = 0; #else touch_size = 1;//0; swap_xy ===》在這裡控制觸控式螢幕的xy座標翻轉 #endif } else if(0x02 == type) //4.3 { ; } if(1 == touch_size) { swap_xy = 1; } else { swap_xy = 0; } return i2c_add_driver(&ft5x0x_ts_driver); }