Skip to content

Commit

Permalink
feat(board): sensortest
Browse files Browse the repository at this point in the history
  • Loading branch information
burkfers committed Jun 6, 2024
1 parent 2f5a615 commit d938c54
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/boards/shields/sensortest/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if SHIELD_SENSORTEST

config ZMK_KEYBOARD_NAME
default "Sensortest"

endif
2 changes: 2 additions & 0 deletions config/boards/shields/sensortest/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config SHIELD_SENSORTEST
def_bool $(shields_list_contains,sensortest)
15 changes: 15 additions & 0 deletions config/boards/shields/sensortest/sensortest.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CONFIG_SPI=y
CONFIG_INPUT=y
CONFIG_ZMK_MOUSE=y
CONFIG_PMW3610=y

CONFIG_PMW3610_FORCE_AWAKE=y

CONFIG_ZMK_USB_LOGGING=y
CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS=1000
# CONFIG_LOG_OVERRIDE_LEVEL=3
# CONFIG_INPUT_LOG_LEVEL=3
# CONFIG_INPUT_LOG_LEVEL_WRN=y
# CONFIG_INPUT_LOG_LEVEL_ERR=y
# CONFIG_INPUT_LOG_LEVEL_INF=y
CONFIG_LOG_BUFFER_SIZE=8192
78 changes: 78 additions & 0 deletions config/boards/shields/sensortest/sensortest.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include <dt-bindings/zmk/matrix_transform.h>

&pinctrl {
spi0_default: spi0_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 24)>,
<NRF_PSEL(SPIM_MOSI, 0, 11)>,
<NRF_PSEL(SPIM_MISO, 0, 11)>;
};
};

// spi0_sleep: spi0_sleep {
// group1 {
// psels = <NRF_PSEL(SPIM_SCK, 0, 24)>,
// <NRF_PSEL(SPIM_MOSI, 0, 11)>,
// <NRF_PSEL(SPIM_MISO, 0, 11)>;
// low-power-enable;
// };
// };
};

&spi0 {
status = "okay";
compatible = "nordic,nrf-spim";
pinctrl-0 = <&spi0_default>;
// pinctrl-1 = <&spi0_sleep>;
// pinctrl-names = "default", "sleep";
pinctrl-names = "default";
cs-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;

trackball: trackball@0 {
status = "okay";
compatible = "pixart,pmw3610";
reg = <0>;
spi-max-frequency = <2000000>;
irq-gpios = <&gpio1 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;

/* optional features */
// snipe-layers = <1>;
// scroll-layers = <2 3>;
// automouse-layer = <4>;
};
};

/ {
trackball_listener {
compatible = "zmk,input-listener";
device = <&trackball>;

};

chosen {
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
};

default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <1>;
rows = <1>;
map = <
RC(0,0)
> ;
};

kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
diode-direction = "col2row";
wakeup-source;
};

bootloader_key: bootloader_key {
compatible = "zmk,boot-magic-key";
key-position = <0>;
jump-to-bootloader;
status = "okay";
};
};
14 changes: 14 additions & 0 deletions config/boards/shields/sensortest/sensortest.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>

/ {
keymap {
compatible = "zmk,keymap";

default_layer {
bindings = <
&bootloader
>;
};
};
};
11 changes: 11 additions & 0 deletions config/boards/shields/sensortest/sensortest.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "sensortest.dtsi"

&kscan0 {
row-gpios
= <&gpio0 10 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>
;

col-gpios
= <&gpio0 9 GPIO_ACTIVE_HIGH>
;
};

0 comments on commit d938c54

Please sign in to comment.