|
| 1 | +/* |
| 2 | + * Copyright (c) 2020 The ZMK Contributors |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: MIT |
| 5 | + */ |
| 6 | + |
| 7 | +/dts-v1/; |
| 8 | +#include <st/f0/stm32f072Xb.dtsi> |
| 9 | +#include <st/f0/stm32f072v(8-b)tx-pinctrl.dtsi> |
| 10 | + |
| 11 | +#include <dt-bindings/zmk/matrix_transform.h> |
| 12 | + |
| 13 | +/ { |
| 14 | + model = "Ferris rev0.2"; |
| 15 | + compatible = "ferris,rev02", "st,stm32f072"; |
| 16 | + |
| 17 | + chosen { |
| 18 | + zephyr,sram = &sram0; |
| 19 | + zephyr,flash = &flash0; |
| 20 | + zmk,kscan = &kscan; |
| 21 | + zmk,matrix_transform = &transform; |
| 22 | + /* TODO: Enable once we support the IC for underglow |
| 23 | + zmk,underglow = &led_strip; |
| 24 | + */ |
| 25 | + }; |
| 26 | + |
| 27 | + transform: transform { |
| 28 | + compatible = "zmk,matrix-transform"; |
| 29 | + rows = <4>; |
| 30 | + columns = <10>; |
| 31 | + |
| 32 | + map = < |
| 33 | + 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) |
| 34 | + 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) |
| 35 | + 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) |
| 36 | + RC(3,3) RC(3,4) RC(3,5) RC(3,6) |
| 37 | + >; |
| 38 | + }; |
| 39 | + |
| 40 | + kscan: kscan { |
| 41 | + compatible = "zmk,kscan-composite"; |
| 42 | + label = "KSCAN"; |
| 43 | + rows = <4>; |
| 44 | + columns = <10>; |
| 45 | + |
| 46 | + left { |
| 47 | + kscan = <&kscan_left>; |
| 48 | + }; |
| 49 | + |
| 50 | + right { |
| 51 | + kscan = <&kscan_right>; |
| 52 | + column-offset = <5>; |
| 53 | + }; |
| 54 | + }; |
| 55 | + |
| 56 | + kscan_left: kscan_left { |
| 57 | + compatible = "zmk,kscan-gpio-matrix"; |
| 58 | + label = "KSCAN_LEFT"; |
| 59 | + |
| 60 | + diode-direction = "col2row"; |
| 61 | + |
| 62 | + col-gpios |
| 63 | + = <&gpiob 8 (GPIO_ACTIVE_HIGH)> |
| 64 | + , <&gpiob 4 (GPIO_ACTIVE_HIGH)> |
| 65 | + , <&gpiob 3 (GPIO_ACTIVE_HIGH)> |
| 66 | + , <&gpioa 15 (GPIO_ACTIVE_HIGH)> |
| 67 | + , <&gpioa 14 (GPIO_ACTIVE_HIGH)> |
| 68 | + ; |
| 69 | + row-gpios |
| 70 | + = <&gpiob 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
| 71 | + , <&gpiob 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
| 72 | + , <&gpiob 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
| 73 | + , <&gpioa 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> |
| 74 | + ; |
| 75 | + }; |
| 76 | + |
| 77 | + kscan_right: kscan_right { |
| 78 | + compatible = "zmk,kscan-gpio-matrix"; |
| 79 | + label = "KSCAN_RIGHT"; |
| 80 | + |
| 81 | + diode-direction = "row2col"; |
| 82 | + |
| 83 | + col-gpios |
| 84 | + = <&right_io 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> |
| 85 | + , <&right_io 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> |
| 86 | + , <&right_io 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> |
| 87 | + , <&right_io 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> |
| 88 | + , <&right_io 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> |
| 89 | + ; |
| 90 | + row-gpios |
| 91 | + = <&right_io 8 (GPIO_ACTIVE_LOW)> |
| 92 | + , <&right_io 9 (GPIO_ACTIVE_LOW)> |
| 93 | + , <&right_io 10 (GPIO_ACTIVE_LOW)> |
| 94 | + , <&right_io 11 (GPIO_ACTIVE_LOW)> |
| 95 | + ; |
| 96 | + }; |
| 97 | +}; |
| 98 | + |
| 99 | +&i2c2 { |
| 100 | + pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>; |
| 101 | + status = "okay"; |
| 102 | + clock-frequency = <I2C_BITRATE_FAST>; |
| 103 | + |
| 104 | + right_io: mcp23017@20 { |
| 105 | + compatible = "microchip,mcp23017"; |
| 106 | + status = "okay"; |
| 107 | + gpio-controller; |
| 108 | + reg = <0x20>; |
| 109 | + label = "RIGHT_IO"; |
| 110 | + #gpio-cells = <2>; |
| 111 | + ngpios = <16>; |
| 112 | + }; |
| 113 | +}; |
| 114 | + |
| 115 | +&usb { |
| 116 | + status = "okay"; |
| 117 | +}; |
| 118 | + |
| 119 | +&rtc { |
| 120 | + status = "okay"; |
| 121 | +}; |
| 122 | + |
| 123 | +&flash0 { |
| 124 | + /* |
| 125 | + * For more information, see: |
| 126 | + * http: //docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions |
| 127 | + */ |
| 128 | + partitions { |
| 129 | + compatible = "fixed-partitions"; |
| 130 | + #address-cells = <1>; |
| 131 | + #size-cells = <1>; |
| 132 | + |
| 133 | + /* Set 6Kb of storage at the end of the 128Kb of flash */ |
| 134 | + storage_partition: partition@3e800 { |
| 135 | + label = "storage"; |
| 136 | + reg = <0x0001e800 0x00001800>; |
| 137 | + }; |
| 138 | + }; |
| 139 | +}; |
0 commit comments