Android 下 GT9XX 交换XY坐标的研究
2023-04-21 10:41:13
ThanksView
  • 访问次数: 222
  • 注册日期: 2019-03-19
  • 最后登录: 2024-04-22

GT9XX.h

//***************************PART1:ON/OFF define*******************************

#define GTP_CUSTOM_CFG        0
#define GTP_CHANGE_X2Y        1       //swap x y
+ #define GTP_REVERSE_X         1       //REVERSE x
+ #define GTP_REVERSE_Y         0       //REVERSE Y
#define GTP_DRIVER_SEND_CFG   0       //driver send config
#define GTP_HAVE_TOUCH_KEY    0
#define GTP_POWER_CTRL_SLEEP  0    //power off when suspend


gt9xx.c

static void gtp_touch_down(struct goodix_ts_data* ts, s32 id, s32 x, s32 y, s32 w)
{
#if GTP_CHANGE_X2Y
    GTP_SWAP(x, y);
#endif

//+++++++++++++++++++++++++++++++++++++++++++++

#if GTP_REVERSE_X
    x = ts->abs_x_max-x;
#endif

#if GTP_REVERSE_Y
    y = ts->abs_y_max-y;
#endif
//+++++++++++++++++++++++++++++++++++++++++++++


#if GTP_ICS_SLOT_REPORT
    input_mt_slot(ts->input_dev, id);
    input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
    input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w);
    input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
#else
    input_report_key(ts->input_dev, BTN_TOUCH, 1);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
    input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w);
    input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
    input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
    input_mt_sync(ts->input_dev);
#endif

    GTP_DEBUG("ID:%d, X:%d, Y:%d, W:%d", id, x, y, w);
}

三维半岛官网: http://www.thanksview.com

进入首页