diff options
| author | Victor | 2024-10-11 05:27:15 +0200 |
|---|---|---|
| committer | GitHub | 2024-10-11 05:27:15 +0200 |
| commit | 27d68ef8b9310de40532aade86978ed2a5608ce9 (patch) | |
| tree | 03ad9ec2ed7178cfe52f7d7280b38a6707338991 /keyboards/ploopyco/ploopyco.c | |
| parent | c8a87ff3fe8bccd33405e07cd5e52197dd20df36 (diff) | |
Add Ploopyco functions for host state control (#23953)
Diffstat (limited to 'keyboards/ploopyco/ploopyco.c')
| -rw-r--r-- | keyboards/ploopyco/ploopyco.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/keyboards/ploopyco/ploopyco.c b/keyboards/ploopyco/ploopyco.c index a6f76203d6..57f2a26b8c 100644 --- a/keyboards/ploopyco/ploopyco.c +++ b/keyboards/ploopyco/ploopyco.c @@ -128,6 +128,16 @@ void encoder_driver_task(void) { } #endif +void toggle_drag_scroll(void) { + is_drag_scroll ^= 1; +} + +void cycle_dpi(void) { + keyboard_config.dpi_config = (keyboard_config.dpi_config + 1) % DPI_OPTION_SIZE; + eeconfig_update_kb(keyboard_config.raw); + pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]); +} + report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { if (is_drag_scroll) { scroll_accumulated_h += (float)mouse_report.x / PLOOPY_DRAGSCROLL_DIVISOR_H; @@ -174,9 +184,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { } if (keycode == DPI_CONFIG && record->event.pressed) { - keyboard_config.dpi_config = (keyboard_config.dpi_config + 1) % DPI_OPTION_SIZE; - eeconfig_update_kb(keyboard_config.raw); - pointing_device_set_cpi(dpi_array[keyboard_config.dpi_config]); + cycle_dpi(); } if (keycode == DRAG_SCROLL) { @@ -184,7 +192,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { is_drag_scroll = record->event.pressed; #else if (record->event.pressed) { - is_drag_scroll ^= 1; + toggle_drag_scroll(); } #endif } |