Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions qmk_firmware/keyboards/keyball/lib/keyball/keyball.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,27 @@ report_mouse_t pointing_device_driver_get_report(report_mouse_t rep) {
return rep;
}

#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
bool auto_mouse_activation(report_mouse_t mouse_report) {
static uint16_t last_motion;
if (timer_elapsed(last_motion) > get_auto_mouse_timeout()) {
keyball.total_motion.x = 0;
keyball.total_motion.y = 0;
}
if (mouse_report.x || mouse_report.y) {
last_motion = timer_read();
}
keyball.total_motion.x += mouse_report.x;
keyball.total_motion.y += mouse_report.y;
if (abs(keyball.total_motion.x) > KEYBALL_AUTO_MOUSE_THRESHOLD || abs(keyball.total_motion.y) > KEYBALL_AUTO_MOUSE_THRESHOLD) {
keyball.total_motion.x = 0;
keyball.total_motion.y = 0;
return true;
}
return mouse_report.buttons;
}
#endif

//////////////////////////////////////////////////////////////////////////////
// Split RPC

Expand Down
6 changes: 6 additions & 0 deletions qmk_firmware/keyboards/keyball/lib/keyball/keyball.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define KEYBALL_SCROLLSNAP_TENSION_THRESHOLD 12
#endif

/// Threshold of mouse movement before layer change occurs
#ifndef KEYBALL_AUTO_MOUSE_THRESHOLD
# define KEYBALL_AUTO_MOUSE_THRESHOLD 10
#endif

/// Specify SROM ID to be uploaded PMW3360DW (optical sensor). It will be
/// enabled high CPI setting or so. Valid valus are 0x04 or 0x81. Define this
/// in your config.h to be enable. Please note that using this option will
Expand Down Expand Up @@ -158,6 +163,7 @@ typedef struct {

keyball_motion_t this_motion;
keyball_motion_t that_motion;
keyball_motion_t total_motion;

uint8_t cpi_value;
bool cpi_changed;
Expand Down