Clean up and implement MT release w/o mod press.
This commit is contained in:
parent
53aadc4f93
commit
76a433fc39
4 changed files with 14 additions and 7 deletions
|
@ -13,7 +13,8 @@
|
||||||
|
|
||||||
rows = <2>;
|
rows = <2>;
|
||||||
columns = <2>;
|
columns = <2>;
|
||||||
events = <ZMK_MOCK_PRESS(0,0,800) ZMK_MOCK_RELEASE(0,0,800)>;
|
events = <ZMK_MOCK_PRESS(0,1,300) ZMK_MOCK_PRESS(0,0,300) ZMK_MOCK_RELEASE(0,0,300) ZMK_MOCK_RELEASE(0,1,300)>;
|
||||||
|
// events = <ZMK_MOCK_PRESS(0,0,800) ZMK_MOCK_RELEASE(0,0,800) ZMK_MOCK_PRESS(0,1,800) ZMK_MOCK_RELEASE(0,1,800)>;
|
||||||
};
|
};
|
||||||
|
|
||||||
keymap0: keymap {
|
keymap0: keymap {
|
||||||
|
@ -29,7 +30,7 @@
|
||||||
label = "DEFAULT";
|
label = "DEFAULT";
|
||||||
keys =
|
keys =
|
||||||
<
|
<
|
||||||
KC_A KC_B
|
KC_A MT(MOD_LSFT, KC_B)
|
||||||
KC_C KC_D
|
KC_C KC_D
|
||||||
>;
|
>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -86,6 +86,7 @@
|
||||||
#define ZK_ACTION(k) (k >> 24)
|
#define ZK_ACTION(k) (k >> 24)
|
||||||
#define _ACTION(a) (a << 24)
|
#define _ACTION(a) (a << 24)
|
||||||
#define _ACTION_MODS(m) (m << 16)
|
#define _ACTION_MODS(m) (m << 16)
|
||||||
|
#define ZK_KEY(a) (a & 0xFFFF)
|
||||||
#define ZK_MODS(a) ((a >> 16) & 0xFF)
|
#define ZK_MODS(a) ((a >> 16) & 0xFF)
|
||||||
|
|
||||||
#define ZMK_ACTION_KEY 0x01
|
#define ZMK_ACTION_KEY 0x01
|
||||||
|
|
|
@ -56,9 +56,6 @@ int zmk_endpoints_send_report()
|
||||||
|
|
||||||
int zmk_endpoints_send_key_event(struct zmk_key_event key_event)
|
int zmk_endpoints_send_key_event(struct zmk_key_event key_event)
|
||||||
{
|
{
|
||||||
struct zmk_hid_report *report;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
LOG_DBG("key %d, state %d\n", key_event.key, key_event.pressed);
|
LOG_DBG("key %d, state %d\n", key_event.key, key_event.pressed);
|
||||||
|
|
||||||
if (key_event.pressed)
|
if (key_event.pressed)
|
||||||
|
|
|
@ -32,8 +32,16 @@ bool zmk_handle_action(zmk_action action, struct zmk_key_event *key_event)
|
||||||
zmk_hid_unregister_mods(mods);
|
zmk_hid_unregister_mods(mods);
|
||||||
if (action_effect_pending & BIT(flattened_index))
|
if (action_effect_pending & BIT(flattened_index))
|
||||||
{
|
{
|
||||||
// Allow baseline keycode to flow to the endpoints!
|
struct zmk_key_event non_mod_event =
|
||||||
return true;
|
{
|
||||||
|
.row = key_event->row,
|
||||||
|
.column = key_event->column,
|
||||||
|
.key = ZK_KEY(key_event->key),
|
||||||
|
.pressed = true};
|
||||||
|
|
||||||
|
zmk_handle_key(non_mod_event);
|
||||||
|
non_mod_event.pressed = false;
|
||||||
|
zmk_handle_key(non_mod_event);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue