|
| 1 | +/* |
| 2 | + * Copyright (c) 2020 Pete Johanson |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: MIT |
| 5 | + */ |
| 6 | + |
| 7 | +#include <dt-bindings/zmk/matrix_transform.h> |
| 8 | + |
| 9 | +#include <layouts/foostan/corne/5column.dtsi> |
| 10 | +#include <layouts/foostan/corne/6column.dtsi> |
| 11 | + |
| 12 | +&foostan_corne_6col_layout { |
| 13 | + transform = <&default_transform>; |
| 14 | +}; |
| 15 | + |
| 16 | +&foostan_corne_5col_layout { |
| 17 | + transform = <&five_column_transform>; |
| 18 | +}; |
| 19 | + |
| 20 | +/ { |
| 21 | + chosen { |
| 22 | + zephyr,display = &oled; |
| 23 | + zmk,kscan = &kscan0; |
| 24 | + zmk,physical-layout = &foostan_corne_6col_layout; |
| 25 | + }; |
| 26 | + |
| 27 | + default_transform: keymap_transform_0 { |
| 28 | + compatible = "zmk,matrix-transform"; |
| 29 | + columns = <12>; |
| 30 | + rows = <4>; |
| 31 | +// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | |
| 32 | +// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | |
| 33 | +// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 | |
| 34 | +// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 | |
| 35 | + map = < |
| 36 | +RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11) |
| 37 | +RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11) |
| 38 | +RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) |
| 39 | + RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) |
| 40 | + >; |
| 41 | + }; |
| 42 | + |
| 43 | + five_column_transform: keymap_transform_1 { |
| 44 | + compatible = "zmk,matrix-transform"; |
| 45 | + columns = <10>; |
| 46 | + rows = <4>; |
| 47 | +// | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | |
| 48 | +// | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | |
| 49 | +// | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | |
| 50 | +// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 | |
| 51 | + map = < |
| 52 | +RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) |
| 53 | +RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) |
| 54 | +RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) |
| 55 | + RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) |
| 56 | + >; |
| 57 | + }; |
| 58 | + |
| 59 | + kscan0: kscan { |
| 60 | + compatible = "zmk,kscan-gpio-matrix"; |
| 61 | + wakeup-source; |
| 62 | + |
| 63 | + diode-direction = "col2row"; |
| 64 | + row-gpios |
| 65 | + = <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
| 66 | + , <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
| 67 | + , <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
| 68 | + , <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
| 69 | + ; |
| 70 | + |
| 71 | + }; |
| 72 | + |
| 73 | + // TODO: per-key RGB node(s)? |
| 74 | +}; |
| 75 | + |
| 76 | +&pro_micro_i2c { |
| 77 | + status = "okay"; |
| 78 | + |
| 79 | + oled: ssd1306@3c { |
| 80 | + compatible = "solomon,ssd1306fb"; |
| 81 | + reg = <0x3c>; |
| 82 | + width = <128>; |
| 83 | + height = <32>; |
| 84 | + segment-offset = <0>; |
| 85 | + page-offset = <0>; |
| 86 | + display-offset = <0>; |
| 87 | + multiplex-ratio = <31>; |
| 88 | + segment-remap; |
| 89 | + com-invdir; |
| 90 | + com-sequential; |
| 91 | + inversion-on; |
| 92 | + prechargep = <0x22>; |
| 93 | + }; |
| 94 | +}; |
0 commit comments