Shanling Q1: enable multi-touch reporting

The FT6x06 driver used for the Shanling Q1's touchscreen
has been extended to report more than one touch point. It
can also return the gesture detected by the controller,
but this doesn't seem to report anything useful on the Q1.

Multi-touch is only useful in 3x3 grid mode since the Rockbox
button API cannot report more than one touch point.

The FiiO M3K uses the same driver so it's been updated to the
multi-touch API, but functionality is unchanged.

Change-Id: I4de42f44808d6eb902e3da212d8f936b7a5042c7
This commit is contained in:
Aidan MacDonald 2021-11-20 19:05:16 +00:00
parent b39acee3ab
commit 44acbc6629
7 changed files with 140 additions and 45 deletions

View file

@ -24,6 +24,7 @@
#define HAVE_I2C_ASYNC
#define HAVE_FT6x06
#define FT6x06_SWAP_AXES
#define FT6x06_NUM_POINTS 1
/* Buffer for plugins and codecs. */
#define PLUGIN_BUFFER_SIZE 0x200000 /* 2 MiB */

View file

@ -59,6 +59,7 @@
#define HAVE_TOUCHSCREEN
#define HAVE_BUTTON_DATA
#define HAVE_FT6x06
#define FT6x06_NUM_POINTS 5
#define HAVE_HEADPHONE_DETECTION
/* Storage defines */

View file

@ -25,14 +25,6 @@
#include "config.h"
#include <stdbool.h>
typedef void(*ft6x06_event_cb)(int, int, int);
struct ft6x06_state {
int event;
int pos_x;
int pos_y;
};
enum ft6x06_event {
FT6x06_EVT_NONE = -1,
FT6x06_EVT_PRESS = 0,
@ -40,8 +32,25 @@ enum ft6x06_event {
FT6x06_EVT_CONTACT = 2,
};
struct ft6x06_point {
int event;
int touch_id;
int pos_x;
int pos_y;
int weight;
int area;
};
struct ft6x06_state {
int gesture;
int nr_points;
struct ft6x06_point points[FT6x06_NUM_POINTS];
};
extern struct ft6x06_state ft6x06_state;
typedef void(*ft6x06_event_cb)(struct ft6x06_state* state);
void ft6x06_init(void);
void ft6x06_set_event_cb(ft6x06_event_cb fn);
void ft6x06_enable(bool en);