mirror of
https://github.com/zsa/qmk_firmware.git
synced 2026-01-10 15:42:25 +00:00
Compare commits
4 Commits
2c6565c49b
...
91d29fe418
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91d29fe418 | ||
|
|
2ec6a09d59 | ||
|
|
88ce385794 | ||
|
|
16f203e2fb |
@@ -192,6 +192,7 @@ void navigator_trackball_device_init(void) {
|
||||
}
|
||||
|
||||
trackball_init = 1;
|
||||
restore_cpi(current_cpi);
|
||||
if (!callback_token) {
|
||||
// Register the callback to read the trackball motion
|
||||
callback_token = defer_exec(NAVIGATOR_TRACKBALL_READ, sci18is606_read_callback, NULL);
|
||||
@@ -217,20 +218,17 @@ uint16_t navigator_trackball_get_cpi(void) {
|
||||
void restore_cpi(uint8_t cpi) {
|
||||
current_cpi = cpi;
|
||||
paw3805ek_set_cpi();
|
||||
printf("restored cpi: %d\n", current_cpi);
|
||||
}
|
||||
|
||||
void navigator_trackball_set_cpi(uint16_t cpi) {
|
||||
if (cpi == 0) { // Decrease one tick
|
||||
if (current_cpi > NAVIGATOR_TRACKBALL_CPI_TICK) {
|
||||
current_cpi -= NAVIGATOR_TRACKBALL_CPI_TICK;
|
||||
printf("decreased cpi: %d\n", current_cpi);
|
||||
paw3805ek_set_cpi();
|
||||
}
|
||||
} else {
|
||||
if (current_cpi < 255 - NAVIGATOR_TRACKBALL_CPI_TICK) {
|
||||
if (current_cpi <= NAVIGATOR_TRACKBALL_CPI_MAX - NAVIGATOR_TRACKBALL_CPI_TICK) {
|
||||
current_cpi += NAVIGATOR_TRACKBALL_CPI_TICK;
|
||||
printf("increased cpi: %d\n", current_cpi);
|
||||
paw3805ek_set_cpi();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
# define NAVIGATOR_TRACKBALL_CPI_TICK 5
|
||||
#endif
|
||||
|
||||
#define NAVIGATOR_TRACKBALL_CPI_MAX 125
|
||||
|
||||
#ifndef NAVIGATOR_TRACKBALL_TIMEOUT
|
||||
# define NAVIGATOR_TRACKBALL_TIMEOUT 100
|
||||
#endif
|
||||
@@ -36,33 +38,6 @@
|
||||
#define SCI18IS606_GET_ID 0xFE
|
||||
|
||||
#define WRITE_REG_BIT 0x80
|
||||
/*
|
||||
The PAW3805EK datasheet suggests the following CPI values for the X and Y axes:
|
||||
CPI X-axis Y-axis
|
||||
800 0x1F 0x22
|
||||
1000 0x26 0x2A
|
||||
1200 0x2E 0x32
|
||||
1600 0x3C 0x43
|
||||
2000 0x4C 0x54
|
||||
2400 0x5B 0x64
|
||||
3000 0x70 0x7B
|
||||
*/
|
||||
#define CPI_TICKS 7
|
||||
#define DEFAULT_CPI_TICK 1
|
||||
#define CPI_X_800 0x1F
|
||||
#define CPI_Y_800 0x22
|
||||
#define CPI_X_1000 0x26
|
||||
#define CPI_Y_1000 0x2A
|
||||
#define CPI_X_1200 0x2E
|
||||
#define CPI_Y_1200 0x32
|
||||
#define CPI_X_1600 0x3C
|
||||
#define CPI_Y_1600 0x43
|
||||
#define CPI_X_2000 0x4C
|
||||
#define CPI_Y_2000 0x54
|
||||
#define CPI_X_2400 0x5B
|
||||
#define CPI_Y_2400 0x64
|
||||
#define CPI_X_3000 0x70
|
||||
#define CPI_Y_3000 0x7B
|
||||
|
||||
typedef struct {
|
||||
uint8_t reg;
|
||||
|
||||
@@ -304,8 +304,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
void eeconfig_init_kb(void) { // EEPROM is getting reset!
|
||||
keyboard_config.raw = 0;
|
||||
keyboard_config.led_level = 4;
|
||||
keyboard_config.navigator_cpi = 3;
|
||||
eeconfig_update_kb(keyboard_config.raw);
|
||||
eeconfig_init_user();
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ typedef union {
|
||||
struct {
|
||||
uint8_t led_level : 3;
|
||||
bool disable_layer_led : 1;
|
||||
uint8_t navigator_cpi : 3;
|
||||
bool placeholder : 1;
|
||||
};
|
||||
} keyboard_config_t;
|
||||
|
||||
@@ -470,7 +470,6 @@ void eeconfig_init_kb(void) { // EEPROM is getting reset!
|
||||
keyboard_config.rgb_matrix_enable = true;
|
||||
keyboard_config.led_level = true;
|
||||
keyboard_config.led_level_res = 0b11;
|
||||
keyboard_config.navigator_cpi = 3;
|
||||
eeconfig_update_kb(keyboard_config.raw);
|
||||
eeconfig_init_user();
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@ typedef union {
|
||||
bool rgb_matrix_enable :1;
|
||||
bool led_level :1;
|
||||
uint8_t led_level_res :2; // DO NOT REMOVE
|
||||
uint8_t navigator_cpi :3;
|
||||
|
||||
};
|
||||
} keyboard_config_t;
|
||||
|
||||
|
||||
@@ -301,7 +301,6 @@ void eeconfig_init_kb(void) { // EEPROM is getting reset!
|
||||
keyboard_config.raw = 0;
|
||||
keyboard_config.led_level = true;
|
||||
keyboard_config.led_level_res = 0b11;
|
||||
keyboard_config.navigator_cpi = 3;
|
||||
eeconfig_update_kb(keyboard_config.raw);
|
||||
eeconfig_init_user();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
# include "debug.h"
|
||||
# include "action_util.h"
|
||||
# include "quantum_keycodes.h"
|
||||
#ifdef LAYER_LOCK_ENABLE
|
||||
# include "layer_lock.h"
|
||||
#endif
|
||||
|
||||
/* local data structure for tracking auto mouse */
|
||||
static auto_mouse_context_t auto_mouse_context = {
|
||||
@@ -265,6 +268,9 @@ void pointing_device_task_auto_mouse(report_mouse_t mouse_report) {
|
||||
layer_on((AUTO_MOUSE_TARGET_LAYER));
|
||||
}
|
||||
} else if (layer_state_is((AUTO_MOUSE_TARGET_LAYER)) && timer_elapsed(auto_mouse_context.timer.active) > auto_mouse_context.config.timeout) {
|
||||
#ifdef LAYER_LOCK_ENABLE
|
||||
if(is_layer_locked(AUTO_MOUSE_DEFAULT_LAYER)) return;
|
||||
#endif
|
||||
layer_off((AUTO_MOUSE_TARGET_LAYER));
|
||||
auto_mouse_context.timer.active = 0;
|
||||
auto_mouse_context.total_mouse_movement = (total_mouse_movement_t){.x = 0, .y = 0, .h = 0, .v = 0};
|
||||
@@ -299,6 +305,9 @@ void auto_mouse_keyevent(bool pressed) {
|
||||
*/
|
||||
void auto_mouse_reset_trigger(bool pressed) {
|
||||
if (pressed) {
|
||||
#ifdef LAYER_LOCK_ENABLE
|
||||
if(is_layer_locked(AUTO_MOUSE_DEFAULT_LAYER)) return;
|
||||
#endif
|
||||
if (layer_state_is((AUTO_MOUSE_TARGET_LAYER))) {
|
||||
layer_off((AUTO_MOUSE_TARGET_LAYER));
|
||||
};
|
||||
@@ -334,9 +343,10 @@ bool process_auto_mouse(uint16_t keycode, keyrecord_t* record) {
|
||||
if (!(AUTO_MOUSE_ENABLED)) return true;
|
||||
|
||||
switch (keycode) {
|
||||
// Skip Mod keys to avoid layer reset
|
||||
// Skip Mod keys and layer lock to avoid layer reset
|
||||
case KC_LEFT_CTRL ... KC_RIGHT_GUI:
|
||||
case QK_MODS ... QK_MODS_MAX:
|
||||
case QK_LLCK:
|
||||
break;
|
||||
// TO((AUTO_MOUSE_TARGET_LAYER))-------------------------------------------------------------------------------
|
||||
case QK_TO ... QK_TO_MAX:
|
||||
|
||||
Reference in New Issue
Block a user