diff options
Diffstat (limited to 'tmk_core/protocol/ps2_mouse.c')
| -rw-r--r-- | tmk_core/protocol/ps2_mouse.c | 54 |
1 files changed, 7 insertions, 47 deletions
diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c index af971dd49..e3c697444 100644 --- a/tmk_core/protocol/ps2_mouse.c +++ b/tmk_core/protocol/ps2_mouse.c | |||
| @@ -28,53 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 28 | 28 | ||
| 29 | /* ============================= MACROS ============================ */ | 29 | /* ============================= MACROS ============================ */ |
| 30 | 30 | ||
| 31 | #define PS2_MOUSE_SEND(command, message) \ | 31 | static report_mouse_t mouse_report = {};./ |
| 32 | do { \ | ||
| 33 | uint8_t rcv = ps2_host_send(command); \ | ||
| 34 | if (debug_mouse) { \ | ||
| 35 | print((message)); \ | ||
| 36 | xprintf(" command: %X, result: %X, error: %X \n", command, rcv, ps2_error); \ | ||
| 37 | } \ | ||
| 38 | } while(0) | ||
| 39 | |||
| 40 | #define PS2_MOUSE_SEND_SAFE(command, message) \ | ||
| 41 | do { \ | ||
| 42 | if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \ | ||
| 43 | ps2_mouse_disable_data_reporting(); \ | ||
| 44 | } \ | ||
| 45 | PS2_MOUSE_SEND(command, message); \ | ||
| 46 | if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \ | ||
| 47 | ps2_mouse_enable_data_reporting(); \ | ||
| 48 | } \ | ||
| 49 | } while(0) | ||
| 50 | |||
| 51 | #define PS2_MOUSE_SET_SAFE(command, value, message) \ | ||
| 52 | do { \ | ||
| 53 | if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \ | ||
| 54 | ps2_mouse_disable_data_reporting(); \ | ||
| 55 | } \ | ||
| 56 | PS2_MOUSE_SEND(command, message); \ | ||
| 57 | PS2_MOUSE_SEND(value, "Sending value"); \ | ||
| 58 | if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \ | ||
| 59 | ps2_mouse_enable_data_reporting(); \ | ||
| 60 | } \ | ||
| 61 | } while(0) | ||
| 62 | |||
| 63 | #define PS2_MOUSE_RECEIVE(message) \ | ||
| 64 | do { \ | ||
| 65 | uint8_t rcv = ps2_host_recv_response(); \ | ||
| 66 | if (debug_mouse) { \ | ||
| 67 | print((message)); \ | ||
| 68 | xprintf(" result: %X, error: %X \n", rcv, ps2_error); \ | ||
| 69 | } \ | ||
| 70 | } while(0) | ||
| 71 | |||
| 72 | static enum ps2_mouse_mode_e { | ||
| 73 | PS2_MOUSE_STREAM_MODE, | ||
| 74 | PS2_MOUSE_REMOTE_MODE, | ||
| 75 | } ps2_mouse_mode = PS2_MOUSE_STREAM_MODE; | ||
| 76 | |||
| 77 | static report_mouse_t mouse_report = {}; | ||
| 78 | 32 | ||
| 79 | static inline void ps2_mouse_print_report(report_mouse_t *mouse_report); | 33 | static inline void ps2_mouse_print_report(report_mouse_t *mouse_report); |
| 80 | static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report); | 34 | static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report); |
| @@ -108,6 +62,12 @@ void ps2_mouse_init(void) { | |||
| 108 | #ifdef PS2_MOUSE_USE_2_1_SCALING | 62 | #ifdef PS2_MOUSE_USE_2_1_SCALING |
| 109 | ps2_mouse_set_scaling_2_1(); | 63 | ps2_mouse_set_scaling_2_1(); |
| 110 | #endif | 64 | #endif |
| 65 | |||
| 66 | ps2_mouse_init_user(); | ||
| 67 | } | ||
| 68 | |||
| 69 | __attribute__((weak)) | ||
| 70 | void ps2_mouse_init_user(void) { | ||
| 111 | } | 71 | } |
| 112 | 72 | ||
| 113 | void ps2_mouse_task(void) { | 73 | void ps2_mouse_task(void) { |
