Skip to content

Commit

Permalink
feat(hid): Multi touch trackpad reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFil committed Aug 15, 2023
1 parent c957348 commit ea35501
Show file tree
Hide file tree
Showing 10 changed files with 732 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/usb.c)
target_sources_ifdef(CONFIG_ZMK_USB app PRIVATE src/usb_hid.c)
target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c)
target_sources_ifdef(CONFIG_ZMK_BACKLIGHT app PRIVATE src/backlight.c)
target_sources_ifdef(CONFIG_ZMK_TRACKPAD app PRIVATE src/trackpad.c)
target_sources(app PRIVATE src/workqueue.c)
target_sources(app PRIVATE src/main.c)

Expand Down
62 changes: 62 additions & 0 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ config ZMK_BLE_CONSUMER_REPORT_QUEUE_SIZE
int "Max number of consumer HID reports to queue for sending over BLE"
default 5

config ZMK_BLE_PTP_REPORT_QUEUE_SIZE
int "Max number of trackpad HID reports to queue for sending over BLE"
default 20

config ZMK_BLE_CLEAR_BONDS_ON_START
bool "Configuration that clears all bond information from the keyboard on startup."
default n
Expand Down Expand Up @@ -308,6 +312,64 @@ endif
#Display/LED Options
endmenu

menuconfig ZMK_TRACKPAD
bool "Enable ZMK trackpad emulation"
default n

config ZMK_TRACKPAD_TICK_DURATION
int "Trackpad tick duration in ms"
default 8

config ZMK_TRACKPAD_MAX_FINGERS
int "Maximum number of fingers reported in PTP"
range 3 5
default 5

config ZMK_TRACKPAD_PHYSICAL_X
int "Maximum X size of trackpad in 0.1cm increments"
default 600

config ZMK_TRACKPAD_PHYSICAL_Y
int "Maximum Y size of trackpad in 0.1cm increments"
default 600

config ZMK_TRACKPAD_LOGICAL_X
int "Maximum X coordinate value trackpad can report"
default 4095

config ZMK_TRACKPAD_LOGICAL_Y
int "Maximum Y coordinate value trackpad can report"
default 4095


if ZMK_TRACKPAD

choice ZMK_TRACKPAD_WORK_QUEUE
prompt "Work queue selection for trackpad events"
default ZMK_TRACKPAD_WORK_QUEUE_DEDICATED

config ZMK_TRACKPAD_WORK_QUEUE_SYSTEM
bool "Use default system work queue for trackpad events"

config ZMK_TRACKPAD_WORK_QUEUE_DEDICATED
bool "Use dedicated work queue for trackpad events"

endchoice

if ZMK_TRACKPAD_WORK_QUEUE_DEDICATED

config ZMK_TRACKPAD_DEDICATED_THREAD_STACK_SIZE
int "Stack size for dedicated trackpad thread/queue"
default 8192

config ZMK_TRACKPAD_DEDICATED_THREAD_PRIORITY
int "Thread priority for dedicated trackpad thread/queue"
default 3

endif # ZMK_TRACKPAD_WORK_QUEUE_DEDICATED

endif

menu "Power Management"

config ZMK_BATTERY_REPORTING
Expand Down
3 changes: 3 additions & 0 deletions app/include/zmk/endpoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ int zmk_endpoints_toggle();
enum zmk_endpoint zmk_endpoints_selected();

int zmk_endpoints_send_report(uint16_t usage_page);
#if IS_ENABLED(CONFIG_ZMK_TRACKPAD)
int zmk_endpoints_send_ptp_report();
#endif
Loading

0 comments on commit ea35501

Please sign in to comment.