Skip to content

Commit

Permalink
Working 5 finger
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFil committed Feb 15, 2024
1 parent c9557ec commit 8f2432f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 8 additions & 0 deletions app/include/zmk/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ static const uint8_t zmk_hid_report_desc[] = {
HID_INPUT(0x02),
HID_END_COLLECTION,
// Finger 1
HID_USAGE_PAGE(HID_USAGE_DIGITIZERS),
HID_USAGE(HID_USAGE_DIGITIZERS_FINGER),
HID_COLLECTION(HID_COLLECTION_LOGICAL),
HID_LOGICAL_MIN8(0),
HID_LOGICAL_MAX8(1),
Expand Down Expand Up @@ -313,6 +315,8 @@ static const uint8_t zmk_hid_report_desc[] = {
HID_END_COLLECTION,

// Finger 2
HID_USAGE_PAGE(HID_USAGE_DIGITIZERS),
HID_USAGE(HID_USAGE_DIGITIZERS_FINGER),
HID_COLLECTION(HID_COLLECTION_LOGICAL),
HID_LOGICAL_MIN8(0),
HID_LOGICAL_MAX8(1),
Expand Down Expand Up @@ -375,6 +379,8 @@ static const uint8_t zmk_hid_report_desc[] = {
HID_END_COLLECTION,

// Finger 3
HID_USAGE_PAGE(HID_USAGE_DIGITIZERS),
HID_USAGE(HID_USAGE_DIGITIZERS_FINGER),
HID_COLLECTION(HID_COLLECTION_LOGICAL),
HID_LOGICAL_MIN8(0),
HID_LOGICAL_MAX8(1),
Expand Down Expand Up @@ -437,6 +443,8 @@ static const uint8_t zmk_hid_report_desc[] = {
HID_END_COLLECTION,

// Finger 4
HID_USAGE_PAGE(HID_USAGE_DIGITIZERS),
HID_USAGE(HID_USAGE_DIGITIZERS_FINGER),
HID_COLLECTION(HID_COLLECTION_LOGICAL),
HID_LOGICAL_MIN8(0),
HID_LOGICAL_MAX8(1),
Expand Down
12 changes: 7 additions & 5 deletions app/src/trackpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@ struct k_work_q *zmk_trackpad_work_q() {

static void zmk_trackpad_tick(struct k_work *work) {
if (mousemode) {
LOG_DBG("Mouse sender running");
// LOG_DBG("Mouse sender running");
zmk_hid_mouse_set(btns, xDelta, yDelta, scrollDelta);
zmk_endpoints_send_mouse_report();
} else if (surface_mode) {

LOG_DBG("Trackpad sender running");
zmk_hid_ptp_set((contacts_to_send && BIT(0)) ? fingers[0] : empty_finger,
(contacts_to_send && BIT(1)) ? fingers[1] : empty_finger,
// LOG_DBG("Trackpad sender running");
LOG_DBG("total contacts: %d, received contacts: %d, bitmap contacts %d", present_contacts,
received_contacts, contacts_to_send);

zmk_hid_ptp_set((contacts_to_send && BIT(0)) ? fingers[0] : empty_finger, empty_finger,
(contacts_to_send && BIT(2)) ? fingers[2] : empty_finger,
(contacts_to_send && BIT(3)) ? fingers[3] : empty_finger,
(contacts_to_send && BIT(4)) ? fingers[4] : empty_finger, present_contacts,
Expand All @@ -66,7 +68,7 @@ static void zmk_trackpad_tick(struct k_work *work) {
return;
} else if (!surface_mode) {
// report buttons only
LOG_DBG("Trackpad button thing trigd");
/// LOG_DBG("Trackpad button thing trigd");
zmk_hid_ptp_set(empty_finger, empty_finger, empty_finger, empty_finger, empty_finger, 0,
scantime, button_mode ? btns : 0);
zmk_endpoints_send_ptp_report();
Expand Down

0 comments on commit 8f2432f

Please sign in to comment.