forked from kofal.net/zmk
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:
committed by
Pete Johanson
parent
27d036b9d5
commit
bee45f9b3a
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user