diff options
Diffstat (limited to 'keyboards/ploopyco/mouse/mouse.c')
| -rw-r--r-- | keyboards/ploopyco/mouse/mouse.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/keyboards/ploopyco/mouse/mouse.c b/keyboards/ploopyco/mouse/mouse.c index 1b00ef3b7..25ebd1ee2 100644 --- a/keyboards/ploopyco/mouse/mouse.c +++ b/keyboards/ploopyco/mouse/mouse.c | |||
| @@ -66,7 +66,24 @@ uint8_t OptLowPin = OPT_ENC1; | |||
| 66 | bool debug_encoder = false; | 66 | bool debug_encoder = false; |
| 67 | bool is_drag_scroll = false; | 67 | bool is_drag_scroll = false; |
| 68 | 68 | ||
| 69 | void process_wheel(report_mouse_t* mouse_report) { | 69 | __attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { return true; } |
| 70 | |||
| 71 | bool encoder_update_kb(uint8_t index, bool clockwise) { | ||
| 72 | if (!encoder_update_user(index, clockwise)) { | ||
| 73 | return false; | ||
| 74 | } | ||
| 75 | #ifdef MOUSEKEY_ENABLE | ||
| 76 | tap_code(clockwise ? KC_WH_U : KC_WH_D); | ||
| 77 | #else | ||
| 78 | mouse_report_t mouse_report = pointing_device_get_report(); | ||
| 79 | mouse_report.v = clockwise ? 1 : -1; | ||
| 80 | pointing_device_set_report(mouse_report); | ||
| 81 | pointing_device_send(); | ||
| 82 | #endif | ||
| 83 | return true; | ||
| 84 | } | ||
| 85 | |||
| 86 | void process_wheel(void) { | ||
| 70 | // Lovingly ripped from the Ploopy Source | 87 | // Lovingly ripped from the Ploopy Source |
| 71 | 88 | ||
| 72 | // If the mouse wheel was just released, do not scroll. | 89 | // If the mouse wheel was just released, do not scroll. |
| @@ -94,11 +111,11 @@ void process_wheel(report_mouse_t* mouse_report) { | |||
| 94 | int dir = opt_encoder_handler(p1, p2); | 111 | int dir = opt_encoder_handler(p1, p2); |
| 95 | 112 | ||
| 96 | if (dir == 0) return; | 113 | if (dir == 0) return; |
| 97 | mouse_report->v = (int8_t)(dir * OPT_SCALE); | 114 | encoder_update_kb(0, dir == 1); |
| 98 | } | 115 | } |
| 99 | 116 | ||
| 100 | __attribute__((weak)) report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { | 117 | report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { |
| 101 | process_wheel(&mouse_report); | 118 | process_wheel(); |
| 102 | 119 | ||
| 103 | if (is_drag_scroll) { | 120 | if (is_drag_scroll) { |
| 104 | mouse_report.h = mouse_report.x; | 121 | mouse_report.h = mouse_report.x; |
