aboutsummaryrefslogtreecommitdiff
path: root/keyboards/ploopyco/mouse
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/ploopyco/mouse')
-rw-r--r--keyboards/ploopyco/mouse/mouse.c25
-rw-r--r--keyboards/ploopyco/mouse/readme.md14
2 files changed, 20 insertions, 19 deletions
diff --git a/keyboards/ploopyco/mouse/mouse.c b/keyboards/ploopyco/mouse/mouse.c
index 1eb5e3ead..0bf96a20f 100644
--- a/keyboards/ploopyco/mouse/mouse.c
+++ b/keyboards/ploopyco/mouse/mouse.c
@@ -247,7 +247,6 @@ void pointing_device_init(void) {
247 opt_encoder_init(); 247 opt_encoder_init();
248} 248}
249 249
250bool has_report_changed(report_mouse_t new, report_mouse_t old) { return (new.buttons != old.buttons) || (new.x && new.x != old.x) || (new.y && new.y != old.y) || (new.h && new.h != old.h) || (new.v && new.v != old.v); }
251 250
252void pointing_device_task(void) { 251void pointing_device_task(void) {
253 report_mouse_t mouse_report = pointing_device_get_report(); 252 report_mouse_t mouse_report = pointing_device_get_report();
@@ -256,7 +255,12 @@ void pointing_device_task(void) {
256 255
257 if (is_drag_scroll) { 256 if (is_drag_scroll) {
258 mouse_report.h = mouse_report.x; 257 mouse_report.h = mouse_report.x;
258#ifdef PLOOPY_DRAGSCROLL_INVERT
259 // Invert vertical scroll direction
260 mouse_report.v = -mouse_report.y;
261#else
259 mouse_report.v = mouse_report.y; 262 mouse_report.v = mouse_report.y;
263#endif
260 mouse_report.x = 0; 264 mouse_report.x = 0;
261 mouse_report.y = 0; 265 mouse_report.y = 0;
262 } 266 }
@@ -265,27 +269,10 @@ void pointing_device_task(void) {
265 pointing_device_send(); 269 pointing_device_send();
266} 270}
267 271
268void pointing_device_send(void) {
269 static report_mouse_t old_report = {};
270 report_mouse_t mouseReport = pointing_device_get_report();
271
272 // If you need to do other things, like debugging, this is the place to do it.
273 if (has_report_changed(mouseReport, old_report)) {
274 host_mouse_send(&mouseReport);
275 }
276
277 // send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device
278 mouseReport.x = 0;
279 mouseReport.y = 0;
280 mouseReport.v = 0;
281 mouseReport.h = 0;
282 pointing_device_set_report(mouseReport);
283 old_report = mouseReport;
284}
285
286void eeconfig_init_kb(void) { 272void eeconfig_init_kb(void) {
287 keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT; 273 keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT;
288 eeconfig_update_kb(keyboard_config.raw); 274 eeconfig_update_kb(keyboard_config.raw);
275 eeconfig_init_user();
289} 276}
290 277
291void matrix_init_kb(void) { 278void matrix_init_kb(void) {
diff --git a/keyboards/ploopyco/mouse/readme.md b/keyboards/ploopyco/mouse/readme.md
index ff37a6b80..e9ad915a6 100644
--- a/keyboards/ploopyco/mouse/readme.md
+++ b/keyboards/ploopyco/mouse/readme.md
@@ -50,3 +50,17 @@ To configure/set your own array, there are two defines to use, `PLOOPY_DPI_OPTIO
50The `PLOOPY_DPI_OPTIONS` array sets the values that you want to be able to cycle through, and the order they are in. The "default" define lets the firmware know which of these options is the default and should be loaded by default. 50The `PLOOPY_DPI_OPTIONS` array sets the values that you want to be able to cycle through, and the order they are in. The "default" define lets the firmware know which of these options is the default and should be loaded by default.
51 51
52The `DPI_CONFIG` macro will cycle through the values in the array, each time you hit it. And it stores this value in persistent memory, so it will load it the next time the device powers up. 52The `DPI_CONFIG` macro will cycle through the values in the array, each time you hit it. And it stores this value in persistent memory, so it will load it the next time the device powers up.
53
54## Drag Scroll
55
56Drag Sroll is a custom keycode for the Ploopy devices that allow you to hold or tap a button and have the mouse movement translate into scrolling instead.
57
58Nothing needs to be enabled to use this functionality. Just add the `DRAG_SCROLL` to your keymap.
59
60### Drag Scroll Configuration
61
62* `#define PLOOPY_DRAGSCROLL_MOMENTARY` - Makes the key into a momentary key, rather than a toggle.
63* `#define PLOOPY_DRAGSCROLL_MULTIPLIER 0.75` - Sets the DPI multiplier to use when drag scroll is enabled.
64* `#define PLOOPY_DRAGSCROLL_FIXED` - Normally, when activating Drag Scroll, it uses a fraction of the current DPI. You can define this to use a specific, set DPI rather than a fraction of the current DPI.
65 * `#define PLOOPY_DRAGSCROLL_DPI 100` - When the fixed DPI option is enabled, this sets the DPI to be used for Drag Scroll.
66* `#define PLOOPY_DRAGSCROLL_INVERT` - This reverses the direction that the scroll is performed.