summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2021-06-26 03:58:15 +0000
committerQMK Bot <hello@qmk.fm>2021-06-26 03:58:15 +0000
commite64705d2f40d209d4a52f1431c896cc3944757a1 (patch)
treec5a38d5b2f2991f48c69d2006e9d2f5cd28b6d32
parentd6592d898803f5f65cbbfe50ca3dab0685b2fd81 (diff)
parent79cc6ce2d0d860680834e9b0cadfbe42e789fa0c (diff)
Merge remote-tracking branch 'origin/master' into develop
-rw-r--r--keyboards/ploopyco/mouse/mouse.c25
-rw-r--r--keyboards/ploopyco/mouse/readme.md14
-rw-r--r--keyboards/ploopyco/trackball/readme.md14
-rw-r--r--keyboards/ploopyco/trackball/trackball.c20
-rw-r--r--keyboards/ploopyco/trackball_mini/readme.md11
-rw-r--r--keyboards/ploopyco/trackball_mini/trackball_mini.c31
-rw-r--r--keyboards/ploopyco/trackball_mini/trackball_mini.h9
-rw-r--r--keyboards/ploopyco/trackball_nano/config.h2
8 files changed, 87 insertions, 39 deletions
diff --git a/keyboards/ploopyco/mouse/mouse.c b/keyboards/ploopyco/mouse/mouse.c
index 1eb5e3ead9..0bf96a20f7 100644
--- a/keyboards/ploopyco/mouse/mouse.c
+++ b/keyboards/ploopyco/mouse/mouse.c
@@ -247,7 +247,6 @@ void pointing_device_init(void) {
opt_encoder_init();
}
-bool 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); }
void pointing_device_task(void) {
report_mouse_t mouse_report = pointing_device_get_report();
@@ -256,7 +255,12 @@ void pointing_device_task(void) {
if (is_drag_scroll) {
mouse_report.h = mouse_report.x;
+#ifdef PLOOPY_DRAGSCROLL_INVERT
+ // Invert vertical scroll direction
+ mouse_report.v = -mouse_report.y;
+#else
mouse_report.v = mouse_report.y;
+#endif
mouse_report.x = 0;
mouse_report.y = 0;
}
@@ -265,27 +269,10 @@ void pointing_device_task(void) {
pointing_device_send();
}
-void pointing_device_send(void) {
- static report_mouse_t old_report = {};
- report_mouse_t mouseReport = pointing_device_get_report();
-
- // If you need to do other things, like debugging, this is the place to do it.
- if (has_report_changed(mouseReport, old_report)) {
- host_mouse_send(&mouseReport);
- }
-
- // send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device
- mouseReport.x = 0;
- mouseReport.y = 0;
- mouseReport.v = 0;
- mouseReport.h = 0;
- pointing_device_set_report(mouseReport);
- old_report = mouseReport;
-}
-
void eeconfig_init_kb(void) {
keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT;
eeconfig_update_kb(keyboard_config.raw);
+ eeconfig_init_user();
}
void matrix_init_kb(void) {
diff --git a/keyboards/ploopyco/mouse/readme.md b/keyboards/ploopyco/mouse/readme.md
index ff37a6b807..e9ad915a66 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
The `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.
The `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.
+
+## Drag Scroll
+
+Drag 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.
+
+Nothing needs to be enabled to use this functionality. Just add the `DRAG_SCROLL` to your keymap.
+
+### Drag Scroll Configuration
+
+* `#define PLOOPY_DRAGSCROLL_MOMENTARY` - Makes the key into a momentary key, rather than a toggle.
+* `#define PLOOPY_DRAGSCROLL_MULTIPLIER 0.75` - Sets the DPI multiplier to use when drag scroll is enabled.
+* `#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.
+ * `#define PLOOPY_DRAGSCROLL_DPI 100` - When the fixed DPI option is enabled, this sets the DPI to be used for Drag Scroll.
+* `#define PLOOPY_DRAGSCROLL_INVERT` - This reverses the direction that the scroll is performed.
diff --git a/keyboards/ploopyco/trackball/readme.md b/keyboards/ploopyco/trackball/readme.md
index 7792c0cc59..cb5eaa53d2 100644
--- a/keyboards/ploopyco/trackball/readme.md
+++ b/keyboards/ploopyco/trackball/readme.md
@@ -58,3 +58,17 @@ To configure/set your own array, there are two defines to use, `PLOOPY_DPI_OPTIO
The `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.
The `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.
+
+## Drag Scroll
+
+Drag 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.
+
+Nothing needs to be enabled to use this functionality. Just add the `DRAG_SCROLL` to your keymap.
+
+### Drag Scroll Configuration
+
+* `#define PLOOPY_DRAGSCROLL_MOMENTARY` - Makes the key into a momentary key, rather than a toggle.
+* `#define PLOOPY_DRAGSCROLL_MULTIPLIER 0.75` - Sets the DPI multiplier to use when drag scroll is enabled.
+* `#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.
+ * `#define PLOOPY_DRAGSCROLL_DPI 100` - When the fixed DPI option is enabled, this sets the DPI to be used for Drag Scroll.
+* `#define PLOOPY_DRAGSCROLL_INVERT` - This reverses the direction that the scroll is performed.
diff --git a/keyboards/ploopyco/trackball/trackball.c b/keyboards/ploopyco/trackball/trackball.c
index b9c29b54ee..7190209979 100644
--- a/keyboards/ploopyco/trackball/trackball.c
+++ b/keyboards/ploopyco/trackball/trackball.c
@@ -246,7 +246,6 @@ void pointing_device_init(void) {
opt_encoder_init();
}
-bool 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); }
void pointing_device_task(void) {
report_mouse_t mouse_report = pointing_device_get_report();
@@ -269,27 +268,10 @@ void pointing_device_task(void) {
pointing_device_send();
}
-void pointing_device_send(void) {
- static report_mouse_t old_report = {};
- report_mouse_t mouseReport = pointing_device_get_report();
-
- // If you need to do other things, like debugging, this is the place to do it.
- if (has_report_changed(mouseReport, old_report)) {
- host_mouse_send(&mouseReport);
- }
-
- // send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device
- mouseReport.x = 0;
- mouseReport.y = 0;
- mouseReport.v = 0;
- mouseReport.h = 0;
- pointing_device_set_report(mouseReport);
- old_report = mouseReport;
-}
-
void eeconfig_init_kb(void) {
keyboard_config.dpi_config = PLOOPY_DPI_DEFAULT;
eeconfig_update_kb(keyboard_config.raw);
+ eeconfig_init_user();
}
void matrix_init_kb(void) {
diff --git a/keyboards/ploopyco/trackball_mini/readme.md b/keyboards/ploopyco/trackball_mini/readme.md
index 1858efb6e2..3c21a57cfd 100644
--- a/keyboards/ploopyco/trackball_mini/readme.md
+++ b/keyboards/ploopyco/trackball_mini/readme.md
@@ -64,6 +64,17 @@ The `PLOOPY_DPI_OPTIONS` array sets the values that you want to be able to cycle
The `DPI_CONFIG` macro will cycle through the values in the array, each time you hit it. It stores this value in persistent memory, so it will load it the next time the device powers up.
+## Drag Scroll
+
+Drag 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.
+
+Nothing needs to be enabled to use this functionality. Just add the `DRAG_SCROLL` to your keymap.
+
+### Drag Scroll Configuration
+
+* `#define PLOOPY_DRAGSCROLL_MOMENTARY` - Makes the key into a momentary key, rather than a toggle.
+* `#define PLOOPY_DRAGSCROLL_DPI CPI375` - When the fixed DPI option is enabled, this sets the DPI to be used for Drag Scroll.
+* `#define PLOOPY_DRAGSCROLL_INVERT` - This reverses the direction that the scroll is performed.
## Fuse settings
When flashing the bootloader, use the following fuse settings:
diff --git a/keyboards/ploopyco/trackball_mini/trackball_mini.c b/keyboards/ploopyco/trackball_mini/trackball_mini.c
index 996c00b22a..b50850b549 100644
--- a/keyboards/ploopyco/trackball_mini/trackball_mini.c
+++ b/keyboards/ploopyco/trackball_mini/trackball_mini.c
@@ -40,6 +40,13 @@
#define PLOOPY_DPI_OPTIONS { CPI375, CPI750, CPI1375 }
#define PLOOPY_DPI_DEFAULT 2
+#ifndef PLOOPY_DRAGSCROLL_DPI
+# define PLOOPY_DRAGSCROLL_DPI CPI375 // Fixed-DPI Drag Scroll
+#endif
+#ifndef PLOOPY_DRAGSCROLL_MULTIPLIER
+# define PLOOPY_DRAGSCROLL_MULTIPLIER 0.75 // Variable-DPI Drag Scroll
+#endif
+
// Transformation constants for delta-X and delta-Y
const static float ADNS_X_TRANSFORM = -1.0;
const static float ADNS_Y_TRANSFORM = 1.0;
@@ -61,6 +68,7 @@ uint16_t lastScroll = 0; // Previous confirmed wheel event
uint16_t lastMidClick = 0; // Stops scrollwheel from being read if it was pressed
uint8_t OptLowPin = OPT_ENC1;
bool debug_encoder = false;
+bool is_drag_scroll = false;
__attribute__((weak)) void process_wheel_user(report_mouse_t* mouse_report, int16_t h, int16_t v) {
mouse_report->h = h;
@@ -142,6 +150,16 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
adns_set_cpi(dpi_array[keyboard_config.dpi_config]);
}
+ if (keycode == DRAG_SCROLL) {
+#ifndef PLOOPY_DRAGSCROLL_MOMENTARY
+ if (record->event.pressed)
+#endif
+ {
+ is_drag_scroll ^= 1;
+ }
+ adns_set_cpi(is_drag_scroll ? PLOOPY_DRAGSCROLL_DPI : dpi_array[keyboard_config.dpi_config]);
+ }
+
/* If Mousekeys is disabled, then use handle the mouse button
* keycodes. This makes things simpler, and allows usage of
* the keycodes in a consistent manner. But only do this if
@@ -214,6 +232,19 @@ void pointing_device_task(void) {
report_mouse_t mouse_report = pointing_device_get_report();
process_wheel(&mouse_report);
process_mouse(&mouse_report);
+
+ if (is_drag_scroll) {
+ mouse_report.h = mouse_report.x;
+#ifdef PLOOPY_DRAGSCROLL_INVERT
+ // Invert vertical scroll direction
+ mouse_report.v = -mouse_report.y;
+#else
+ mouse_report.v = mouse_report.y;
+#endif
+ mouse_report.x = 0;
+ mouse_report.y = 0;
+ }
+
pointing_device_set_report(mouse_report);
pointing_device_send();
}
diff --git a/keyboards/ploopyco/trackball_mini/trackball_mini.h b/keyboards/ploopyco/trackball_mini/trackball_mini.h
index da1b51b17e..7bcb02a940 100644
--- a/keyboards/ploopyco/trackball_mini/trackball_mini.h
+++ b/keyboards/ploopyco/trackball_mini/trackball_mini.h
@@ -49,6 +49,15 @@ typedef union {
extern keyboard_config_t keyboard_config;
enum ploopy_keycodes {
+#ifdef VIA_ENABLE
+ DPI_CONFIG = USER00,
+#else
DPI_CONFIG = SAFE_RANGE,
+#endif
+ DRAG_SCROLL,
+#ifdef VIA_ENABLE
+ PLOOPY_SAFE_RANGE = SAFE_RANGE,
+#else
PLOOPY_SAFE_RANGE,
+#endif
};
diff --git a/keyboards/ploopyco/trackball_nano/config.h b/keyboards/ploopyco/trackball_nano/config.h
index 6771506b20..7450f5574c 100644
--- a/keyboards/ploopyco/trackball_nano/config.h
+++ b/keyboards/ploopyco/trackball_nano/config.h
@@ -23,7 +23,7 @@
/* USB Device descriptor parameter */
#define VENDOR_ID 0x5043
-#define PRODUCT_ID 0x1EAB
+#define PRODUCT_ID 0x54A3
#define DEVICE_VER 0x0001
#define PRODUCT Trackball Nano