diff options
author | Pete Johanson <peter@peterjohanson.com> | 2020-05-27 00:48:03 -0400 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2020-05-27 00:53:31 -0400 |
commit | 9a09eb14af7be29078d668ea492f2b2c78022d19 (patch) | |
tree | 6986cc682fd698f285d4b8b07999233493c247e3 /boards | |
parent | abd106032db9590b34e6fa0456b4c8810d4f474f (diff) |
Initial composite kscan driver.
* For now, to be used for FrankenKyria, where both
matrix halves will be attached to the same MCU, but
should be a stepping stone to proper split support
once we have a kscan driver over a split transport.
* Implement multiple instances for mock kscan driver.
Diffstat (limited to 'boards')
-rw-r--r-- | boards/native_posix.conf | 1 | ||||
-rw-r--r-- | boards/native_posix.overlay | 47 | ||||
-rw-r--r-- | boards/shields/petejohanson_handwire/Kconfig.defconfig | 2 | ||||
-rw-r--r-- | boards/shields/petejohanson_handwire/petejohanson_handwire.overlay | 37 |
4 files changed, 74 insertions, 13 deletions
diff --git a/boards/native_posix.conf b/boards/native_posix.conf index 4efd71d..5bfb366 100644 --- a/boards/native_posix.conf +++ b/boards/native_posix.conf @@ -1,5 +1,6 @@ CONFIG_KSCAN=n CONFIG_ZMK_KSCAN_MOCK_DRIVER=y +CONFIG_ZMK_KSCAN_COMPOSITE_DRIVER=y CONFIG_ZMK_KSCAN_GPIO_DRIVER=n CONFIG_GPIO=n CONFIG_ZMK_BLE=n diff --git a/boards/native_posix.overlay b/boards/native_posix.overlay index 1d692d4..9d92bee 100644 --- a/boards/native_posix.overlay +++ b/boards/native_posix.overlay @@ -7,9 +7,25 @@ zmk,keymap = &keymap0; }; - kscan0: kscan { + kscan0: kscan_0 { + compatible = "zmk,kscan-composite"; + label = "KSCAN_COMP"; + rows = <2>; + columns = <4>; + + left: left { + kscan = <&left_hand>; + }; + + right: right { + kscan = <&right_hand>; + column-offset = <2>; + }; + }; + + left_hand: kscan_1 { compatible = "zmk,kscan-mock"; - label = "KSCAN_MOCK0"; + label = "KSCAN_LEFT"; rows = <2>; columns = <2>; @@ -17,6 +33,15 @@ // 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)>; }; + right_hand: kscan_2 { + compatible = "zmk,kscan-mock"; + label = "KSCAN_RIGHT"; + + rows = <2>; + columns = <2>; + events = <ZMK_MOCK_PRESS(1,1,800) ZMK_MOCK_RELEASE(1,1,100) ZMK_MOCK_PRESS(0,1,800) ZMK_MOCK_RELEASE(0,1,100)>; + }; + keymap0: keymap { compatible = "zmk,keymap"; label ="Default keymap"; @@ -29,20 +54,26 @@ default: layer_0 { label = "DEFAULT"; keys = - < - KC_A MT(MOD_LSFT, KC_B) - KC_C KC_D - >; + < + KC_A MT(MOD_LSFT, KC_B) KC_C KC_D + KC_E KC_F KC_G KC_H + >; }; lower: layer_1 { label = "LOWER"; - keys = <KC_D KC_C ZC_TRNS ZC_TRNS>; + keys = < + KC_A KC_B KC_C KC_D + KC_E KC_F KC_G KC_H + >; }; raise: layer_2 { label = "RAISE"; - keys = <KC_C KC_D ZC_TRNS ZC_TRNS>; + keys = < + KC_E KC_F KC_G KC_H + KC_A KC_B KC_C KC_D + >; }; }; }; diff --git a/boards/shields/petejohanson_handwire/Kconfig.defconfig b/boards/shields/petejohanson_handwire/Kconfig.defconfig index e69de29..c7408ce 100644 --- a/boards/shields/petejohanson_handwire/Kconfig.defconfig +++ b/boards/shields/petejohanson_handwire/Kconfig.defconfig @@ -0,0 +1,2 @@ + +CONFIG_ZMK_KSCAN_COMPOSITE_DRIVER=y
\ No newline at end of file diff --git a/boards/shields/petejohanson_handwire/petejohanson_handwire.overlay b/boards/shields/petejohanson_handwire/petejohanson_handwire.overlay index 72e24a0..d65b3b1 100644 --- a/boards/shields/petejohanson_handwire/petejohanson_handwire.overlay +++ b/boards/shields/petejohanson_handwire/petejohanson_handwire.overlay @@ -4,14 +4,41 @@ zmk,kscan = &kscan0; }; - kscan0: kscan { + kscan0: kscan_0 { + compatible = "zmk,kscan-composite"; + label = "KSCAN_COMP"; + rows = <2>; + columns = <4>; + + left { + kscan = <&left_hand>; + }; + + right { + kscan = <&right_hand>; + column-offset = <2>; + }; + }; + + left_hand: kscan_1 { compatible = "gpio-kscan"; - label = "KSCAN"; + label = "KSCAN_LEFT"; diode-direction = "row2col"; row-gpios = <&arduino_header 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&arduino_header 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; - col-gpios = <&arduino_header 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, - <&arduino_header 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + <&arduino_header 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + col-gpios = <&arduino_header 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&arduino_header 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + + right_hand: kscan_2 { + compatible = "gpio-kscan"; + label = "KSCAN_RIGHT"; + + diode-direction = "row2col"; + row-gpios = <&arduino_header 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&arduino_header 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + col-gpios = <&arduino_header 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>, + <&arduino_header 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; }; }; |