bdk: touch: refactor

And also use packet mode for big tx/rx combo i2c trasnfers.
This commit is contained in:
CTCaer
2026-02-20 00:43:58 +02:00
parent 0815ae9c58
commit f6bf40b903
3 changed files with 191 additions and 182 deletions

View File

@@ -1,7 +1,7 @@
/*
* USB Gadget HID driver for Tegra X1
*
* Copyright (c) 2019-2025 CTCaer
* Copyright (c) 2019-2026 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -315,7 +315,7 @@ typedef struct _touchpad_report_t
static bool _fts_touch_read(touchpad_report_t *rpt)
{
static touch_event touchpad;
static touch_event_t touchpad;
touch_poll(&touchpad);
@@ -323,24 +323,24 @@ static bool _fts_touch_read(touchpad_report_t *rpt)
rpt->count = 1;
// Decide touch enable.
switch (touchpad.type & STMFTS_MASK_EVENT_ID)
switch (touchpad.type & FTS4_MASK_EVENT_ID)
{
//case STMFTS_EV_MULTI_TOUCH_ENTER:
case STMFTS_EV_MULTI_TOUCH_MOTION:
//case FTS4_EV_MULTI_TOUCH_ENTER:
case FTS4_EV_MULTI_TOUCH_MOTION:
rpt->x = touchpad.x;
rpt->y = touchpad.y;
//rpt->z = touchpad.z;
rpt->id = touchpad.fingers ? touchpad.fingers - 1 : 0;
rpt->tip_switch = 1;
break;
case STMFTS_EV_MULTI_TOUCH_LEAVE:
case FTS4_EV_MULTI_TOUCH_LEAVE:
rpt->x = touchpad.x;
rpt->y = touchpad.y;
//rpt->z = touchpad.z;
rpt->id = touchpad.fingers ? touchpad.fingers - 1 : 0;
rpt->tip_switch = 0;
break;
case STMFTS_EV_NO_EVENT:
case FTS4_EV_NO_EVENT:
return false;
}