aboutsummaryrefslogtreecommitdiff
path: root/docs/feature_ps2_mouse.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/feature_ps2_mouse.md')
-rw-r--r--docs/feature_ps2_mouse.md59
1 files changed, 30 insertions, 29 deletions
diff --git a/docs/feature_ps2_mouse.md b/docs/feature_ps2_mouse.md
index d13896799..ce072fbe9 100644
--- a/docs/feature_ps2_mouse.md
+++ b/docs/feature_ps2_mouse.md
@@ -1,4 +1,4 @@
1## PS/2 Mouse Support 1# PS/2 Mouse Support :id=ps2-mouse-support
2 2
3Its possible to hook up a PS/2 mouse (for example touchpads or trackpoints) to your keyboard as a composite device. 3Its possible to hook up a PS/2 mouse (for example touchpads or trackpoints) to your keyboard as a composite device.
4 4
@@ -6,7 +6,7 @@ To hook up a Trackpoint, you need to obtain a Trackpoint module (i.e. harvest fr
6 6
7There are three available modes for hooking up PS/2 devices: USART (best), interrupts (better) or busywait (not recommended). 7There are three available modes for hooking up PS/2 devices: USART (best), interrupts (better) or busywait (not recommended).
8 8
9### The Cirtuitry between Trackpoint and Controller 9## The Circuitry between Trackpoint and Controller :id=the-circuitry-between-trackpoint-and-controller
10 10
11To get the things working, a 4.7K drag is needed between the two lines DATA and CLK and the line 5+. 11To get the things working, a 4.7K drag is needed between the two lines DATA and CLK and the line 5+.
12 12
@@ -24,20 +24,20 @@ MODULE 5+ --------+--+--------- PWR CONTROLLER
24``` 24```
25 25
26 26
27### Busywait Version 27## Busywait Version :id=busywait-version
28 28
29Note: This is not recommended, you may encounter jerky movement or unsent inputs. Please use interrupt or USART version if possible. 29Note: This is not recommended, you may encounter jerky movement or unsent inputs. Please use interrupt or USART version if possible.
30 30
31In rules.mk: 31In rules.mk:
32 32
33``` 33```makefile
34PS2_MOUSE_ENABLE = yes 34PS2_MOUSE_ENABLE = yes
35PS2_USE_BUSYWAIT = yes 35PS2_USE_BUSYWAIT = yes
36``` 36```
37 37
38In your keyboard config.h: 38In your keyboard config.h:
39 39
40``` 40```c
41#ifdef PS2_USE_BUSYWAIT 41#ifdef PS2_USE_BUSYWAIT
42# define PS2_CLOCK_PORT PORTD 42# define PS2_CLOCK_PORT PORTD
43# define PS2_CLOCK_PIN PIND 43# define PS2_CLOCK_PIN PIND
@@ -50,20 +50,20 @@ In your keyboard config.h:
50#endif 50#endif
51``` 51```
52 52
53### Interrupt Version 53## Interrupt Version :id=interrupt-version
54 54
55The following example uses D2 for clock and D5 for data. You can use any INT or PCINT pin for clock, and any pin for data. 55The following example uses D2 for clock and D5 for data. You can use any INT or PCINT pin for clock, and any pin for data.
56 56
57In rules.mk: 57In rules.mk:
58 58
59``` 59```makefile
60PS2_MOUSE_ENABLE = yes 60PS2_MOUSE_ENABLE = yes
61PS2_USE_INT = yes 61PS2_USE_INT = yes
62``` 62```
63 63
64In your keyboard config.h: 64In your keyboard config.h:
65 65
66``` 66```c
67#ifdef PS2_USE_INT 67#ifdef PS2_USE_INT
68#define PS2_CLOCK_PORT PORTD 68#define PS2_CLOCK_PORT PORTD
69#define PS2_CLOCK_PIN PIND 69#define PS2_CLOCK_PIN PIND
@@ -88,20 +88,20 @@ In your keyboard config.h:
88#endif 88#endif
89``` 89```
90 90
91### USART Version 91## USART Version :id=usart-version
92 92
93To use USART on the ATMega32u4, you have to use PD5 for clock and PD2 for data. If one of those are unavailable, you need to use interrupt version. 93To use USART on the ATMega32u4, you have to use PD5 for clock and PD2 for data. If one of those are unavailable, you need to use interrupt version.
94 94
95In rules.mk: 95In rules.mk:
96 96
97``` 97```makefile
98PS2_MOUSE_ENABLE = yes 98PS2_MOUSE_ENABLE = yes
99PS2_USE_USART = yes 99PS2_USE_USART = yes
100``` 100```
101 101
102In your keyboard config.h: 102In your keyboard config.h:
103 103
104``` 104```c
105#ifdef PS2_USE_USART 105#ifdef PS2_USE_USART
106#define PS2_CLOCK_PORT PORTD 106#define PS2_CLOCK_PORT PORTD
107#define PS2_CLOCK_PIN PIND 107#define PS2_CLOCK_PIN PIND
@@ -145,13 +145,13 @@ In your keyboard config.h:
145#endif 145#endif
146``` 146```
147 147
148### Additional Settings 148## Additional Settings :id=additional-settings
149 149
150#### PS/2 Mouse Features 150### PS/2 Mouse Features :id=ps2-mouse-features
151 151
152These enable settings supported by the PS/2 mouse protocol. 152These enable settings supported by the PS/2 mouse protocol.
153 153
154``` 154```c
155/* Use remote mode instead of the default stream mode (see link) */ 155/* Use remote mode instead of the default stream mode (see link) */
156#define PS2_MOUSE_USE_REMOTE_MODE 156#define PS2_MOUSE_USE_REMOTE_MODE
157 157
@@ -170,7 +170,7 @@ These enable settings supported by the PS/2 mouse protocol.
170 170
171You can also call the following functions from ps2_mouse.h 171You can also call the following functions from ps2_mouse.h
172 172
173``` 173```c
174void ps2_mouse_disable_data_reporting(void); 174void ps2_mouse_disable_data_reporting(void);
175 175
176void ps2_mouse_enable_data_reporting(void); 176void ps2_mouse_enable_data_reporting(void);
@@ -188,36 +188,36 @@ void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution);
188void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate); 188void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate);
189``` 189```
190 190
191#### Fine Control 191### Fine Control :id=fine-control
192 192
193Use the following defines to change the sensitivity and speed of the mouse. 193Use the following defines to change the sensitivity and speed of the mouse.
194Note: you can also use `ps2_mouse_set_resolution` for the same effect (not supported on most touchpads). 194Note: you can also use `ps2_mouse_set_resolution` for the same effect (not supported on most touchpads).
195 195
196``` 196```c
197#define PS2_MOUSE_X_MULTIPLIER 3 197#define PS2_MOUSE_X_MULTIPLIER 3
198#define PS2_MOUSE_Y_MULTIPLIER 3 198#define PS2_MOUSE_Y_MULTIPLIER 3
199#define PS2_MOUSE_V_MULTIPLIER 1 199#define PS2_MOUSE_V_MULTIPLIER 1
200``` 200```
201 201
202#### Scroll Button 202### Scroll Button :id=scroll-button
203 203
204If you're using a trackpoint, you will likely want to be able to use it for scrolling. 204If you're using a trackpoint, you will likely want to be able to use it for scrolling.
205It's possible to enable a "scroll button/s" that when pressed will cause the mouse to scroll instead of moving. 205It's possible to enable a "scroll button/s" that when pressed will cause the mouse to scroll instead of moving.
206To enable the feature, you must set a scroll button mask as follows: 206To enable the feature, you must set a scroll button mask as follows:
207 207
208``` 208```c
209#define PS2_MOUSE_SCROLL_BTN_MASK (1<<PS2_MOUSE_BUTTON_MIDDLE) /* Default */ 209#define PS2_MOUSE_SCROLL_BTN_MASK (1<<PS2_MOUSE_BUTTON_MIDDLE) /* Default */
210``` 210```
211 211
212To disable the scroll button feature: 212To disable the scroll button feature:
213 213
214``` 214```c
215#define PS2_MOUSE_SCROLL_BTN_MASK 0 215#define PS2_MOUSE_SCROLL_BTN_MASK 0
216``` 216```
217 217
218The available buttons are: 218The available buttons are:
219 219
220``` 220```c
221#define PS2_MOUSE_BTN_LEFT 0 221#define PS2_MOUSE_BTN_LEFT 0
222#define PS2_MOUSE_BTN_RIGHT 1 222#define PS2_MOUSE_BTN_RIGHT 1
223#define PS2_MOUSE_BTN_MIDDLE 2 223#define PS2_MOUSE_BTN_MIDDLE 2
@@ -229,27 +229,28 @@ Once you've configured your scroll button mask, you must configure the scroll bu
229This is the interval before which if the scroll buttons were released they would be sent to the host. 229This is the interval before which if the scroll buttons were released they would be sent to the host.
230After this interval, they will cause the mouse to scroll and will not be sent. 230After this interval, they will cause the mouse to scroll and will not be sent.
231 231
232``` 232```c
233#define PS2_MOUSE_SCROLL_BTN_SEND 300 /* Default */ 233#define PS2_MOUSE_SCROLL_BTN_SEND 300 /* Default */
234``` 234```
235 235
236To disable sending the scroll buttons: 236To disable sending the scroll buttons:
237``` 237
238```c
238#define PS2_MOUSE_SCROLL_BTN_SEND 0 239#define PS2_MOUSE_SCROLL_BTN_SEND 0
239``` 240```
240 241
241Fine control over the scrolling is supported with the following defines: 242Fine control over the scrolling is supported with the following defines:
242 243
243``` 244```c
244#define PS2_MOUSE_SCROLL_DIVISOR_H 2 245#define PS2_MOUSE_SCROLL_DIVISOR_H 2
245#define PS2_MOUSE_SCROLL_DIVISOR_V 2 246#define PS2_MOUSE_SCROLL_DIVISOR_V 2
246``` 247```
247 248
248#### Invert Mouse and Scroll Axes 249### Invert Mouse and Scroll Axes :id=invert-mouse-and-scroll-axes
249 250
250To invert the X and Y axes you can put: 251To invert the X and Y axes you can put:
251 252
252``` 253```c
253#define PS2_MOUSE_INVERT_X 254#define PS2_MOUSE_INVERT_X
254#define PS2_MOUSE_INVERT_Y 255#define PS2_MOUSE_INVERT_Y
255``` 256```
@@ -258,18 +259,18 @@ into config.h.
258 259
259To reverse the scroll axes you can put: 260To reverse the scroll axes you can put:
260 261
261``` 262```c
262#define PS2_MOUSE_INVERT_H 263#define PS2_MOUSE_INVERT_H
263#define PS2_MOUSE_INVERT_V 264#define PS2_MOUSE_INVERT_V
264``` 265```
265 266
266into config.h. 267into config.h.
267 268
268#### Debug Settings 269### Debug Settings :id=debug-settings
269 270
270To debug the mouse, add `debug_mouse = true` or enable via bootmagic. 271To debug the mouse, add `debug_mouse = true` or enable via bootmagic.
271 272
272``` 273```c
273/* To debug the mouse reports */ 274/* To debug the mouse reports */
274#define PS2_MOUSE_DEBUG_HID 275#define PS2_MOUSE_DEBUG_HID
275#define PS2_MOUSE_DEBUG_RAW 276#define PS2_MOUSE_DEBUG_RAW