-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmouse_tp.dtsi
198 lines (149 loc) · 5.8 KB
/
mouse_tp.dtsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#ifdef HAS_MOUSE_TP
#include <dt-bindings/zmk/mouse.h>
#include <dt-bindings/zmk/mouse_settings.h>
#include <behaviors/mouse_keys.dtsi>
#include <behaviors/mouse_setting.dtsi>
/*
* Key Behaviors to adjust settings
*/
// They key codes below can be used to adjust the TP settings at runtime
// without needing to recompile the firmware.
//
// The values will be logged and saved in the config on the controller flash
// after 60s (CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE).
//
// On boot the settings will be restored again.
//
// If you prefer a more explicit way of configuration, you can also hardcode
// these settings in `&mouse_ps2`.
//
// If you set these settings in `&mouse_ps2`, you will still be able to
// adjust the values during runtime with these key codes, but after
// restarting the board the values in `&mouse_ps2` will be restored and not
// the ones stored in the flash using the key codes.
// How sensitive the trackpoint is
#define U_MSS_TP_S_I &mms MS_TP_SENSITIVITY_INCR
#define U_MSS_TP_S_D &mms MS_TP_SENSITIVITY_DECR
// The maximum speed the trackpoint will accelerate to
#define U_MSS_TP_V6_I &mms MS_TP_VALUE6_INCR
#define U_MSS_TP_V6_D &mms MS_TP_VALUE6_DECR
// I am not quite sure tbh... default seems fine.
#define U_MSS_TP_NI_I &mms MS_TP_NEG_INERTIA_INCR
#define U_MSS_TP_NI_D &mms MS_TP_NEG_INERTIA_DECR
// How hard you have to press to activate the "Press To Select" feature that
// lets you tap or press on the trackpoint to click.
//
// Not all trackpoints support it and you have to enable
// `tp-press-to-select;` in `&mouse_ps2` first.
#define U_MSS_TP_PT_I &mms MS_TP_PTS_THRESHOLD_INCR
#define U_MSS_TP_PT_D &mms MS_TP_PTS_THRESHOLD_DECR
// If you mess up the settings, you can use this key code to clear the
// settings from flash and re-set the default values on the TP.
//
// Make sure to wait at least CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE seconds (60
// by default) before restarting the board to ensure the settings are
// written to flash storage.
#define U_MSS_RESET &mms MS_RESET
// If you prefer to set the settings in `&mouse_ps2`, you can use the key
// codes above to find the settings you like the most and then press this
// key code to output the settings to the log.
//
// Then you can add those values to `&mouse_ps2`
#define U_MSS_LOG &mms MS_LOG
// Only apply these settings on the side that has the TP connected
// (usually the right side)
#ifdef MOUSE_PS2_DT_PRESENT
/*
* Input Listener Config
*/
&mouse_ps2_input_listener {
// Adjust pointing device axes.
// This adjusts the values inside the zmk driver. Some
// trackpoints also allow you to adjust it in their firmware. Check
// the driver options below for more info.
// xy-swap;
// x-invert;
// y-invert;
// Set the layer that should automatically activate when the mouse is
// moving.
layer-toggle = <MOUSE_TP>;
// How long the mouse needs to move for before the layer is activated (to
// avoid accidental activations while typing) (Default: 250)
layer-toggle-delay-ms = <250>;
// How long to wait, after the last mouse movement, before deactivating
// the layer (Default: 250)
layer-toggle-timeout-ms = <250>;
};
/*
* Mouse Driver Settings
*/
&mouse_ps2 {
// How sensitive the TP is (Default: 128)
// tp-sensitivity = <128>;
// The maximum mouse movement speed the TP will accelarate to
// (Default: 97)
// tp-val6-upper-speed = <97>;
// Negative Inertia (Default: 6)
// Makes the TP feel more responsive and "overshoot" less.
// tp-neg-inertia = <6>;
// Enable clicking by tapping on the TP.
// Not all TPs support this.
// tp-press-to-select;
// tp-press-to-select-threshold = <10>;
// Adjust axis settings on the TP
// Works only on some trackpoints, but may be properly considered by the
// trackpoint's acceleration features (which may or may not have an
// impact).
//
// Alternatively consider achieving the same effect using the
// `input-listener` settings below.
// tp-xy-swap;
// tp-x-invert;
// tp-y-invert;
// Set sampling rate
//
// The frequency at which the mouse samples and sends data (in hz).
// The default rate is 100. You can try lowering it if you experience
// connection errors.
//
// Higher values than 100 are no improvement in my experience, but will
// increase battery life and potentially errors in transmissions.
//
// These values are allowed: 10,20,40,60,80,100,200
// sampling-rate = <60>;
// Disables clicking.
// Useful when using the PS2 GPIO driver that is prone to
// erros in transmissions to reduce accidental clicks.
// disable-clicking;
// Enable scroll wheel
// For mouse devices supporting the Intellimouse extension. Not relevant
// for trackpoints
// scroll-mode;
};
// Enable PS/2 Mouse Devices
// In `your_keyboard_right.overlay` all devices have `status = "disabled"`.
// So,they are never compiled into the firmware.
//
// Here we enable them, but we do it within the #ifdef HAS_MOUSE_TP code
// block, which prevents compilation and potential build errors when we
// undefine HAS_MOUSE_TP in corne_tp.keymap
&mouse_ps2 {
status = "okay";
};
&mouse_ps2_input_listener {
status = "okay";
};
#ifdef MOUSE_PS2_DRIVER_UART
&uart0 {
status = "okay";
};
&uart_ps2 {
status="okay";
};
#else
&gpio_ps2 {
status = "okay";
};
#endif // MOUSE_PS2_DRIVER_UART
#endif // MOUSE_PS2_DT_PRESENT
#endif // HAS_MOUSE_TP