From 8e2732edf3c457d98dd4526d88dad26786cb3db9 Mon Sep 17 00:00:00 2001 From: Ofer Plesser Date: Sat, 3 Dec 2016 13:11:37 +0200 Subject: [PATCH] Updated ps2 mouse documentation in readme --- readme.md | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index be1510832..1f06fe79f 100644 --- a/readme.md +++ b/readme.md @@ -1191,7 +1191,7 @@ Please note the USB port can only supply a limited amount of power to the keyboa Its possible to hook up a PS/2 mouse (for example touchpads or trackpoints) to your keyboard as a composite device. -Then, decide whether to use USART (best), interrupts (better) or busywait (not recommended), and enable the relevant option. +There are three available modes for hooking up PS/2 devices: USART (best), interrupts (better) or busywait (not recommended). ### Busywait version @@ -1316,6 +1316,116 @@ In your keyboard config.h: #endif ``` +### Additional Settings + +#### PS/2 mouse features + +These enable settings supported by the PS/2 mouse protocol: http://www.computer-engineering.org/ps2mouse/ + +``` +/* Use remote mode instead of the default stream mode (see link) */ +#define PS2_MOUSE_USE_REMOTE_MODE + +/* Enable the scrollwheel or scroll gesture on your mouse or touchpad */ +#define PS2_MOUSE_ENABLE_SCROLLING + +/* Some mice will need a scroll mask to be configured. The default is 0xFF. */ +#define PS2_MOUSE_SCROLL_MASK 0x0F + +/* Applies a transformation to the movement before sending to the host (see link) */ +#define PS2_MOUSE_USE_2_1_SCALING + +/* The time to wait after initializing the ps2 host */ +#define PS2_MOUSE_INIT_DELAY 1000 /* Default */ +``` + +You can also call the following functions from ps2_mouse.h + +``` +void ps2_mouse_disable_data_reporting(void); + +void ps2_mouse_enable_data_reporting(void); + +void ps2_mouse_set_remote_mode(void); + +void ps2_mouse_set_stream_mode(void); + +void ps2_mouse_set_scaling_2_1(void); + +void ps2_mouse_set_scaling_1_1(void); + +void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution); + +void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate); +``` + +#### Fine control + +Use the following defines to change the sensitivity and speed of the mouse. +Note: you can also use `ps2_mouse_set_resolution` for the same effect (not supported on most touchpads). + +``` +#define PS2_MOUSE_X_MULTIPLIER 3 +#define PS2_MOUSE_Y_MULTIPLIER 3 +#define PS2_MOUSE_V_MULTIPLIER 1 +``` + +#### Scroll button + +If you're using a trackpoint, you will likely want to be able to use it for scrolling. +Its possible to enable a "scroll button/s" that when pressed will cause the mouse to scroll instead of moving. +To enable the feature, you must set a scroll button mask as follows: + +``` +#define PS2_MOUSE_SCROLL_BTN_MASK (1<