diff options
author | Okke Formsma <okke@formsma.nl> | 2020-11-11 22:06:25 +0100 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2020-11-28 00:58:24 -0500 |
commit | bee45f9b3a2217dd5df4ee940becb951e3e1e13a (patch) | |
tree | 5a66f7006e53d041deab1c9fa044a2ed8c6df2d0 /app/include/zmk/events/keycode-state-changed.h | |
parent | 27d036b9d5e40e05dc4809ad1ccb3255d414d267 (diff) |
feat(events): add timestamp to keycode_state_changed and sensor_event
These timestamps are necessary to correctly deal with delayed events due to hold-tap shenanigans.
Diffstat (limited to 'app/include/zmk/events/keycode-state-changed.h')
-rw-r--r-- | app/include/zmk/events/keycode-state-changed.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/include/zmk/events/keycode-state-changed.h b/app/include/zmk/events/keycode-state-changed.h index 7a423a5..a0e2436 100644 --- a/app/include/zmk/events/keycode-state-changed.h +++ b/app/include/zmk/events/keycode-state-changed.h @@ -18,12 +18,13 @@ struct keycode_state_changed { u32_t keycode; u8_t implicit_modifiers; bool state; + s64_t timestamp; }; ZMK_EVENT_DECLARE(keycode_state_changed); -static inline struct keycode_state_changed *keycode_state_changed_from_encoded(u32_t encoded, - bool pressed) { +static inline struct keycode_state_changed * +keycode_state_changed_from_encoded(u32_t encoded, bool pressed, s64_t timestamp) { u16_t page = HID_USAGE_PAGE(encoded) & 0xFF; u16_t id = HID_USAGE_ID(encoded); zmk_mod_flags implicit_mods = SELECT_MODS(encoded); @@ -37,5 +38,6 @@ static inline struct keycode_state_changed *keycode_state_changed_from_encoded(u ev->keycode = id; ev->implicit_modifiers = implicit_mods; ev->state = pressed; + ev->timestamp = timestamp; return ev; } |