Refactor global bindings, implement mod-tap.

* Use extra comptible = "zmk,behavior-global" to add
   behaviors to global bindings for event notification.
* Implement mod-tap, as a keymap binding and global one
  to skip tap if other keycode pressed while held.
This commit is contained in:
Pete Johanson
2020-06-21 21:43:44 -04:00
parent 7e659851c8
commit 223edf05ad
20 changed files with 307 additions and 100 deletions

View File

@@ -42,9 +42,27 @@ static int on_keycode_released(struct device *dev, u32_t keycode)
return zmk_endpoints_send_report(changes);
}
static int on_modifiers_pressed(struct device *dev, zmk_mod_flags modifiers)
{
LOG_DBG("modifiers %d", modifiers);
zmk_hid_register_mods(modifiers);
return zmk_endpoints_send_report(Keypad);
}
static int on_modifiers_released(struct device *dev, zmk_mod_flags modifiers)
{
LOG_DBG("modifiers %d", modifiers);
zmk_hid_unregister_mods(modifiers);
return zmk_endpoints_send_report(Keypad);
}
static const struct behavior_driver_api behavior_hid_driver_api = {
.keycode_pressed = on_keycode_pressed,
.keycode_released = on_keycode_released
.keycode_released = on_keycode_released,
.modifiers_pressed = on_modifiers_pressed,
.modifiers_released = on_modifiers_released
};