讯为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);
}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值