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/src/keymap.c | |
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/src/keymap.c')
-rw-r--r-- | app/src/keymap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/src/keymap.c b/app/src/keymap.c index 70db2fa..4174ac1 100644 --- a/app/src/keymap.c +++ b/app/src/keymap.c @@ -152,7 +152,7 @@ int zmk_keymap_position_state_changed(u32_t position, bool pressed, s64_t timest } #if ZMK_KEYMAP_HAS_SENSORS -int zmk_keymap_sensor_triggered(u8_t sensor_number, struct device *sensor) { +int zmk_keymap_sensor_triggered(u8_t sensor_number, struct device *sensor, s64_t timestamp) { for (int layer = ZMK_KEYMAP_LAYERS_LEN - 1; layer >= zmk_keymap_layer_default; layer--) { if (((zmk_keymap_layer_state & BIT(layer)) == BIT(layer) || layer == zmk_keymap_layer_default) && @@ -171,7 +171,7 @@ int zmk_keymap_sensor_triggered(u8_t sensor_number, struct device *sensor) { continue; } - ret = behavior_sensor_keymap_binding_triggered(binding, sensor); + ret = behavior_sensor_keymap_binding_triggered(binding, sensor, timestamp); if (ret > 0) { LOG_DBG("behavior processing to continue to next layer"); @@ -197,7 +197,7 @@ int keymap_listener(const struct zmk_event_header *eh) { #if ZMK_KEYMAP_HAS_SENSORS } else if (is_sensor_event(eh)) { const struct sensor_event *ev = cast_sensor_event(eh); - return zmk_keymap_sensor_triggered(ev->sensor_number, ev->sensor); + return zmk_keymap_sensor_triggered(ev->sensor_number, ev->sensor, ev->timestamp); #endif /* ZMK_KEYMAP_HAS_SENSORS */ } |