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.
This commit is contained in:
Joel Spadin
2020-10-11 18:38:39 -05:00
parent 1d369ffa73
commit 8f666cecc9
3 changed files with 17 additions and 1 deletions

View File

@@ -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;
}