Created
May 31, 2021 23:13
-
-
Save crides/b39c7eb89d267e68fbb65ed411568559 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2020 The ZMK Contributors | |
* | |
* SPDX-License-Identifier: MIT | |
*/ | |
#include <dt-bindings/zmk/matrix_transform.h> | |
/ { | |
chosen { | |
zmk,kscan = &kscan0; | |
zmk,matrix_transform = &default_transform; | |
/delete-property/ zephyr,console; | |
/delete-property/ zephyr,shell-uart; | |
}; | |
default_transform: keymap_transform_0 { | |
compatible = "zmk,matrix-transform"; | |
columns = <6>; | |
rows = <6>; | |
map = < | |
RC(0,0) RC(1,0) RC(2,1) RC(3,1) RC(4,1) RC(5,1) RC(0,2) RC(1,2) RC(2,2) RC(3,0) RC(4,2) RC(5,2) | |
RC(0,1) RC(1,1) RC(2,0) RC(3,2) RC(4,2) RC(5,2) RC(0,3) RC(1,3) RC(2,3) RC(3,3) RC(4,0) RC(5,3) | |
RC(0,4) RC(1,4) RC(2,4) RC(3,4) RC(4,4) RC(5,0) | |
>; | |
}; | |
#define PIN1 &porta 2 | |
#define PIN2 &porta 4 | |
#define PIN3 &porta 10 | |
#define PIN4 &porta 11 | |
#define PIN5 &porta 8 | |
#define PIN6 &porta 9 | |
#define COL_PIN(n) <PIN##n (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | |
#define ROW_PIN(n) <PIN##n GPIO_ACTIVE_HIGH> | |
#define KSCAN_SUB(n) sub##n { \ | |
label = "KSCAN.comp.#n"; \ | |
kscan = <&kscan_sub##n>; \ | |
row-offset = <n>; \ | |
} | |
kscan0: kscan { | |
compatible = "zmk,kscan-composite"; | |
label = "KSCAN"; | |
rows = <6>; | |
columns = <5>; | |
KSCAN_SUB(0); | |
KSCAN_SUB(1); | |
KSCAN_SUB(2); | |
KSCAN_SUB(3); | |
KSCAN_SUB(4); | |
KSCAN_SUB(5); | |
}; | |
kscan_sub0: kscan_sub0 { | |
compatible = "zmk,kscan-gpio-matrix"; | |
label = "KSCAN.0"; | |
diode-direction = "row2col"; | |
col-gpios = COL_PIN(2), COL_PIN(3), COL_PIN(4), COL_PIN(5), COL_PIN(6); | |
row-gpios = ROW_PIN(1); | |
}; | |
kscan_sub1: kscan_sub1 { | |
compatible = "zmk,kscan-gpio-matrix"; | |
label = "KSCAN.1"; | |
diode-direction = "row2col"; | |
col-gpios = COL_PIN(1), COL_PIN(3), COL_PIN(4), COL_PIN(5), COL_PIN(6); | |
row-gpios = ROW_PIN(2); | |
}; | |
kscan_sub2: kscan_sub2 { | |
compatible = "zmk,kscan-gpio-matrix"; | |
label = "KSCAN.2"; | |
diode-direction = "row2col"; | |
col-gpios = COL_PIN(1), COL_PIN(2), COL_PIN(4), COL_PIN(5), COL_PIN(6); | |
row-gpios = ROW_PIN(3); | |
}; | |
kscan_sub3: kscan_sub3 { | |
compatible = "zmk,kscan-gpio-matrix"; | |
label = "KSCAN.3"; | |
diode-direction = "row2col"; | |
col-gpios = COL_PIN(1), COL_PIN(2), COL_PIN(3), COL_PIN(5), COL_PIN(6); | |
row-gpios = ROW_PIN(4); | |
}; | |
kscan_sub4: kscan_sub4 { | |
compatible = "zmk,kscan-gpio-matrix"; | |
label = "KSCAN.4"; | |
diode-direction = "row2col"; | |
col-gpios = COL_PIN(1), COL_PIN(2), COL_PIN(3), COL_PIN(4), COL_PIN(6); | |
row-gpios = ROW_PIN(5); | |
}; | |
kscan_sub5: kscan_sub5 { | |
compatible = "zmk,kscan-gpio-matrix"; | |
label = "KSCAN.5"; | |
diode-direction = "row2col"; | |
col-gpios = COL_PIN(1), COL_PIN(2), COL_PIN(3), COL_PIN(4), COL_PIN(5); | |
row-gpios = ROW_PIN(6); | |
}; | |
}; | |
&sercom0 { status = "disabled"; }; | |
&sercom4 { status = "disabled"; }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment