Skip to content

Commit 45c11cf

Browse files
authored
Update config (#7), use latest ZMK, new PMW3610 driver, ZMK Studio support
* Update it with newer stack Signed-off-by: Eren Atas <[email protected]> * Decrease sensitivity Signed-off-by: Eren Atas <[email protected]> * Increase CPI to reduce lag Signed-off-by: Eren Atas <[email protected]> * Try to tweak sensitivity/speed Signed-off-by: Eren Atas <[email protected]> --------- Signed-off-by: Eren Atas <[email protected]>
1 parent 8bbecdf commit 45c11cf

13 files changed

+159
-111
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Charybdis Mini ZMK Configuration

build-locally.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

build.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ include:
1717
shield: charybdis_left
1818
- board: nice_nano_v2
1919
shield: charybdis_right
20+
snippet: studio-rpc-usb-uart
21+
cmake-args: -DCONFIG_ZMK_STUDIO=y
22+
- board: nice_nano_v2
23+
shield: settings_reset
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include <physical_layouts.dtsi>
2+
3+
/ {
4+
physical_layout0: physical_layout_0 {
5+
compatible = "zmk,physical-layout";
6+
display-name = "Default Layout";
7+
kscan = <&kscan0>;
8+
transform = <&default_transform>;
9+
10+
keys // w h x y rot rx ry
11+
= <&key_physical_attrs 100 100 0 38 0 0 0>
12+
, <&key_physical_attrs 100 100 100 38 0 0 0>
13+
, <&key_physical_attrs 100 100 200 12 0 0 0>
14+
, <&key_physical_attrs 100 100 300 0 0 0 0>
15+
, <&key_physical_attrs 100 100 400 12 0 0 0>
16+
, <&key_physical_attrs 100 100 500 25 0 0 0>
17+
, <&key_physical_attrs 100 100 900 25 0 0 0>
18+
, <&key_physical_attrs 100 100 1000 12 0 0 0>
19+
, <&key_physical_attrs 100 100 1100 0 0 0 0>
20+
, <&key_physical_attrs 100 100 1200 12 0 0 0>
21+
, <&key_physical_attrs 100 100 1300 38 0 0 0>
22+
, <&key_physical_attrs 100 100 1400 38 0 0 0>
23+
, <&key_physical_attrs 100 100 0 138 0 0 0>
24+
, <&key_physical_attrs 100 100 100 138 0 0 0>
25+
, <&key_physical_attrs 100 100 200 112 0 0 0>
26+
, <&key_physical_attrs 100 100 300 100 0 0 0>
27+
, <&key_physical_attrs 100 100 400 112 0 0 0>
28+
, <&key_physical_attrs 100 100 500 125 0 0 0>
29+
, <&key_physical_attrs 100 100 900 125 0 0 0>
30+
, <&key_physical_attrs 100 100 1000 112 0 0 0>
31+
, <&key_physical_attrs 100 100 1100 100 0 0 0>
32+
, <&key_physical_attrs 100 100 1200 112 0 0 0>
33+
, <&key_physical_attrs 100 100 1300 138 0 0 0>
34+
, <&key_physical_attrs 100 100 1400 138 0 0 0>
35+
, <&key_physical_attrs 100 100 0 238 0 0 0>
36+
, <&key_physical_attrs 100 100 100 238 0 0 0>
37+
, <&key_physical_attrs 100 100 200 212 0 0 0>
38+
, <&key_physical_attrs 100 100 300 200 0 0 0>
39+
, <&key_physical_attrs 100 100 400 212 0 0 0>
40+
, <&key_physical_attrs 100 100 500 225 0 0 0>
41+
, <&key_physical_attrs 100 100 900 225 0 0 0>
42+
, <&key_physical_attrs 100 100 1000 212 0 0 0>
43+
, <&key_physical_attrs 100 100 1100 200 0 0 0>
44+
, <&key_physical_attrs 100 100 1200 212 0 0 0>
45+
, <&key_physical_attrs 100 100 1300 238 0 0 0>
46+
, <&key_physical_attrs 100 100 1400 238 0 0 0>
47+
, <&key_physical_attrs 100 100 348 314 0 0 0>
48+
, <&key_physical_attrs 100 100 348 314 1500 398 764>
49+
, <&key_physical_attrs 100 100 348 312 3000 398 764>
50+
, <&key_physical_attrs 100 100 1052 312 (-3000) 1102 764>
51+
, <&key_physical_attrs 100 100 1052 314 (-1500) 1102 764>
52+
;
53+
};
54+
};

config/boards/shields/charybdis/charybdis.dtsi

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1+
#include "charybdis-layouts.dtsi"
12
#include <dt-bindings/zmk/matrix_transform.h>
23

34
/ {
4-
chosen {
5-
zmk,kscan = &kscan0;
6-
zmk,matrix_transform = &default_transform;
7-
};
85

96
vbatt: vbatt {
107
compatible = "zmk,battery-nrf-vddh";

config/boards/shields/charybdis/charybdis.zmk.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name: Charybdis
44
type: shield
55
url: https://github.com/Bastardkb/Charybdis/
66
requires: [pro_micro]
7+
studio: true
78
features:
89
- keys
910
- pointer

config/boards/shields/charybdis/charybdis_left.overlay

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66

77
#include "charybdis.dtsi"
8+
#include "pmw3610.dtsi"
9+
810

911
&kscan0 {
1012
col-gpios
@@ -15,4 +17,12 @@
1517
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
1618
, <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
1719
;
20+
};
21+
22+
&spi0 {
23+
status = "disabled";
24+
};
25+
26+
&trackball {
27+
status = "disabled";
1828
};
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
CONFIG_SPI=y
22
CONFIG_INPUT=y
3-
CONFIG_ZMK_MOUSE=y
3+
CONFIG_ZMK_POINTING=y
44

55
CONFIG_ZMK_EXT_POWER=y
66

77
CONFIG_PMW3610=y
88

9-
# https://github.com/inorichi/zmk-pmw3610-driver/blob/main/Kconfig
10-
CONFIG_PMW3610_CPI=1500
11-
CONFIG_PMW3610_CPI_DIVIDOR=4
12-
CONFIG_PMW3610_ORIENTATION_90=y
13-
CONFIG_PMW3610_SNIPE_CPI=800
14-
CONFIG_PMW3610_SNIPE_CPI_DIVIDOR=4
15-
CONFIG_PMW3610_SCROLL_TICK=32
9+
# Optional orientation settings (set as needed)
10+
CONFIG_PMW3610_SWAP_XY=y
1611
CONFIG_PMW3610_INVERT_X=y
17-
CONFIG_PMW3610_INVERT_SCROLL_Y=n
12+
CONFIG_PMW3610_INVERT_Y=y
13+
14+
# Optional power saving and performance tuning
1815
CONFIG_PMW3610_RUN_DOWNSHIFT_TIME_MS=3264
19-
CONFIG_PMW3610_REST1_SAMPLE_TIME_MS=20
16+
CONFIG_PMW3610_REST1_SAMPLE_TIME_MS=40
2017
#CONFIG_PMW3610_REST1_DOWNSHIFT_TIME_MS=9600
2118
#CONFIG_PMW3610_REST2_SAMPLE_TIME_MS=
2219
#CONFIG_PMW3610_REST2_DOWNSHIFT_TIME_MS=
2320
#CONFIG_PMW3610_REST3_SAMPLE_TIME_MS=
2421
#CONFIG_PMW3610_REST3_DOWNSHIFT_TIME_MS=
2522
#CONFIG_PMW3610_FORCE_AWAKE=n
26-
CONFIG_PMW3610_POLLING_RATE_125_SW=y
2723

2824
CONFIG_PMW3610_SMART_ALGORITHM=y
29-
CONFIG_PMW3610_AUTOMOUSE_TIMEOUT_MS=400
25+
26+
# If you have power-up issues, uncomment and tune this:
27+
CONFIG_PMW3610_INIT_POWER_UP_EXTRA_DELAY_MS=1000

config/boards/shields/charybdis/charybdis_right.overlay

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
*/
66

77
#include "charybdis.dtsi"
8+
#include "pmw3610.dtsi"
9+
#include <zephyr/dt-bindings/input/input-event-codes.h>
10+
#include <dt-bindings/zmk/input_transform.h>
11+
812

913
&default_transform {
10-
col-offset = <6>;
14+
col-offset = <6>;
1115
};
1216

1317
&five_column_transform {
14-
col-offset = <5>;
18+
col-offset = <5>;
1519
};
1620

1721
&kscan0 {
@@ -24,51 +28,3 @@
2428
, <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
2529
;
2630
};
27-
28-
&pinctrl {
29-
spi0_default: spi0_default {
30-
group1 {
31-
psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
32-
<NRF_PSEL(SPIM_MOSI, 0, 17)>,
33-
<NRF_PSEL(SPIM_MISO, 0, 17)>;
34-
};
35-
};
36-
37-
spi0_sleep: spi0_sleep {
38-
group1 {
39-
psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
40-
<NRF_PSEL(SPIM_MOSI, 0, 17)>,
41-
<NRF_PSEL(SPIM_MISO, 0, 17)>;
42-
low-power-enable;
43-
};
44-
};
45-
};
46-
47-
&spi0 {
48-
status = "okay";
49-
compatible = "nordic,nrf-spim";
50-
pinctrl-0 = <&spi0_default>;
51-
pinctrl-1 = <&spi0_sleep>;
52-
pinctrl-names = "default", "sleep";
53-
cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
54-
55-
trackball: trackball@0 {
56-
status = "okay";
57-
compatible = "pixart,pmw3610";
58-
reg = <0>;
59-
spi-max-frequency = <2000000>;
60-
irq-gpios = <&gpio0 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
61-
/* optional features */
62-
scroll-layers = <5>;
63-
automouse-layer = <4>;
64-
// snipe-layers = <1>;
65-
};
66-
};
67-
68-
/ {
69-
trackball_listener {
70-
compatible = "zmk,input-listener";
71-
device = <&trackball>;
72-
73-
};
74-
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#define INPUT_EV_KEY 0x01 /**< Key event */
2+
#define INPUT_EV_REL 0x02 /**< Relative coordinate event */
3+
#define INPUT_EV_ABS 0x03 /**< Absolute coordinate event */
4+
#define INPUT_EV_MSC 0x04 /**< Miscellaneous event */
5+
#define INPUT_EV_VENDOR_START 0xf0 /**< Vendor specific event start */
6+
#define INPUT_EV_VENDOR_STOP 0xff /**< Vendor specific event stop */
7+
8+
#define INPUT_REL_X 0x00 /**< Relative X coordinate */
9+
#define INPUT_REL_Y 0x01 /**< Relative Y coordinate */
10+
#define INPUT_REL_WHEEL 0x08 /**< Relative wheel coordinate */
11+
#define INPUT_REL_HWHEEL 0x06 /**< Relative horizontal wheel coordinate */
12+
#define INPUT_REL_MISC 0x09 /**< Relative misc coordinate */
13+
14+
&pinctrl {
15+
spi0_default: spi0_default {
16+
group1 {
17+
psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
18+
<NRF_PSEL(SPIM_MOSI, 0, 17)>,
19+
<NRF_PSEL(SPIM_MISO, 0, 17)>;
20+
};
21+
};
22+
23+
spi0_sleep: spi0_sleep {
24+
group1 {
25+
psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
26+
<NRF_PSEL(SPIM_MOSI, 0, 17)>,
27+
<NRF_PSEL(SPIM_MISO, 0, 17)>;
28+
low-power-enable;
29+
};
30+
};
31+
};
32+
33+
&spi0 {
34+
status = "okay";
35+
compatible = "nordic,nrf-spim";
36+
pinctrl-0 = <&spi0_default>;
37+
pinctrl-1 = <&spi0_sleep>;
38+
pinctrl-names = "default", "sleep";
39+
cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
40+
41+
trackball: trackball@0 {
42+
status = "okay";
43+
compatible = "pixart,pmw3610";
44+
reg = <0>;
45+
spi-max-frequency = <2000000>;
46+
irq-gpios = <&gpio0 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
47+
cpi = <400>;
48+
evt-type = <INPUT_EV_REL>;
49+
x-input-code = <INPUT_REL_X>;
50+
y-input-code = <INPUT_REL_Y>;
51+
};
52+
};

0 commit comments

Comments
 (0)