summaryrefslogtreecommitdiff
path: root/keyboards/bastardkb/charybdis
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/bastardkb/charybdis')
-rw-r--r--keyboards/bastardkb/charybdis/3x5/config.h4
-rw-r--r--keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h6
-rw-r--r--keyboards/bastardkb/charybdis/4x6/config.h4
-rw-r--r--keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h8
-rw-r--r--keyboards/bastardkb/charybdis/charybdis.c51
-rw-r--r--keyboards/bastardkb/charybdis/post_config.h5
-rw-r--r--keyboards/bastardkb/charybdis/readme.md20
7 files changed, 82 insertions, 16 deletions
diff --git a/keyboards/bastardkb/charybdis/3x5/config.h b/keyboards/bastardkb/charybdis/3x5/config.h
index 89b896bc35..b12603fade 100644
--- a/keyboards/bastardkb/charybdis/3x5/config.h
+++ b/keyboards/bastardkb/charybdis/3x5/config.h
@@ -58,8 +58,8 @@
/* Set 0 if debouncing isn't needed. */
#define DEBOUNCE 5
-/* PMW3360 settings. */
-#define PMW3360_CS_PIN B0
+/* PMW33XX settings. */
+#define PMW33XX_CS_PIN B0
// Trackball angle adjustment.
#define ROTATIONAL_TRANSFORM_ANGLE -25
diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h
index 0f08aee9ef..39204a3667 100644
--- a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h
+++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h
@@ -98,10 +98,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define EXTERNAL_EEPROM_ADDRESS_SIZE 2
/* pmw3360 config */
-#undef PMW3360_CS_PIN
-#define PMW3360_CS_PIN B0
-#define PMW3360_SPI_MODE 3
-#define PMW3360_SPI_DIVISOR 64
+#undef PMW33XX_CS_PIN
+#define PMW33XX_CS_PIN B0
#define CHARYBDIS_MINIMUM_DEFAULT_DPI 1200
#define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 400
diff --git a/keyboards/bastardkb/charybdis/4x6/config.h b/keyboards/bastardkb/charybdis/4x6/config.h
index 423f12fdbe..6760129ef8 100644
--- a/keyboards/bastardkb/charybdis/4x6/config.h
+++ b/keyboards/bastardkb/charybdis/4x6/config.h
@@ -60,8 +60,8 @@
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
-/* PMW3360 settings. */
-#define PMW3360_CS_PIN B0
+/* PMW33XX settings. */
+#define PMW33XX_CS_PIN B0
#define RGB_DI_PIN D3
#define RGBLED_NUM 56
diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h
index 2b6e11ec61..63e67aa6d8 100644
--- a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h
+++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h
@@ -87,11 +87,9 @@
#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4
#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64
-#undef PMW3360_CS_PIN
-#define PMW3360_CS_PIN A15 // b14
-#define PMW3360_CS_MODE 3
-#define PMW3360_CS_DIVISOR 64
-#define PMW3360_LIFTOFF_DISTANCE 0b1111
+#undef PMW33XX_CS_PIN
+#define PMW33XX_CS_PIN A15 // b14
+#define PMW33XX_LIFTOFF_DISTANCE 0b1111
#undef ROTATIONAL_TRANSFORM_ANGLE
#define ROTATIONAL_TRANSFORM_ANGLE -65
diff --git a/keyboards/bastardkb/charybdis/charybdis.c b/keyboards/bastardkb/charybdis/charybdis.c
index f94682ba41..29603042b2 100644
--- a/keyboards/bastardkb/charybdis/charybdis.c
+++ b/keyboards/bastardkb/charybdis/charybdis.c
@@ -18,6 +18,8 @@
*/
#include "charybdis.h"
+#include "transactions.h"
+#include <string.h>
#ifdef CONSOLE_ENABLE
# include "print.h"
@@ -160,10 +162,8 @@ void charybdis_set_pointer_dragscroll_enabled(bool enable) {
maybe_update_pointing_device_cpi(&g_charybdis_config);
}
-void pointing_device_init_kb(void) { maybe_update_pointing_device_cpi(&g_charybdis_config); }
-
# ifndef CONSTRAIN_HID
-# define CONSTRAIN_HID(value) ((value) < -127 ? -127 : ((value) > 127 ? 127 : (value)))
+# define CONSTRAIN_HID(value) ((value) < XY_REPORT_MIN ? XY_REPORT_MIN : ((value) > XY_REPORT_MAX ? XY_REPORT_MAX : (value)))
# endif // !CONSTRAIN_HID
/**
@@ -340,4 +340,49 @@ void matrix_init_kb(void) {
read_charybdis_config_from_eeprom(&g_charybdis_config);
matrix_init_user();
}
+
+# ifdef CHARYBDIS_CONFIG_SYNC
+void charybdis_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
+ if (initiator2target_buffer_size == sizeof(g_charybdis_config)) {
+ memcpy(&g_charybdis_config, initiator2target_buffer, sizeof(g_charybdis_config));
+ }
+}
+# endif
+
+void keyboard_post_init_kb(void) {
+ maybe_update_pointing_device_cpi(&g_charybdis_config);
+# ifdef CHARYBDIS_CONFIG_SYNC
+ transaction_register_rpc(RPC_ID_KB_CONFIG_SYNC, charybdis_config_sync_handler);
+# endif
+ keyboard_post_init_user();
+}
+
+# ifdef CHARYBDIS_CONFIG_SYNC
+void housekeeping_task_kb(void) {
+ if (is_keyboard_master()) {
+ // Keep track of the last state, so that we can tell if we need to propagate to slave
+ static charybdis_config_t last_charybdis_config = {0};
+ static uint32_t last_sync = 0;
+ bool needs_sync = false;
+
+ // Check if the state values are different
+ if (memcmp(&g_charybdis_config, &last_charybdis_config, sizeof(g_charybdis_config))) {
+ needs_sync = true;
+ memcpy(&last_charybdis_config, &g_charybdis_config, sizeof(g_charybdis_config));
+ }
+ // Send to slave every 500ms regardless of state change
+ if (timer_elapsed32(last_sync) > 500) {
+ needs_sync = true;
+ }
+
+ // Perform the sync if requested
+ if (needs_sync) {
+ if (transaction_rpc_send(RPC_ID_KB_CONFIG_SYNC, sizeof(g_charybdis_config), &g_charybdis_config)) {
+ last_sync = timer_read32();
+ }
+ }
+ }
+ // no need for user function, is called already
+}
+# endif // CHARYBDIS_CONFIG_SYNC
#endif // POINTING_DEVICE_ENABLE
diff --git a/keyboards/bastardkb/charybdis/post_config.h b/keyboards/bastardkb/charybdis/post_config.h
index 540751f6c6..b769722b64 100644
--- a/keyboards/bastardkb/charybdis/post_config.h
+++ b/keyboards/bastardkb/charybdis/post_config.h
@@ -20,6 +20,11 @@
#pragma once
+// Enable syncing of charybdis config
+#ifdef CHARYBDIS_CONFIG_SYNC
+# define SPLIT_TRANSACTION_IDS_KB RPC_ID_KB_CONFIG_SYNC
+#endif
+
/* Mouse config. */
#ifndef MOUSEKEY_MOVE_DELTA
diff --git a/keyboards/bastardkb/charybdis/readme.md b/keyboards/bastardkb/charybdis/readme.md
index 461f33117c..d786abf36e 100644
--- a/keyboards/bastardkb/charybdis/readme.md
+++ b/keyboards/bastardkb/charybdis/readme.md
@@ -176,3 +176,23 @@ To disable the custom keycodes, and reduce binary size, simply add a definition
```c
#define NO_CHARYBDIS_KEYCODES
```
+
+### Configuration Syncing
+
+If you want/need to enable syncing of the charybdis config, such as to read the sniping or drag scroll modes on the other half (such as for displaying the status via rgb matrix, or added on screens, or what not), you can enabled this. To do so, add this to your `config.h`:
+
+```c
+#define CHARYBDIS_CONFIG_SYNC
+```
+
+Note that you will need to reflash both sides when enabling this.
+
+### Enable Large Mouse Reports
+
+By default, the X and Y motion for the pointing device/mouse reports is -127 to 127. You can definitely hit the limit for that with the sensors. You can enable support for -32767 to 32767 by adding this to your `config.h`:
+
+```c
+#define MOUSE_EXTENDED_REPORT
+```
+
+Note that you will need to reflash both sides when enabling this.