Skip to content

Commit 9d23924

Browse files
committed
Scroll speed fix for badjeff's PMW3610 driver
1 parent 247df54 commit 9d23924

7 files changed

Lines changed: 36 additions & 117 deletions

File tree

boards/shields/charybdis/charybdis.dtsi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
chosen {
66
zmk,kscan = &kscan0;
77
zmk,matrix_transform = &default_transform;
8-
// zmk,underglow = &led_strip;
98
};
109

1110
default_transform: keymap_transform_0 {

boards/shields/charybdis/charybdis.zmk.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ requires: [pro_micro]
77
features:
88
- keys
99
- pointer
10-
- underglow
1110
siblings:
1211
- charybdis_left
1312
- charybdis_right
Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/*
2-
* Copyright (c) 2020 ZMK Contributors
3-
*
4-
* SPDX-License-Identifier: MIT
5-
*/
6-
71
#include "charybdis.dtsi"
82

93
&kscan0 {
@@ -16,45 +10,3 @@
1610
, <&gpio1 4 GPIO_ACTIVE_HIGH>
1711
;
1812
};
19-
20-
//RGB bus
21-
//
22-
//&pinctrl {
23-
// spi3_default: spi3_default {
24-
// group1 {
25-
// psels = <NRF_PSEL(SPIM_MOSI, 0, 10)>;
26-
// };
27-
// };
28-
//
29-
// spi3_sleep: spi3_sleep {
30-
// group1 {
31-
// psels = <NRF_PSEL(SPIM_MOSI, 0, 10)>;
32-
// low-power-enable;
33-
// };
34-
// };
35-
//};
36-
//
37-
//&spi3 {
38-
// compatible = "nordic,nrf-spim";
39-
// status = "okay";
40-
//
41-
// pinctrl-0 = <&spi3_default>;
42-
// pinctrl-1 = <&spi3_sleep>;
43-
// pinctrl-names = "default", "sleep";
44-
//
45-
// led_strip: ws2812@0 {
46-
// compatible = "worldsemi,ws2812-spi";
47-
//
48-
// /* SPI */
49-
// reg = <0>; /* ignored, but necessary for SPI bindings */
50-
// spi-max-frequency = <4000000>;
51-
//
52-
// /* WS2812 */
53-
// chain-length = <29>; /* number of LEDs */
54-
// spi-one-frame = <0x70>;
55-
// spi-zero-frame = <0x40>;
56-
// color-mapping = <LED_COLOR_ID_GREEN
57-
// LED_COLOR_ID_RED
58-
// LED_COLOR_ID_BLUE>;
59-
// };
60-
//};
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
CONFIG_SPI=y
22
CONFIG_INPUT=y
3-
CONFIG_ZMK_MOUSE=y
3+
CONFIG_ZMK_POINTING=y
44
CONFIG_PMW3610=y
5-
CONFIG_PMW3610_CPI=2000
6-
CONFIG_PMW3610_CPI_DIVIDOR=4
7-
CONFIG_PMW3610_ORIENTATION_90=y
8-
CONFIG_PMW3610_SNIPE_CPI=200
9-
CONFIG_PMW3610_SNIPE_CPI_DIVIDOR=1
10-
CONFIG_PMW3610_SCROLL_TICK=70
5+
CONFIG_PMW3610_SWAP_XY=y
116
CONFIG_PMW3610_INVERT_X=y
12-
CONFIG_PMW3610_POLLING_RATE_125_SW=y
7+
CONFIG_PMW3610_INVERT_Y=y
138
CONFIG_PMW3610_SMART_ALGORITHM=y
149

1510
CONFIG_ZMK_EXT_POWER=y
Lines changed: 29 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
/*
2-
* Copyright (c) 2020 ZMK Contributors
3-
*
4-
* SPDX-License-Identifier: MIT
5-
*/
6-
71
#include "charybdis.dtsi"
2+
#include <input/processors.dtsi>
3+
#include <dt-bindings/zmk/input_transform.h>
84

95
&default_transform {
106
col-offset = <6>;
@@ -55,57 +51,35 @@
5551
reg = <0>;
5652
spi-max-frequency = <2000000>;
5753
irq-gpios = <&gpio0 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
58-
scroll-layers = <3>;
59-
//snipe-layers = <2>;
60-
// automouse-layer = <3>;
54+
cpi = <1000>;
55+
evt-type = <INPUT_EV_REL>;
56+
x-input-code = <INPUT_REL_X>;
57+
y-input-code = <INPUT_REL_Y>;
58+
59+
force-awake;
60+
/* keep the sensor awake while ZMK activity state is ACTIVE,
61+
fallback to normal downshift mode after ZMK goes into IDLE / SLEEP mode.
62+
thus, the sensor would be a `wakeup-source` */
63+
64+
force-awake-4ms-mode;
65+
/* while force-awake is acitvated, enable this mode to force sampling per
66+
4ms, where the default sampling rate is 8ms. */
67+
/* NOTE: apply this mode if you need 250Hz with direct USB connection. */
6168
};
6269
};
6370

6471
/ {
65-
trackball_listener {
66-
compatible = "zmk,input-listener";
67-
device = <&trackball>;
68-
};
69-
};
72+
trackball_listener {
73+
compatible = "zmk,input-listener";
74+
device = <&trackball>;
7075

71-
//RGB bus
72-
//&pinctrl {
73-
// spi3_default: spi3_default {
74-
// group1 {
75-
// psels = <NRF_PSEL(SPIM_MOSI, 0, 10)>;
76-
// };
77-
// };
78-
//
79-
// spi3_sleep: spi3_sleep {
80-
// group1 {
81-
// psels = <NRF_PSEL(SPIM_MOSI, 0, 10)>;
82-
// low-power-enable;
83-
// };
84-
// };
85-
//};
86-
//
87-
//&spi3 {
88-
// compatible = "nordic,nrf-spim";
89-
// status = "okay";
90-
//
91-
// pinctrl-0 = <&spi3_default>;
92-
// pinctrl-1 = <&spi3_sleep>;
93-
// pinctrl-names = "default", "sleep";
94-
//
95-
// led_strip: ws2812@0 {
96-
// compatible = "worldsemi,ws2812-spi";
97-
//
98-
// /* SPI */
99-
// reg = <0>; /* ignored, but necessary for SPI bindings */
100-
// spi-max-frequency = <4000000>;
101-
//
102-
// /* WS2812 */
103-
// chain-length = <27>; /* number of LEDs */
104-
// spi-one-frame = <0x70>;
105-
// spi-zero-frame = <0x40>;
106-
// color-mapping = <LED_COLOR_ID_GREEN
107-
// LED_COLOR_ID_RED
108-
// LED_COLOR_ID_BLUE>;
109-
// };
110-
//};
111-
//
76+
scroller {
77+
layers = <3>;
78+
input-processors = <
79+
&zip_xy_to_scroll_mapper
80+
&zip_scroll_scaler 1 4
81+
&zip_xy_transform INPUT_TRANSFORM_Y_INVERT
82+
>;
83+
};
84+
};
85+
};

config/charybdis.keymap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <dt-bindings/zmk/bt.h>
33
#include <dt-bindings/zmk/keys.h>
44
#include <dt-bindings/zmk/pointing.h>
5-
#include <dt-bindings/zmk/rgb.h>
5+
#include <zephyr/dt-bindings/input/input-event-codes.h>
66

77
/* KEY POSITIONS
88
╭───────────────────╮ ╭───────────────────╮

config/west.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ manifest:
22
remotes:
33
- name: zmkfirmware
44
url-base: https://github.com/zmkfirmware
5-
- name: inorichi
6-
url-base: https://github.com/inorichi
5+
- name: badjeff
6+
url-base: https://github.com/badjeff
77
projects:
88
- name: zmk
99
remote: zmkfirmware
1010
revision: main
1111
import: app/west.yml
1212
- name: zmk-pmw3610-driver
13-
remote: inorichi
13+
remote: badjeff
1414
revision: main
1515
self:
1616
path: config

0 commit comments

Comments
 (0)