Skip to content

Commit

Permalink
chore(mouse): Save one more byte for PTP reports.
Browse files Browse the repository at this point in the history
  • Loading branch information
petejohanson committed Apr 7, 2024
1 parent ea8b028 commit e41fe73
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/include/zmk/mouse/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static const uint8_t zmk_mouse_hid_report_desc[] = {
HID_LOGICAL_MAX8(0x05),

HID_REPORT_COUNT(1),
HID_REPORT_SIZE(8),
HID_REPORT_SIZE(4),
HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_ABS),

// Button report
Expand All @@ -173,7 +173,7 @@ static const uint8_t zmk_mouse_hid_report_desc[] = {
HID_REPORT_COUNT(3),
HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_ABS),
// Byte Padding
HID_REPORT_COUNT(5),
HID_REPORT_COUNT(1),
HID_INPUT(ZMK_HID_MAIN_VAL_CONST | ZMK_HID_MAIN_VAL_ARRAY | ZMK_HID_MAIN_VAL_ABS),

// Device Capabilities Feature Report
Expand Down Expand Up @@ -261,8 +261,7 @@ struct zmk_hid_mouse_report {
#endif // IS_ENABLED(CONFIG_ZMK_MOUSE)

#if IS_ENABLED(CONFIG_ZMK_TRACKPAD)
// Reporting structure from osmakari
// Report for single finger

struct zmk_ptp_finger {
// Touch Valid (bit 0) and tip switch (bit 1)
uint8_t touch_valid : 1;
Expand All @@ -282,9 +281,13 @@ struct zmk_hid_ptp_report_body {
// scantime
uint16_t scan_time;
// Contact count
uint8_t contact_count;
uint8_t contact_count : 4;
// Buttons
uint8_t buttons;
uint8_t button1 : 1;
uint8_t button2 : 1;
uint8_t button3 : 1;

uint8_t padding : 1;
} __packed;

// Report containing finger data
Expand Down Expand Up @@ -361,7 +364,6 @@ struct zmk_hid_mouse_report *zmk_mouse_hid_get_mouse_report();
int zmk_mouse_hid_set_ptp_finger(struct zmk_ptp_finger finger);
void zmk_mouse_hid_ptp_update_scan_time(void);
void zmk_mouse_hid_ptp_clear_lifted_fingers(void);
// void zmk_mouse_hid_ptp_clear(void);

struct zmk_hid_ptp_report *zmk_mouse_hid_get_ptp_report();

Expand Down

0 comments on commit e41fe73

Please sign in to comment.