diff options
| author | tmk <nobody@nowhere> | 2013-11-21 13:01:47 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2013-11-21 13:01:47 +0900 |
| commit | 772ab7025ddf88126d9d6ddb654f62434985504b (patch) | |
| tree | f0b4558bba2621a824736ceea0b09b51fdd41613 /protocol/ps2_mouse.h | |
| parent | 821578293c79c5612f9b77e447295f2947fd6c3d (diff) | |
| parent | a9c3f4750b3d703b8bbbc90db2566afd2aab0ec9 (diff) | |
| download | qmk_firmware-772ab7025ddf88126d9d6ddb654f62434985504b.tar.gz qmk_firmware-772ab7025ddf88126d9d6ddb654f62434985504b.zip | |
Merge branch 'ps2_mouse_fix'
Diffstat (limited to 'protocol/ps2_mouse.h')
| -rw-r--r-- | protocol/ps2_mouse.h | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/protocol/ps2_mouse.h b/protocol/ps2_mouse.h index 4529ce113..27d9790d4 100644 --- a/protocol/ps2_mouse.h +++ b/protocol/ps2_mouse.h | |||
| @@ -20,6 +20,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 20 | 20 | ||
| 21 | #include <stdbool.h> | 21 | #include <stdbool.h> |
| 22 | 22 | ||
| 23 | #define PS2_MOUSE_READ_DATA 0xEB | ||
| 24 | |||
| 25 | /* | ||
| 26 | * Data format: | ||
| 27 | * byte|7 6 5 4 3 2 1 0 | ||
| 28 | * ----+-------------------------------------------------------------- | ||
| 29 | * 0|Yovflw Xovflw Ysign Xsign 1 Middle Right Left | ||
| 30 | * 1| X movement(0-255) | ||
| 31 | * 2| Y movement(0-255) | ||
| 32 | */ | ||
| 23 | #define PS2_MOUSE_BTN_MASK 0x07 | 33 | #define PS2_MOUSE_BTN_MASK 0x07 |
| 24 | #define PS2_MOUSE_BTN_LEFT 0 | 34 | #define PS2_MOUSE_BTN_LEFT 0 |
| 25 | #define PS2_MOUSE_BTN_RIGHT 1 | 35 | #define PS2_MOUSE_BTN_RIGHT 1 |
| @@ -29,16 +39,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 29 | #define PS2_MOUSE_X_OVFLW 6 | 39 | #define PS2_MOUSE_X_OVFLW 6 |
| 30 | #define PS2_MOUSE_Y_OVFLW 7 | 40 | #define PS2_MOUSE_Y_OVFLW 7 |
| 31 | 41 | ||
| 32 | bool ps2_mouse_enable; | 42 | |
| 33 | extern uint8_t ps2_mouse_x; | 43 | /* |
| 34 | extern uint8_t ps2_mouse_y; | 44 | * Scroll by mouse move with pressing button |
| 35 | extern uint8_t ps2_mouse_btn; | 45 | */ |
| 36 | extern uint8_t ps2_mouse_error_count; | 46 | /* mouse button to start scrolling; set 0 to disable scroll */ |
| 47 | #ifndef PS2_MOUSE_SCROLL_BTN_MASK | ||
| 48 | #define PS2_MOUSE_SCROLL_BTN_MASK (1<<PS2_MOUSE_BTN_MIDDLE) | ||
| 49 | #endif | ||
| 50 | /* send button event when button is released within this value(ms); set 0 to disable */ | ||
| 51 | #ifndef PS2_MOUSE_SCROLL_BTN_SEND | ||
| 52 | #define PS2_MOUSE_SCROLL_BTN_SEND 300 | ||
| 53 | #endif | ||
| 54 | /* divide virtical and horizontal mouse move by this to convert to scroll move */ | ||
| 55 | #ifndef PS2_MOUSE_SCROLL_DIVISOR_V | ||
| 56 | #define PS2_MOUSE_SCROLL_DIVISOR_V 2 | ||
| 57 | #endif | ||
| 58 | #ifndef PS2_MOUSE_SCROLL_DIVISOR_H | ||
| 59 | #define PS2_MOUSE_SCROLL_DIVISOR_H 2 | ||
| 60 | #endif | ||
| 61 | |||
| 37 | 62 | ||
| 38 | uint8_t ps2_mouse_init(void); | 63 | uint8_t ps2_mouse_init(void); |
| 39 | uint8_t ps2_mouse_read(void); | 64 | void ps2_mouse_task(void); |
| 40 | bool ps2_mouse_changed(void); | ||
| 41 | void ps2_mouse_usb_send(void); | ||
| 42 | void ps2_mouse_print(void); | ||
| 43 | 65 | ||
| 44 | #endif | 66 | #endif |
