27d68ef8b9310de40532aade86978ed2a5608ce9

Author
Victor <87155454+t4corun@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

Add Ploopyco functions for host state control (#23953)

Diff

 1diff --git a/keyboards/ploopyco/ploopyco.c b/keyboards/ploopyco/ploopyco.c
 2index a6f76203d644ceb516cfe55669131fbac79a6be0..57f2a26b8c3f86779191cec3e359afaf22cfbd19 100644
 3--- a/keyboards/ploopyco/ploopyco.c
 4+++ b/keyboards/ploopyco/ploopyco.c
 5@@ -128,6 +128,16 @@ void encoder_driver_task(void) {
 6 }
 7 #endif
 8 
 9+void toggle_drag_scroll(void) {
10+    is_drag_scroll ^= 1;
11+}
12+
13+void cycle_dpi(void) {
14+    keyboard_config.dpi_config = (keyboard_config.dpi_config + 1) % DPI_OPTION_SIZE;
15+    eeconfig_update_kb(keyboard_config.raw);
16+    pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]);
17+}
18+
19 report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
20     if (is_drag_scroll) {
21         scroll_accumulated_h += (float)mouse_report.x / PLOOPY_DRAGSCROLL_DIVISOR_H;
22@@ -174,9 +184,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
23     }
24 
25     if (keycode == DPI_CONFIG && record->event.pressed) {
26-        keyboard_config.dpi_config = (keyboard_config.dpi_config + 1) % DPI_OPTION_SIZE;
27-        eeconfig_update_kb(keyboard_config.raw);
28-        pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]);
29+        cycle_dpi();
30     }
31 
32     if (keycode == DRAG_SCROLL) {
33@@ -184,7 +192,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
34         is_drag_scroll = record->event.pressed;
35 #else
36         if (record->event.pressed) {
37-            is_drag_scroll ^= 1;
38+            toggle_drag_scroll();
39         }
40 #endif
41     }
42diff --git a/keyboards/ploopyco/ploopyco.h b/keyboards/ploopyco/ploopyco.h
43index 61a8d58a933ec32a4210c13c1e32ae36cbf5d0ac..eadd04d3ae0b070da6d43c77f2f6f179672838f3 100644
44--- a/keyboards/ploopyco/ploopyco.h
45+++ b/keyboards/ploopyco/ploopyco.h
46@@ -37,3 +37,5 @@ enum ploopy_keycodes {
47 
48 bool encoder_update_user(uint8_t index, bool clockwise);
49 bool encoder_update_kb(uint8_t index, bool clockwise);
50+void toggle_drag_scroll(void);
51+void cycle_dpi(void);
52diff --git a/keyboards/ploopyco/readme.md b/keyboards/ploopyco/readme.md
53index b6eecf080e94955710a90b1f3271f7beab5b4761..a9777ca7ceaca145d5363b94f748a59db1979485 100644
54--- a/keyboards/ploopyco/readme.md
55+++ b/keyboards/ploopyco/readme.md
56@@ -10,11 +10,11 @@
57 # Customizing your PloopyCo Device
58 
59 There are a number of behavioral settings that you can use to help customize your experience
60-|                                 |                   |                                                           |
61-|---------------------------------|-------------------|-----------------------------------------------------------|
62-| `PLOOPY_IGNORE_SCROLL_CLICK`    | *__not_defined__* | Ignores scroll wheel if it is pressed down.               |
63-| `PLOOPY_SCROLL_DEBOUNCE`        | `5`               | Number of milliseconds between scroll events.             |
64-| `PLOOPY_SCROLL_BUTTON_DEBOUNCE` | `100`             | Time to ignore scroll events after pressing scroll wheel. |
65+|Define                         |Default Value|Description                                              |
66+|-------------------------------|-------------|---------------------------------------------------------|
67+|`PLOOPY_IGNORE_SCROLL_CLICK`   |*Not defined*|Ignores scroll wheel if it is pressed down.              |
68+|`PLOOPY_SCROLL_DEBOUNCE`       |`5`          |Number of milliseconds between scroll events.            |
69+|`PLOOPY_SCROLL_BUTTON_DEBOUNCE`|`100`        |Time to ignore scroll events after pressing scroll wheel.|
70 
71 ## DPI
72