mirror of
https://github.com/zsa/qmk_firmware.git
synced 2026-01-11 08:02:57 +00:00
Compare commits
23 Commits
88ce385794
...
624cce85d0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
624cce85d0 | ||
|
|
91d29fe418 | ||
|
|
2ec6a09d59 | ||
|
|
2c6565c49b | ||
|
|
73a60adccb | ||
|
|
63df8aaf50 | ||
|
|
4ed023b399 | ||
|
|
3e055c27ba | ||
|
|
8ff6738dce | ||
|
|
9601e77500 | ||
|
|
3635d313ed | ||
|
|
0893f2ebf9 | ||
|
|
74c38ae1c1 | ||
|
|
96c5b8e2d9 | ||
|
|
b7d0132457 | ||
|
|
574b2798a4 | ||
|
|
f11ebc3a71 | ||
|
|
39c17221b4 | ||
|
|
996cf81b59 | ||
|
|
9c0d3c5eb5 | ||
|
|
d9f419845d | ||
|
|
dbe50d2a66 | ||
|
|
f2f1de4d97 |
@@ -19,7 +19,7 @@ const pointing_device_driver_t navigator_trackball_pointing_device_driver = {
|
||||
.set_cpi = navigator_trackball_set_cpi
|
||||
};
|
||||
|
||||
uint8_t current_cpi = DEFAULT_CPI_TICK;
|
||||
uint8_t current_cpi = NAVIGATOR_TRACKBALL_CPI;
|
||||
|
||||
uint8_t has_motion = 0;
|
||||
|
||||
@@ -77,58 +77,11 @@ i2c_status_t sci18is606_configure(void) {
|
||||
}
|
||||
|
||||
bool paw3805ek_set_cpi(void) {
|
||||
uint8_t next_cpi_x = 0;
|
||||
uint8_t next_cpi_y = 0;
|
||||
// traverse the sequence by compairing the cpi_x value with the current cpi_x value
|
||||
// set the cpi to the next value in the sequence
|
||||
switch (current_cpi) {
|
||||
case 1: {
|
||||
next_cpi_x = CPI_X_800;
|
||||
next_cpi_y = CPI_Y_800;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
next_cpi_x = CPI_X_1000;
|
||||
next_cpi_y = CPI_Y_1000;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
next_cpi_x = CPI_X_1200;
|
||||
next_cpi_y = CPI_Y_1200;
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
next_cpi_x = CPI_X_1600;
|
||||
next_cpi_y = CPI_Y_1600;
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
next_cpi_x = CPI_X_2000;
|
||||
next_cpi_y = CPI_Y_2000;
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
next_cpi_x = CPI_X_2400;
|
||||
next_cpi_y = CPI_Y_2400;
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
next_cpi_x = CPI_X_3000;
|
||||
next_cpi_y = CPI_Y_3000;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
current_cpi = DEFAULT_CPI_TICK;
|
||||
next_cpi_x = CPI_X_800;
|
||||
next_cpi_y = CPI_Y_800;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
paw3805ek_reg_seq_t cpi_reg_seq[] = {
|
||||
{0x09 | WRITE_REG_BIT, 0x5A}, // Disable write protection
|
||||
{0x0D | WRITE_REG_BIT, next_cpi_x},
|
||||
{0x0E | WRITE_REG_BIT, next_cpi_y},
|
||||
{0x0D | WRITE_REG_BIT, current_cpi},
|
||||
{0x0E | WRITE_REG_BIT, current_cpi},
|
||||
{0x09 | WRITE_REG_BIT, 0x00}, // Enable the write protection
|
||||
};
|
||||
|
||||
@@ -239,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);
|
||||
@@ -268,13 +222,13 @@ void restore_cpi(uint8_t cpi) {
|
||||
|
||||
void navigator_trackball_set_cpi(uint16_t cpi) {
|
||||
if (cpi == 0) { // Decrease one tick
|
||||
if (current_cpi > 1) {
|
||||
current_cpi--;
|
||||
if (current_cpi > NAVIGATOR_TRACKBALL_CPI_TICK) {
|
||||
current_cpi -= NAVIGATOR_TRACKBALL_CPI_TICK;
|
||||
paw3805ek_set_cpi();
|
||||
}
|
||||
} else {
|
||||
if (current_cpi < CPI_TICKS) {
|
||||
current_cpi++;
|
||||
if (current_cpi <= NAVIGATOR_TRACKBALL_CPI_MAX - NAVIGATOR_TRACKBALL_CPI_TICK) {
|
||||
current_cpi += NAVIGATOR_TRACKBALL_CPI_TICK;
|
||||
paw3805ek_set_cpi();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,16 @@
|
||||
# define NAVIGATOR_TRACKBALL_ADDRESS 0x50
|
||||
#endif
|
||||
|
||||
#ifndef NAVIGATOR_TRACKBALL_CPI
|
||||
# define NAVIGATOR_TRACKBALL_CPI 40
|
||||
#endif
|
||||
|
||||
#ifndef NAVIGATOR_TRACKBALL_CPI_TICK
|
||||
# define NAVIGATOR_TRACKBALL_CPI_TICK 5
|
||||
#endif
|
||||
|
||||
#define NAVIGATOR_TRACKBALL_CPI_MAX 125
|
||||
|
||||
#ifndef NAVIGATOR_TRACKBALL_TIMEOUT
|
||||
# define NAVIGATOR_TRACKBALL_TIMEOUT 100
|
||||
#endif
|
||||
@@ -28,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;
|
||||
|
||||
@@ -22,6 +22,7 @@ typedef union {
|
||||
bool disable_layer_led : 1;
|
||||
bool led_level : 1;
|
||||
uint8_t led_level_res : 2; // DO NOT REMOVE
|
||||
uint8_t navigator_cpi : 3;
|
||||
};
|
||||
} keyboard_config_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user