summaryrefslogtreecommitdiff
path: root/app/src/hid.c
diff options
context:
space:
mode:
authorJoel Spadin <joelspadin@gmail.com>2020-10-11 18:38:39 -0500
committerJoel Spadin <joelspadin@gmail.com>2020-10-28 18:15:05 -0500
commit8f666cecc9717b3fbbe2f5f34375b6a45b8965fd (patch)
tree688dd50dc35353d7628f25c3645b8198d889ca18 /app/src/hid.c
parent1d369ffa73ae63af821d012b1c2ab4a07a5dc9c7 (diff)
feat(endpoints): clear HID report on endpoint change
This prevents stuck keys when switching endpoints by clearing everything in the HID report and sending one last report before switching to the new endpoint.
Diffstat (limited to 'app/src/hid.c')
-rw-r--r--app/src/hid.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/src/hid.c b/app/src/hid.c
index f80906c..8f6c388 100644
--- a/app/src/hid.c
+++ b/app/src/hid.c
@@ -94,6 +94,8 @@ int zmk_hid_keypad_release(zmk_key code) {
return 0;
};
+void zmk_hid_keypad_clear() { memset(&kp_report.body, 0, sizeof(kp_report.body)); }
+
int zmk_hid_consumer_press(zmk_key code) {
TOGGLE_CONSUMER(0U, code);
return 0;
@@ -104,6 +106,8 @@ int zmk_hid_consumer_release(zmk_key code) {
return 0;
};
+void zmk_hid_consumer_clear() { memset(&consumer_report.body, 0, sizeof(consumer_report.body)); }
+
struct zmk_hid_keypad_report *zmk_hid_get_keypad_report() {
return &kp_report;
}