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.
This commit is contained in:
parent
27d036b9d5
commit
bee45f9b3a
7 changed files with 21 additions and 17 deletions
|
|
@ -21,15 +21,15 @@ static int behavior_key_press_init(struct device *dev) { return 0; };
|
|||
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
LOG_DBG("position %d keycode 0x%02X", event.position, binding->param1);
|
||||
|
||||
return ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(binding->param1, true));
|
||||
return ZMK_EVENT_RAISE(
|
||||
keycode_state_changed_from_encoded(binding->param1, true, event.timestamp));
|
||||
}
|
||||
|
||||
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event) {
|
||||
LOG_DBG("position %d keycode 0x%02X", event.position, binding->param1);
|
||||
|
||||
return ZMK_EVENT_RAISE(keycode_state_changed_from_encoded(binding->param1, false));
|
||||
return ZMK_EVENT_RAISE(
|
||||
keycode_state_changed_from_encoded(binding->param1, false, event.timestamp));
|
||||
}
|
||||
|
||||
static const struct behavior_driver_api behavior_key_press_driver_api = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue