From c6abcb6d893f6ef843ed98be3d45bd804cfe295a Mon Sep 17 00:00:00 2001 From: tmk Date: Wed, 20 Nov 2013 15:28:58 +0900 Subject: [PATCH] Add build options of ps2_mouse --- keyboard/onekey/config.h | 1 - protocol/ps2_mouse.c | 86 +++++++++++++++++++--------------------- protocol/ps2_mouse.h | 21 ++++++++++ 3 files changed, 61 insertions(+), 47 deletions(-) diff --git a/keyboard/onekey/config.h b/keyboard/onekey/config.h index 8403c9b6..e99a6485 100644 --- a/keyboard/onekey/config.h +++ b/keyboard/onekey/config.h @@ -69,7 +69,6 @@ along with this program. If not, see . /* PS/2 mouse */ -#define PS2_MOUSE_DEBUG #ifdef PS2_USE_BUSYWAIT # define PS2_CLOCK_PORT PORTD # define PS2_CLOCK_PIN PIND diff --git a/protocol/ps2_mouse.c b/protocol/ps2_mouse.c index ff730196..ea629655 100644 --- a/protocol/ps2_mouse.c +++ b/protocol/ps2_mouse.c @@ -22,23 +22,15 @@ along with this program. If not, see . #include "ps2_mouse.h" #include "report.h" #include "host.h" - -#define PS2_MOUSE_DEBUG -#ifdef PS2_MOUSE_DEBUG -# include "print.h" -# include "debug.h" -#else -# define print(s) -# define phex(h) -# define phex16(h) -#endif +#include "timer.h" +#include "print.h" +#include "debug.h" static report_mouse_t mouse_report = {}; -static void ps2_mouse_print_raw_data(void); -static void ps2_mouse_print_usb_data(void); +static void print_usb_data(void); /* supports only 3 button mouse at this time */ @@ -77,10 +69,6 @@ uint8_t ps2_mouse_init(void) { return 0; } -/* scroll support - * TODO: should be build option - */ -#define PS2_MOUSE_SCROLL_BUTTON 0x04 #define X_IS_NEG (mouse_report.buttons & (1<. #define PS2_MOUSE_X_OVFLW 6 #define PS2_MOUSE_Y_OVFLW 7 + +/* + * Scroll by mouse move with pressing button + */ +/* mouse button to start scrolling; set 0 to disable scroll */ +#ifndef PS2_MOUSE_SCROLL_BTN_MASK +#define PS2_MOUSE_SCROLL_BTN_MASK (1<