Browse Source
Key release events released keys on the wrong layer if the 'top layer' was not &trans above the &mo key. base <&mo 1> layer 1 <&kp B> This was caused by overwriting `zmk_keymap_active_behavior_layer[position]` after the &mo key was handled.xmkb
Okke Formsma
4 years ago
committed by
Pete Johanson
20 changed files with 209 additions and 35 deletions
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
mo_pressed: position 1 layer 1 |
||||
kp_pressed: usage_page 0x07 keycode 0x06 mods 0x00 |
||||
kp_released: usage_page 0x07 keycode 0x06 mods 0x00 |
||||
mo_released: position 1 layer 1 |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
#include <dt-bindings/zmk/keys.h> |
||||
#include <behaviors.dtsi> |
||||
#include <dt-bindings/zmk/kscan-mock.h> |
||||
#include "../behavior_keymap.dtsi" |
||||
|
||||
/ { |
||||
keymap { |
||||
compatible = "zmk,keymap"; |
||||
label ="Default keymap"; |
||||
|
||||
default_layer { |
||||
bindings = < |
||||
&kp B &mo 1 |
||||
&none &none>; |
||||
}; |
||||
|
||||
layer_1 { |
||||
bindings = < |
||||
&kp C &trans |
||||
&none &none>; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
&kscan { |
||||
events = < |
||||
ZMK_MOCK_PRESS(0,1,10) |
||||
ZMK_MOCK_PRESS(0,0,10) |
||||
ZMK_MOCK_RELEASE(0,0,10) |
||||
ZMK_MOCK_RELEASE(0,1,10) |
||||
>; |
||||
}; |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
#include <dt-bindings/zmk/keys.h> |
||||
#include <behaviors.dtsi> |
||||
#include <dt-bindings/zmk/kscan-mock.h> |
||||
#include "../behavior_keymap.dtsi" |
||||
|
||||
/ { |
||||
keymap { |
||||
compatible = "zmk,keymap"; |
||||
label ="Default keymap"; |
||||
|
||||
default_layer { |
||||
bindings = < |
||||
&kp B &mo 1 |
||||
&none &none>; |
||||
}; |
||||
|
||||
layer_1 { |
||||
bindings = < |
||||
&kp C &none |
||||
&none &none>; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
&kscan { |
||||
events = < |
||||
ZMK_MOCK_PRESS(0,0,10) |
||||
ZMK_MOCK_PRESS(0,1,10) |
||||
ZMK_MOCK_RELEASE(0,0,10) |
||||
ZMK_MOCK_RELEASE(0,1,10) |
||||
>; |
||||
}; |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
s/.*hid_listener_keycode/kp/p |
||||
s/.*mo_keymap_binding/mo/p |
||||
s/.*keymap_position_state_changed/kp_st/p |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
mo_pressed: position 1 layer 1 |
||||
mo_released: position 1 layer 1 |
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
#include <dt-bindings/zmk/keys.h> |
||||
#include <behaviors.dtsi> |
||||
#include <dt-bindings/zmk/kscan-mock.h> |
||||
|
||||
/* |
||||
this test verifies that the correct key is released when a layer is enabled "on top" |
||||
and the original key is "covered". |
||||
*/ |
||||
/ { |
||||
keymap { |
||||
compatible = "zmk,keymap"; |
||||
label ="Default keymap"; |
||||
|
||||
default_layer { |
||||
bindings = < |
||||
&trans &mo 1 |
||||
&trans &trans>; |
||||
}; |
||||
|
||||
layer_1 { |
||||
bindings = < |
||||
&trans &kp A |
||||
&trans &trans>; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
&kscan { |
||||
events = < |
||||
ZMK_MOCK_PRESS(0,1,10) |
||||
ZMK_MOCK_RELEASE(0,1,10) |
||||
>; |
||||
}; |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
s/.*hid_listener_keycode/kp/p |
||||
s/.*mo_keymap_binding/mo/p |
||||
s/.*keymap_position_state_changed/kp_st/p |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
mo_pressed: position 1 layer 1 |
||||
mo_pressed: position 0 layer 2 |
||||
kp_pressed: usage_page 0x07 keycode 0x05 mods 0x00 |
||||
kp_released: usage_page 0x07 keycode 0x05 mods 0x00 |
||||
mo_released: position 0 layer 2 |
||||
mo_released: position 1 layer 1 |
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
#include <dt-bindings/zmk/keys.h> |
||||
#include <behaviors.dtsi> |
||||
#include <dt-bindings/zmk/kscan-mock.h> |
||||
|
||||
/ { |
||||
keymap { |
||||
compatible = "zmk,keymap"; |
||||
label ="Default keymap"; |
||||
|
||||
default_layer { |
||||
bindings = < |
||||
&none &mo 1 |
||||
&none &none>; |
||||
}; |
||||
|
||||
layer_1 { |
||||
bindings = < |
||||
&mo 2 &none |
||||
&none &none>; |
||||
}; |
||||
|
||||
layer_2 { |
||||
bindings = < |
||||
&none &none |
||||
&kp B &none>; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
&kscan { |
||||
events = < |
||||
ZMK_MOCK_PRESS(0,1,10) |
||||
ZMK_MOCK_PRESS(0,0,10) |
||||
ZMK_MOCK_PRESS(1,0,10) |
||||
ZMK_MOCK_RELEASE(1,0,10) |
||||
ZMK_MOCK_RELEASE(0,0,10) |
||||
ZMK_MOCK_RELEASE(0,1,10) |
||||
>; |
||||
}; |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
s/.*hid_listener_keycode/kp/p |
||||
s/.*mo_keymap_binding/mo/p |
||||
s/.*keymap_position_state_changed/kp_st/p |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
mo_pressed: position 1 layer 1 |
||||
mo_pressed: position 0 layer 2 |
||||
kp_pressed: usage_page 0x07 keycode 0x05 mods 0x00 |
||||
mo_released: position 1 layer 1 |
||||
mo_released: position 0 layer 2 |
||||
kp_released: usage_page 0x07 keycode 0x05 mods 0x00 |
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
#include <dt-bindings/zmk/keys.h> |
||||
#include <behaviors.dtsi> |
||||
#include <dt-bindings/zmk/kscan-mock.h> |
||||
|
||||
/ { |
||||
keymap { |
||||
compatible = "zmk,keymap"; |
||||
label ="Default keymap"; |
||||
|
||||
default_layer { |
||||
bindings = < |
||||
&none &mo 1 |
||||
&none &none>; |
||||
}; |
||||
|
||||
layer_1 { |
||||
bindings = < |
||||
&mo 2 &none |
||||
&none &none>; |
||||
}; |
||||
|
||||
layer_2 { |
||||
bindings = < |
||||
&none &none |
||||
&kp B &none>; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
&kscan { |
||||
events = < |
||||
ZMK_MOCK_PRESS(0,1,10) |
||||
ZMK_MOCK_PRESS(0,0,10) |
||||
ZMK_MOCK_PRESS(1,0,10) |
||||
ZMK_MOCK_RELEASE(0,1,10) |
||||
ZMK_MOCK_RELEASE(0,0,10) |
||||
ZMK_MOCK_RELEASE(1,0,10) |
||||
>; |
||||
}; |
@ -1,8 +0,0 @@
@@ -1,8 +0,0 @@
|
||||
#include <dt-bindings/zmk/keys.h> |
||||
#include <behaviors.dtsi> |
||||
#include <dt-bindings/zmk/kscan-mock.h> |
||||
#include "../behavior_keymap.dtsi" |
||||
|
||||
&kscan { |
||||
events = <ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_RELEASE(0,0,10) ZMK_MOCK_RELEASE(0,1,10)>; |
||||
}; |
@ -1,4 +0,0 @@
@@ -1,4 +0,0 @@
|
||||
mo_pressed: position 1 layer 1 |
||||
kp_pressed: usage_page 0x0c keycode 0xb5 mods 0x00 |
||||
kp_released: usage_page 0x0c keycode 0xb5 mods 0x00 |
||||
mo_released: position 1 layer 1 |
@ -1,8 +0,0 @@
@@ -1,8 +0,0 @@
|
||||
#include <dt-bindings/zmk/keys.h> |
||||
#include <behaviors.dtsi> |
||||
#include <dt-bindings/zmk/kscan-mock.h> |
||||
#include "../behavior_keymap.dtsi" |
||||
|
||||
&kscan { |
||||
events = <ZMK_MOCK_PRESS(0,1,10) ZMK_MOCK_PRESS(0,0,10) ZMK_MOCK_RELEASE(0,0,10) ZMK_MOCK_RELEASE(0,1,10)>; |
||||
}; |
Loading…
Reference in new issue