aboutsummaryrefslogtreecommitdiff
path: root/users/drashna
diff options
context:
space:
mode:
authorJames Young <18669334+noroadsleft@users.noreply.github.com>2021-05-29 14:38:50 -0700
committerGitHub <noreply@github.com>2021-05-29 14:38:50 -0700
commit1646c0f26cfa21a7023d404008e4d0aa4917193d (patch)
tree337ab0498a929285a234518fee34a4d9dcf51656 /users/drashna
parentf55e39e8a2246f6f96fd5d4a84a866e2615cde7b (diff)
downloadqmk_firmware-1646c0f26cfa21a7023d404008e4d0aa4917193d.tar.gz
qmk_firmware-1646c0f26cfa21a7023d404008e4d0aa4917193d.zip
2021 May 29 Breaking Changes Update (#13034)
* Add Per Key functionality for AutoShift (#11536) * LED Matrix: Reactive effect buffers & advanced indicators (#12588) * [Keyboard] kint36: switch to sym_eager_pk debouncing (#12626) * [Keyboard] kint2pp: reduce input latency by ≈10ms (#12625) * LED Matrix: Split (#12633) * [CI] Format code according to conventions (#12650) * feat: infinite timeout for leader key (#6580) * feat: implement leader_no_timeout logic * docs(leader_key): infinite leader timeout docs * Format code according to conventions (#12680) * Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403) * Fix default ADC_RESOLUTION for ADCv3 (and ADCv4) Recent ChibiOS update removed ADC_CFGR1_RES_10BIT from the ADCv3 headers (that macro should not have been there, because ADCv3 has CFGR instead of CFGR1). Fix the default value for ADC_RESOLUTION to use ADC_CFGR_RES_10BITS if it is defined (that name is used for ADCv3 and ADCv4). * Update ADC docs to match the actually used resolution ADC driver for ChibiOS actually uses the 10-bit resolution by default (probably to match AVR); fix the documentation accordingly. Also add both ADC_CFGR_RES_10BITS and ADC_CFGR1_RES_10BIT constants (these names differ according to the ADC implementation in the particular MCU). * Fix pinToMux() for B12 and B13 on STM32F3xx Testing on STM32F303CCT6 revealed that the ADC mux values for B12 and B13 pins were wrong. * Add support for all possible analog pins on STM32F1xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 on STM32F1xx (they are the same at least for STM32F103x8 and larger F103 devices, and also F102, F105, F107 families). Actually tested on STM32F103C8T6 (therefore pins C0...C5 were not tested). Pins F6...F10, which are present on STM32F103x[C-G] in 144-pin packages, cannot be supported at the moment, because those pins are connected only to ADC3, but the ChibiOS ADC driver for STM32F1xx supports only ADC1. * Add support for all possible analog pins on STM32F4xx Added ADC mux values for pins A0...A7, B0, B1, C0...C5 and optionally F3...F10 (if STM32_ADC_USE_ADC3 is enabled). These mux values are apparently the same for all F4xx devices, except some smaller devices may not have ADC3. Actually tested on STM32F401CCU6, STM32F401CEU6, STM32F411CEU6 (using various WeAct “Blackpill” boards); only pins A0...A7, B0, B1 were tested. Pins F3...F10 are inside `#if STM32_ADC_USE_ADC3` because some devices which don't have ADC3 also don't have the GPIOF port, therefore the code which refers to Fx pins does not compile. * Fix STM32F3xx ADC mux table in documentation The ADC driver documentation had some errors in the mux table for STM32F3xx. Fix this table to match the datasheet and the actual code (mux settings for B12 and B13 were also tested on a real STM32F303CCT6 chip). * Add STM32F1xx ADC pins to the documentation * Add STM32F4xx ADC pins to the documentation * Add initial support for tinyuf2 bootloader (when hosted on F411 blackpill) (#12600) * Add support for jumping to tinyuf2 bootloader. Adds blackpill UF2 example. * Update flashing.md * Update chconf.h * Update config.h * Update halconf.h * Update mcuconf.h * eeprom driver: Refactor where eeprom driver initialisation (and EEPROM emulation initialisation) occurs to make it non-target-specific. (#12671) * Add support for MCU = STM32F446 (#12619) * Add support for MCU = STM32F446 * Update platforms/chibios/GENERIC_STM32_F446XE/configs/config.h * Restore mcuconf.h to the one used by RT-STM32F446RE-NUCLEO64 * stm32f446: update mcuconf.h and board.h for 16MHz operation, with USB enabled, and other peripherals disabled. * Format code according to conventions (#12682) * Format code according to conventions (#12687) * Add STM32L433 and L443 support (#12063) * initial L433 commit * change to XC * fix L433 * disable all peripherals * update system and peripheral clocks * 433 change * use its own board files * revert its own board files * l433 specific change * fix stm32l432xx define * remove duplicate #define * fix bootloader jump * move to L443xx and add i2c2, spi2, usart3 to mcuconf.h * move to L443 * move to L443 * fix sdmmc in mcuconf.h * include STM32L443 * add L443 * Include L443 in compatible microcontrollers * Include L443 in compatible microcontrollers * Update config bootloader jump description * Update ChibiOS define reasoning * Update quantum/mcu_selection.mk * fix git conflict * Updated Function96 with V2 files and removed chconf.h and halconf.h (#12613) * Fix bad PR merge for #6580. (#12721) * Change RGB/LED Matrix to use a simple define for USB suspend (#12697) * [CI] Format code according to conventions (#12731) * Fixing transport's led/rgb matrix suspend state logic (#12770) * [CI] Format code according to conventions (#12772) * Fix comment parsing (#12750) * Added OLED fade out support (#12086) * fix some references to bin/qmk that slipped in (#12832) * Resolve a number of warnings in `qmk generate-api` (#12833) * New command: qmk console (#12828) * stash poc * stash * tidy up implementation * Tidy up slightly for review * Tidy up slightly for review * Bodge environment to make tests pass * Refactor away from asyncio due to windows issues * Filter devices * align vid/pid printing * Add hidapi to the installers * start preparing for multiple hid_listeners * udev rules for hid_listen * refactor to move closer to end state * very basic implementation of the threaded model * refactor how vid/pid/index are supplied and parsed * windows improvements * read the report directly when usage page isn't available * add per-device colors, the choice to show names or numbers, and refactor * add timestamps * Add support for showing bootloaders * tweak the color for bootloaders * Align bootloader disconnect with connect color * add support for showing all bootloaders * fix the pyusb check * tweaks * fix exception * hide a stack trace behind -v * add --no-bootloaders option * add documentation for qmk console * Apply suggestions from code review * pyformat * clean up and flesh out KNOWN_BOOTLOADERS * Remove pointless SERIAL_LINK_ENABLE rules (#12846) * Make Swap Hands use PROGMEM (#12284) This converts the array that the Swap Hands feature uses to use PROGMEM, and to read from that array, as such. Since this array never changes at runtime, there is no reason to keep it in memory. Especially for AVR boards, as memory is a precious resource. * Fix another bin/qmk reference (#12856) * [Keymap] Turn OLED off on suspend in soundmonster keymap (#10419) * Fixup build errors on `develop` branch. (#12723) * LED Matrix: Effects! (#12651) * Fix syntax error when compiling for ARM (#12866) * Remove KEYMAP and LAYOUT_kc (#12160) * alias KEYMAP to LAYOUT * remove KEYMAP and LAYOUT_kc * Add setup, clone, and env to the list of commands we allow even with broken modules (#12868) * Rename `point_t` -> `led_point_t` (#12864) * [Keyboard] updated a vendor name / fixed minor keymap issues (#12881) * Add missing LED Matrix suspend code to suspend.c (#12878) * LED Matrix: Documentation (#12685) * Deprecate `send_unicode_hex_string()` (#12602) * Fix spelling mistake regarding LED Matrix in split_common. (#12888) * [Keymap] Fix QWERTY/DVORAK status output for kzar keymap (#12895) * Use milc.subcommand.config instead of qmk.cli.config (#12915) * Use milc.subcommand.config instead * pyformat * remove the config test * Add function to allow repeated blinking of one layer (#12237) * Implement function rgblight_blink_layer_repeat to allow repeated blinking of one layer at a time * Update doc * Rework rgblight blinking according to requested change * optimize storage * Fixup housekeeping from being invoked twice per loop. (#12933) * matrix: wait for row signal to go HIGH for every row (#12945) I noticed this discrepancy (last row of the matrix treated differently than the others) when optimizing the input latency of my keyboard controller, see also https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/ Before this commit, when tuning the delays I noticed ghost key presses when pressing the F2 key, which is on the last row of the keyboard matrix: the dead_grave key, which is on the first row of the keyboard matrix, would be incorrectly detected as pressed. After this commit, all keyboard matrix rows are interpreted correctly. I suspect that my setup is more susceptible to this nuance than others because I use GPIO_INPUT_PIN_DELAY=0 and hence don’t have another delay that might mask the problem. * ensure we do not conflict with existing keymap aliases (#12976) * Add support for up to 4 IS31FL3733 drivers (#12342) * Convert Encoder callbacks to be boolean functions (#12805) * [Keyboard] Fix Terrazzo build failure (#12977) * Do not hard set config in CPTC files (#11864) * [Keyboard] Corne - Remove legacy revision support (#12226) * [Keymap] Update to Drashna keymap and user code (based on develop) (#12936) * Add Full-duplex serial driver for ARM boards (#9842) * Document LED_MATRIX_FRAMEBUFFER_EFFECTS (#12987) * Backlight: add defines for default level and breathing state (#12560) * Add dire message about LUFA mass storage bootloader (#13014) * [Keyboard] Remove redundant legacy and common headers for crkbd (#13023) Was causing compiler errors on some systems. * Fix keyboards/keymaps for boolean encoder callback changes (#12985) * `backlight.c`: include `eeprom.h` (#13024) * Add changelog for 2021-05-29 Breaking Changes merge (#12939) * Add ChangeLog for 2021-05-29 Breaking Changes Merge: initial version * Add recent develop changes * Sort recent develop changes * Remove sections for ChibiOS changes per tzarc No ChibiOS changes this round. * Add and sort recent develop changes * add notes about keyboard moves/deletions * import changelog for PR 12172 Documents the change to BOOTMAGIC_ENABLE. * update section headings * re-sort changelog * add additional note regarding Bootmagic changes * remove changelog timestamp * update dates in main Breaking Changes docs * fix broken section anchors in previous changelogs * add link to backlight/eeprom patch to changelog * highlight some more changes * link PRs from section headers * Restore standard readme * run: qmk cformat --core-only
Diffstat (limited to 'users/drashna')
-rw-r--r--users/drashna/config.h11
-rw-r--r--users/drashna/drashna.c3
-rw-r--r--users/drashna/drashna.h1
-rw-r--r--users/drashna/drashna_transport.c199
-rw-r--r--users/drashna/oled_stuff.c55
-rw-r--r--users/drashna/oled_stuff.h4
-rw-r--r--users/drashna/pimoroni_trackball.c4
-rw-r--r--users/drashna/process_records.h2
-rw-r--r--users/drashna/rgb_matrix_stuff.c4
-rw-r--r--users/drashna/rgb_stuff.c37
-rw-r--r--users/drashna/rules.mk77
11 files changed, 277 insertions, 120 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h
index 8081af9cc..5f7c32ff3 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -24,7 +24,7 @@
24 24
25#if defined(SPLIT_KEYBOARD) 25#if defined(SPLIT_KEYBOARD)
26# define SPLIT_MODS_ENABLE 26# define SPLIT_MODS_ENABLE
27// # define SPLIT_TRANSPORT_MIRROR 27# define SPLIT_TRANSPORT_MIRROR
28# define SERIAL_USE_MULTI_TRANSACTION 28# define SERIAL_USE_MULTI_TRANSACTION
29// # define SPLIT_NUM_TRANSACTIONS_KB 2 29// # define SPLIT_NUM_TRANSACTIONS_KB 2
30#endif 30#endif
@@ -56,6 +56,8 @@
56# else 56# else
57# define RGBLIGHT_ANIMATIONS 57# define RGBLIGHT_ANIMATIONS
58# endif 58# endif
59# define RGBLIGHT_EFFECT_TWINKLE_LIFE 250
60# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1/24
59#endif // RGBLIGHT_ENABLE 61#endif // RGBLIGHT_ENABLE
60 62
61#ifdef RGB_MATRIX_ENABLE 63#ifdef RGB_MATRIX_ENABLE
@@ -115,6 +117,9 @@
115# define OLED_UPDATE_INTERVAL 15 117# define OLED_UPDATE_INTERVAL 15
116# endif 118# endif
117# define OLED_DISABLE_TIMEOUT 119# define OLED_DISABLE_TIMEOUT
120# ifdef OLED_FONT_H
121# undef OLED_FONT_H
122# endif
118# define OLED_FONT_H "drashna_font.h" 123# define OLED_FONT_H "drashna_font.h"
119# define OLED_FONT_END 255 124# define OLED_FONT_END 255
120// # define OLED_FONT_5X5 125// # define OLED_FONT_5X5
@@ -149,7 +154,9 @@
149#undef PERMISSIVE_HOLD 154#undef PERMISSIVE_HOLD
150//#define TAPPING_FORCE_HOLD 155//#define TAPPING_FORCE_HOLD
151//#define RETRO_TAPPING 156//#define RETRO_TAPPING
152#define TAPPING_TERM_PER_KEY 157#ifndef KEYBOARD_kyria_rev1
158# define TAPPING_TERM_PER_KEY
159#endif
153 160
154#define FORCE_NKRO 161#define FORCE_NKRO
155 162
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 6a13f0d9b..a49373726 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -164,6 +164,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
164 return state; 164 return state;
165 } 165 }
166 166
167 state = layer_state_set_keymap(state);
167 state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); 168 state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
168#if defined(RGBLIGHT_ENABLE) 169#if defined(RGBLIGHT_ENABLE)
169 state = layer_state_set_rgb_light(state); 170 state = layer_state_set_rgb_light(state);
@@ -179,7 +180,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
179 } 180 }
180 } 181 }
181#endif 182#endif
182 return layer_state_set_keymap(state); 183 return state;
183} 184}
184 185
185__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; } 186__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index 9a18a8296..e66f10657 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -47,7 +47,6 @@ enum userspace_layers {
47 _MALTRON, 47 _MALTRON,
48 _EUCALYN, 48 _EUCALYN,
49 _CARPLAX, 49 _CARPLAX,
50 _MODS, /* layer 8 */
51 _GAMEPAD, 50 _GAMEPAD,
52 _DIABLO, 51 _DIABLO,
53 _MACROS, 52 _MACROS,
diff --git a/users/drashna/drashna_transport.c b/users/drashna/drashna_transport.c
index f0908b490..9df11c9bd 100644
--- a/users/drashna/drashna_transport.c
+++ b/users/drashna/drashna_transport.c
@@ -21,6 +21,7 @@
21#include QMK_KEYBOARD_H 21#include QMK_KEYBOARD_H
22 22
23#define ROWS_PER_HAND (MATRIX_ROWS / 2) 23#define ROWS_PER_HAND (MATRIX_ROWS / 2)
24#define SYNC_TIMER_OFFSET 2
24 25
25#ifdef RGBLIGHT_ENABLE 26#ifdef RGBLIGHT_ENABLE
26# include "rgblight.h" 27# include "rgblight.h"
@@ -37,19 +38,33 @@ static pin_t encoders_pad[] = ENCODERS_PAD_A;
37#endif 38#endif
38 39
39#ifdef POINTING_DEVICE_ENABLE 40#ifdef POINTING_DEVICE_ENABLE
40static int8_t split_mouse_x = 0, split_mouse_y = 0; 41static uint16_t device_cpi = 0;
42static int8_t split_mouse_x = 0, split_mouse_y = 0;
41#endif 43#endif
42 44
43#ifdef OLED_DRIVER_ENABLE 45#ifdef OLED_DRIVER_ENABLE
44# include "oled_driver.h" 46# include "oled_driver.h"
45#endif 47#endif
46 48
49#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
50# include "led_matrix.h"
51#endif
52#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
53# include "rgb_matrix.h"
54#endif
55
47#if defined(USE_I2C) 56#if defined(USE_I2C)
48 57
49# include "i2c_master.h" 58# include "i2c_master.h"
50# include "i2c_slave.h" 59# include "i2c_slave.h"
51 60
52typedef struct _I2C_slave_buffer_t { 61typedef struct _I2C_slave_buffer_t {
62# ifndef DISABLE_SYNC_TIMER
63 uint32_t sync_timer;
64# endif
65# ifdef SPLIT_TRANSPORT_MIRROR
66 matrix_row_t mmatrix[ROWS_PER_HAND];
67# endif
53 matrix_row_t smatrix[ROWS_PER_HAND]; 68 matrix_row_t smatrix[ROWS_PER_HAND];
54# ifdef SPLIT_MODS_ENABLE 69# ifdef SPLIT_MODS_ENABLE
55 uint8_t real_mods; 70 uint8_t real_mods;
@@ -70,19 +85,29 @@ typedef struct _I2C_slave_buffer_t {
70# ifdef WPM_ENABLE 85# ifdef WPM_ENABLE
71 uint8_t current_wpm; 86 uint8_t current_wpm;
72# endif 87# endif
88# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
89 led_eeconfig_t led_matrix;
90 bool led_suspend_state;
91# endif
92# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
93 rgb_config_t rgb_matrix;
94 bool rgb_suspend_state;
95# endif
73 int8_t mouse_x; 96 int8_t mouse_x;
74 int8_t mouse_y; 97 int8_t mouse_y;
98 uint16_t device_cpi;
75 bool oled_on; 99 bool oled_on;
76 layer_state_t t_layer_state; 100 layer_state_t t_layer_state;
77 layer_state_t t_default_layer_state; 101 layer_state_t t_default_layer_state;
78 bool is_rgb_matrix_suspended;
79} __attribute__((packed)) I2C_slave_buffer_t; 102} __attribute__((packed)) I2C_slave_buffer_t;
80 103
81static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; 104static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg;
82 105
83# define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level) 106# define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level)
84# define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) 107# define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync)
85# define I2C_KEYMAP_START offsetof(I2C_slave_buffer_t, smatrix) 108# define I2C_KEYMAP_MASTER_START offsetof(I2C_slave_buffer_t, mmatrix)
109# define I2C_KEYMAP_SLAVE_START offsetof(I2C_slave_buffer_t, smatrix)
110# define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer)
86# define I2C_REAL_MODS_START offsetof(I2C_slave_buffer_t, real_mods) 111# define I2C_REAL_MODS_START offsetof(I2C_slave_buffer_t, real_mods)
87# define I2C_WEAK_MODS_START offsetof(I2C_slave_buffer_t, weak_mods) 112# define I2C_WEAK_MODS_START offsetof(I2C_slave_buffer_t, weak_mods)
88# define I2C_ONESHOT_MODS_START offsetof(I2C_slave_buffer_t, oneshot_mods) 113# define I2C_ONESHOT_MODS_START offsetof(I2C_slave_buffer_t, oneshot_mods)
@@ -90,10 +115,14 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re
90# define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm) 115# define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm)
91# define I2C_MOUSE_X_START offsetof(I2C_slave_buffer_t, mouse_x) 116# define I2C_MOUSE_X_START offsetof(I2C_slave_buffer_t, mouse_x)
92# define I2C_MOUSE_Y_START offsetof(I2C_slave_buffer_t, mouse_y) 117# define I2C_MOUSE_Y_START offsetof(I2C_slave_buffer_t, mouse_y)
118# define I2C_MOUSE_DPI_START offsetof(I2C_slave_buffer_t, device_cpi)
93# define I2C_OLED_ON_START offsetof(I2C_slave_buffer_t, oled_on) 119# define I2C_OLED_ON_START offsetof(I2C_slave_buffer_t, oled_on)
94# define I2C_LAYER_STATE_START offsetof(I2C_slave_buffer_t, t_layer_state) 120# define I2C_LAYER_STATE_START offsetof(I2C_slave_buffer_t, t_layer_state)
95# define I2C_DEFAULT_LAYER_STATE_START offsetof(I2C_slave_buffer_t, t_default_layer_state) 121# define I2C_DEFAULT_LAYER_STATE_START offsetof(I2C_slave_buffer_t, t_default_layer_state)
96# define I2C_RGB_MATRIX_SUSPEND_START offsetof(I2C_slave_buffer_t, is_rgb_matrix_suspended) 122# define I2C_LED_MATRIX_START offsetof(I2C_slave_buffer_t, led_matrix)
123# define I2C_LED_SUSPEND_START offsetof(I2C_slave_buffer_t, led_suspend_state)
124# define I2C_RGB_MATRIX_START offsetof(I2C_slave_buffer_t, rgb_matrix)
125# define I2C_RGB_SUSPEND_START offsetof(I2C_slave_buffer_t, rgb_suspend_state)
97 126
98# define TIMEOUT 100 127# define TIMEOUT 100
99 128
@@ -102,9 +131,11 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re
102# endif 131# endif
103 132
104// Get rows from other half over i2c 133// Get rows from other half over i2c
105bool transport_master(matrix_row_t matrix[]) { 134bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
106 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_START, (void *)matrix, sizeof(i2c_buffer->smatrix), TIMEOUT); 135 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_SLAVE_START, (void *)slave_matrix, sizeof(i2c_buffer->smatrix), TIMEOUT);
107 136# ifdef SPLIT_TRANSPORT_MIRROR
137 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_MASTER_START, (void *)master_matrix, sizeof(i2c_buffer->mmatrix), TIMEOUT);
138# endif
108 // write backlight info 139 // write backlight info
109# ifdef BACKLIGHT_ENABLE 140# ifdef BACKLIGHT_ENABLE
110 uint8_t level = is_backlight_enabled() ? get_backlight_level() : 0; 141 uint8_t level = is_backlight_enabled() ? get_backlight_level() : 0;
@@ -147,6 +178,12 @@ bool transport_master(matrix_row_t matrix[]) {
147 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_Y_START, (void *)&i2c_buffer->mouse_y, sizeof(i2c_buffer->mouse_y), TIMEOUT); 178 i2c_readReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_Y_START, (void *)&i2c_buffer->mouse_y, sizeof(i2c_buffer->mouse_y), TIMEOUT);
148 temp_report.y = i2c_buffer->mouse_y; 179 temp_report.y = i2c_buffer->mouse_y;
149 pointing_device_set_report(temp_report); 180 pointing_device_set_report(temp_report);
181
182 if (device_cpi != i2c_buffer->device_cpi) {
183 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_DPI_START, (void *)&device_cpi, sizeof(device_cpi), TIMEOUT) >= 0) {
184 i2c_buffer->device_cpi = device_cpi
185 }
186 }
150 } 187 }
151# endif 188# endif
152 189
@@ -188,29 +225,42 @@ bool transport_master(matrix_row_t matrix[]) {
188 } 225 }
189 226
190# ifdef OLED_DRIVER_ENABLE 227# ifdef OLED_DRIVER_ENABLE
191 bool is_oled = is_oled_on(); 228 bool is_oled_on = is_oled_on();
192 if (is_oled != i2c_buffer->oled_on) { 229 if (is_oled_on != i2c_buffer->oled_on) {
193 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LAYER_STATE_START, (void *)&is_oled, sizeof(is_oled), TIMEOUT) >= 0) { 230 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LAYER_STATE_START, (void *)&is_oled_on, sizeof(is_oled_on), TIMEOUT) >= 0) {
194 i2c_buffer->oled_on = is_oled; 231 i2c_buffer->oled_on = is_oled_on;
195 } 232 }
196 } 233 }
197# endif 234# endif
198 235
199# ifdef RGB_MATRIX_ENABLE 236# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
200 bool sus_state = rgb_matrix_get_suspend_state(); 237 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_MATRIX_START, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix), TIMEOUT);
201 if (sus_state != i2c_buffer->is_rgb_matrix_suspended) { 238 bool suspend_state = led_matrix_get_suspend_state();
202 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_MATRIX_SUSPEND_START, (void *)&sus_state, sizeof(sus_state), TIMEOUT) >= 0) { 239 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_LED_SUSPEND_START, (void *)suspend_state, sizeof(i2c_buffer->led_suspend_state), TIMEOUT);
203 i2c_buffer->is_rgb_matrix_suspended = sus_state; 240# endif
204 } 241# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
205 } 242 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_MATRIX_START, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix), TIMEOUT);
243 bool suspend_state = rgb_matrix_get_suspend_state();
244 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_SUSPEND_START, (void *)suspend_state, sizeof(i2c_buffer->rgb_suspend_state), TIMEOUT);
245# endif
246
247# ifndef DISABLE_SYNC_TIMER
248 i2c_buffer->sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET;
249 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_SYNC_TIME_START, (void *)&i2c_buffer->sync_timer, sizeof(i2c_buffer->sync_timer), TIMEOUT);
206# endif 250# endif
207 251
208 return true; 252 return true;
209} 253}
210 254
211void transport_slave(matrix_row_t matrix[]) { 255void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
256# ifndef DISABLE_SYNC_TIMER
257 sync_timer_update(i2c_buffer->sync_timer);
258# endif
212 // Copy matrix to I2C buffer 259 // Copy matrix to I2C buffer
213 memcpy((void *)i2c_buffer->smatrix, (void *)matrix, sizeof(i2c_buffer->smatrix)); 260 memcpy((void *)i2c_buffer->smatrix, (void *)slave_matrix, sizeof(i2c_buffer->smatrix));
261# ifdef SPLIT_TRANSPORT_MIRROR
262 memcpy((void *)master_matrix, (void *)i2c_buffer->mmatrix, sizeof(i2c_buffer->mmatrix));
263# endif
214 264
215// Read Backlight Info 265// Read Backlight Info
216# ifdef BACKLIGHT_ENABLE 266# ifdef BACKLIGHT_ENABLE
@@ -235,6 +285,11 @@ void transport_slave(matrix_row_t matrix[]) {
235 285
236# ifdef POINTING_DEVICE_ENABLE 286# ifdef POINTING_DEVICE_ENABLE
237 if (!is_keyboard_left()) { 287 if (!is_keyboard_left()) {
288 static uint16_t cpi;
289 if (cpi != i2c_buffer->device_cpi) {
290 cpi = i2c_buffer->device_cpi;
291 pmw_set_cpi(cpi);
292 }
238 i2c_buffer->mouse_x = split_mouse_x; 293 i2c_buffer->mouse_x = split_mouse_x;
239 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_X_START, (void *)&i2c_buffer->mouse_x, sizeof(i2c_buffer->mouse_x), TIMEOUT); 294 i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_MOUSE_X_START, (void *)&i2c_buffer->mouse_x, sizeof(i2c_buffer->mouse_x), TIMEOUT);
240 i2c_buffer->mouse_y = split_mouse_y; 295 i2c_buffer->mouse_y = split_mouse_y;
@@ -266,8 +321,13 @@ void transport_slave(matrix_row_t matrix[]) {
266 } 321 }
267# endif 322# endif
268 323
269# ifdef RGB_MATRIX_ENABLE 324# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
270 rgb_matrix_set_suspend_state(i2c_buffer->is_rgb_matrix_suspended); 325 memcpy((void *)i2c_buffer->led_matrix, (void *)led_matrix_eeconfig, sizeof(i2c_buffer->led_matrix));
326 led_matrix_set_suspend_state(i2c_buffer->led_suspend_state);
327# endif
328# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
329 memcpy((void *)i2c_buffer->rgb_matrix, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix));
330 rgb_matrix_set_suspend_state(i2c_buffer->rgb_suspend_state);
271# endif 331# endif
272} 332}
273 333
@@ -283,30 +343,44 @@ typedef struct _Serial_s2m_buffer_t {
283 // TODO: if MATRIX_COLS > 8 change to uint8_t packed_matrix[] for pack/unpack 343 // TODO: if MATRIX_COLS > 8 change to uint8_t packed_matrix[] for pack/unpack
284 matrix_row_t smatrix[ROWS_PER_HAND]; 344 matrix_row_t smatrix[ROWS_PER_HAND];
285# ifdef ENCODER_ENABLE 345# ifdef ENCODER_ENABLE
286 uint8_t encoder_state[NUMBER_OF_ENCODERS]; 346 uint8_t encoder_state[NUMBER_OF_ENCODERS];
287# endif 347# endif
288 int8_t mouse_x; 348 int8_t mouse_x;
289 int8_t mouse_y; 349 int8_t mouse_y;
290} __attribute__((packed)) Serial_s2m_buffer_t; 350} __attribute__((packed)) Serial_s2m_buffer_t;
291 351
292typedef struct _Serial_m2s_buffer_t { 352typedef struct _Serial_m2s_buffer_t {
293# ifdef SPLIT_MODS_ENABLE 353# ifdef SPLIT_MODS_ENABLE
294 uint8_t real_mods; 354 uint8_t real_mods;
295 uint8_t weak_mods; 355 uint8_t weak_mods;
296# ifndef NO_ACTION_ONESHOT 356# ifndef NO_ACTION_ONESHOT
297 uint8_t oneshot_mods; 357 uint8_t oneshot_mods;
298# endif 358# endif
299# endif 359# endif
360# ifndef DISABLE_SYNC_TIMER
361 uint32_t sync_timer;
362# endif
363# ifdef SPLIT_TRANSPORT_MIRROR
364 matrix_row_t mmatrix[ROWS_PER_HAND];
365# endif
300# ifdef BACKLIGHT_ENABLE 366# ifdef BACKLIGHT_ENABLE
301 uint8_t backlight_level; 367 uint8_t backlight_level;
302# endif 368# endif
303# ifdef WPM_ENABLE 369# ifdef WPM_ENABLE
304 uint8_t current_wpm; 370 uint8_t current_wpm;
305# endif 371# endif
372 uint16_t device_cpi;
306 bool oled_on; 373 bool oled_on;
307 layer_state_t t_layer_state; 374 layer_state_t t_layer_state;
308 layer_state_t t_default_layer_state; 375 layer_state_t t_default_layer_state;
309 bool is_rgb_matrix_suspended; 376# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
377 led_eeconfig_t led_matrix;
378 bool led_suspend_state;
379# endif
380# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
381 rgb_config_t rgb_matrix;
382 bool rgb_suspend_state;
383# endif
310} __attribute__((packed)) Serial_m2s_buffer_t; 384} __attribute__((packed)) Serial_m2s_buffer_t;
311 385
312# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 386# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
@@ -383,7 +457,7 @@ void transport_rgblight_slave(void) {
383# define transport_rgblight_slave() 457# define transport_rgblight_slave()
384# endif 458# endif
385 459
386bool transport_master(matrix_row_t matrix[]) { 460bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
387# ifndef SERIAL_USE_MULTI_TRANSACTION 461# ifndef SERIAL_USE_MULTI_TRANSACTION
388 if (soft_serial_transaction() != TRANSACTION_END) { 462 if (soft_serial_transaction() != TRANSACTION_END) {
389 return false; 463 return false;
@@ -397,7 +471,10 @@ bool transport_master(matrix_row_t matrix[]) {
397 471
398 // TODO: if MATRIX_COLS > 8 change to unpack() 472 // TODO: if MATRIX_COLS > 8 change to unpack()
399 for (int i = 0; i < ROWS_PER_HAND; ++i) { 473 for (int i = 0; i < ROWS_PER_HAND; ++i) {
400 matrix[i] = serial_s2m_buffer.smatrix[i]; 474 slave_matrix[i] = serial_s2m_buffer.smatrix[i];
475# ifdef SPLIT_TRANSPORT_MIRROR
476 serial_m2s_buffer.mmatrix[i] = master_matrix[i];
477# endif
401 } 478 }
402 479
403# ifdef BACKLIGHT_ENABLE 480# ifdef BACKLIGHT_ENABLE
@@ -411,12 +488,12 @@ bool transport_master(matrix_row_t matrix[]) {
411 488
412# ifdef WPM_ENABLE 489# ifdef WPM_ENABLE
413 // Write wpm to slave 490 // Write wpm to slave
414 serial_m2s_buffer.current_wpm = get_current_wpm(); 491 serial_m2s_buffer.current_wpm = get_current_wpm();
415# endif 492# endif
416 493
417# ifdef SPLIT_MODS_ENABLE 494# ifdef SPLIT_MODS_ENABLE
418 serial_m2s_buffer.real_mods = get_mods(); 495 serial_m2s_buffer.real_mods = get_mods();
419 serial_m2s_buffer.weak_mods = get_weak_mods(); 496 serial_m2s_buffer.weak_mods = get_weak_mods();
420# ifndef NO_ACTION_ONESHOT 497# ifndef NO_ACTION_ONESHOT
421 serial_m2s_buffer.oneshot_mods = get_oneshot_mods(); 498 serial_m2s_buffer.oneshot_mods = get_oneshot_mods();
422# endif 499# endif
@@ -428,28 +505,43 @@ bool transport_master(matrix_row_t matrix[]) {
428 temp_report.x = serial_s2m_buffer.mouse_x; 505 temp_report.x = serial_s2m_buffer.mouse_x;
429 temp_report.y = serial_s2m_buffer.mouse_y; 506 temp_report.y = serial_s2m_buffer.mouse_y;
430 pointing_device_set_report(temp_report); 507 pointing_device_set_report(temp_report);
508 serial_m2s_buffer.device_cpi = device_cpi;
431 } 509 }
432# endif 510# endif
433 511
434 serial_m2s_buffer.t_layer_state = layer_state; 512 serial_m2s_buffer.t_layer_state = layer_state;
435 serial_m2s_buffer.t_default_layer_state = default_layer_state; 513 serial_m2s_buffer.t_default_layer_state = default_layer_state;
436# ifdef OLED_DRIVER_ENABLE 514# ifdef OLED_DRIVER_ENABLE
437 serial_m2s_buffer.oled_on = is_oled_on(); 515 serial_m2s_buffer.oled_on = is_oled_on();
438# endif 516# endif
439 517
440# ifdef RGB_MATRIX_ENABLE 518# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
441 serial_m2s_buffer.is_rgb_matrix_suspended = rgb_matrix_get_suspend_state(); 519 serial_m2s_buffer.led_matrix = led_matrix_eeconfig;
520 serial_m2s_buffer.led_suspend_state = led_matrix_get_suspend_state();
521# endif
522# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
523 serial_m2s_buffer.rgb_matrix = rgb_matrix_config;
524 serial_m2s_buffer.rgb_suspend_state = rgb_matrix_get_suspend_state();
442# endif 525# endif
443 526
527# ifndef DISABLE_SYNC_TIMER
528 serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET;
529# endif
444 return true; 530 return true;
445} 531}
446 532
447void transport_slave(matrix_row_t matrix[]) { 533void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
448 transport_rgblight_slave(); 534 transport_rgblight_slave();
535# ifndef DISABLE_SYNC_TIMER
536 sync_timer_update(serial_m2s_buffer.sync_timer);
537# endif
449 538
450 // TODO: if MATRIX_COLS > 8 change to pack() 539 // TODO: if MATRIX_COLS > 8 change to pack()
451 for (int i = 0; i < ROWS_PER_HAND; ++i) { 540 for (int i = 0; i < ROWS_PER_HAND; ++i) {
452 serial_s2m_buffer.smatrix[i] = matrix[i]; 541 serial_s2m_buffer.smatrix[i] = slave_matrix[i];
542# ifdef SPLIT_TRANSPORT_MIRROR
543 master_matrix[i] = serial_m2s_buffer.mmatrix[i];
544# endif
453 } 545 }
454 546
455# ifdef BACKLIGHT_ENABLE 547# ifdef BACKLIGHT_ENABLE
@@ -474,6 +566,11 @@ void transport_slave(matrix_row_t matrix[]) {
474 566
475# ifdef POINTING_DEVICE_ENABLE 567# ifdef POINTING_DEVICE_ENABLE
476 if (!is_keyboard_left()) { 568 if (!is_keyboard_left()) {
569 static uint16_t cpi;
570 if (cpi != serial_m2s_buffer.device_cpi) {
571 cpi = serial_m2s_buffer.device_cpi;
572 pmw_set_cpi(cpi);
573 }
477 serial_s2m_buffer.mouse_x = split_mouse_x; 574 serial_s2m_buffer.mouse_x = split_mouse_x;
478 serial_s2m_buffer.mouse_y = split_mouse_y; 575 serial_s2m_buffer.mouse_y = split_mouse_y;
479 } 576 }
@@ -493,16 +590,14 @@ void transport_slave(matrix_row_t matrix[]) {
493 } 590 }
494# endif 591# endif
495 592
496# ifdef RGB_MATRIX_ENABLE 593# if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
497 rgb_matrix_set_suspend_state(serial_m2s_buffer.is_rgb_matrix_suspended); 594 led_matrix_eeconfig = serial_m2s_buffer.led_matrix;
595 led_matrix_set_suspend_state(serial_m2s_buffer.led_suspend_state);
596# endif
597# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
598 rgb_matrix_config = serial_m2s_buffer.rgb_matrix;
599 rgb_matrix_set_suspend_state(serial_m2s_buffer.rgb_suspend_state);
498# endif 600# endif
499} 601}
500 602
501#endif 603#endif
502
503#ifdef POINTING_DEVICE_ENABLE
504void master_mouse_send(int8_t x, int8_t y) {
505 split_mouse_x = x;
506 split_mouse_y = y;
507}
508#endif
diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c
index 4abf5f05f..98e467d93 100644
--- a/users/drashna/oled_stuff.c
+++ b/users/drashna/oled_stuff.c
@@ -15,7 +15,6 @@
15 */ 15 */
16 16
17#include "drashna.h" 17#include "drashna.h"
18#include <stdio.h>
19 18
20#ifndef KEYLOGGER_LENGTH 19#ifndef KEYLOGGER_LENGTH
21// # ifdef OLED_DISPLAY_128X64 20// # ifdef OLED_DISPLAY_128X64
@@ -158,6 +157,19 @@ void render_keylock_status(uint8_t led_usb_state) {
158 oled_advance_page(true); 157 oled_advance_page(true);
159#endif 158#endif
160} 159}
160void render_matrix_scan_rate(void) {
161#ifdef DEBUG_MATRIX_SCAN_RATE
162 char matrix_rate[5];
163 uint16_t n = get_matrix_scan_rate();
164 matrix_rate[4] = '\0';
165 matrix_rate[3] = '0' + n % 10;
166 matrix_rate[2] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
167 matrix_rate[1] = n / 10 ? '0' + n / 10 : ' ';
168 matrix_rate[0] = ' ';
169 oled_write_P(PSTR("MS:"), false);
170 oled_write(matrix_rate, false);
171#endif
172}
161 173
162void render_mod_status(uint8_t modifiers) { 174void render_mod_status(uint8_t modifiers) {
163 static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}}; 175 static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}};
@@ -169,11 +181,17 @@ void render_mod_status(uint8_t modifiers) {
169#endif 181#endif
170 oled_write_P(mod_status[2], (modifiers & MOD_MASK_ALT)); 182 oled_write_P(mod_status[2], (modifiers & MOD_MASK_ALT));
171 oled_write_P(mod_status[1], (modifiers & MOD_MASK_CTRL)); 183 oled_write_P(mod_status[1], (modifiers & MOD_MASK_CTRL));
184
185 render_matrix_scan_rate();
172#if defined(OLED_DISPLAY_128X64) 186#if defined(OLED_DISPLAY_128X64)
173 oled_advance_page(true); 187 oled_advance_page(true);
174#endif 188#endif
175} 189}
176 190
191#ifdef SWAP_HANDS_ENABLE
192extern bool swap_hands;
193#endif
194
177void render_bootmagic_status(void) { 195void render_bootmagic_status(void) {
178 /* Show Ctrl-Gui Swap options */ 196 /* Show Ctrl-Gui Swap options */
179 static const char PROGMEM logo[][2][3] = { 197 static const char PROGMEM logo[][2][3] = {
@@ -209,7 +227,7 @@ void render_bootmagic_status(void) {
209 oled_write_P(PSTR(" "), false); 227 oled_write_P(PSTR(" "), false);
210 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NKRO), keymap_config.nkro); 228 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NKRO), keymap_config.nkro);
211 oled_write_P(PSTR(" "), false); 229 oled_write_P(PSTR(" "), false);
212 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NOGUI), !keymap_config.no_gui); 230 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NOGUI), keymap_config.no_gui);
213#ifdef OLED_DISPLAY_128X64 231#ifdef OLED_DISPLAY_128X64
214 oled_advance_page(true); 232 oled_advance_page(true);
215 oled_write_P(PSTR("Magic"), false); 233 oled_write_P(PSTR("Magic"), false);
@@ -221,10 +239,11 @@ void render_bootmagic_status(void) {
221 } 239 }
222#endif 240#endif
223 oled_write_P(PSTR(" "), false); 241 oled_write_P(PSTR(" "), false);
224 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_GRV), keymap_config.swap_grave_esc); 242 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_ONESHOT), !is_oneshot_enabled());
243#ifdef SWAP_HANDS_ENABLE
225 oled_write_P(PSTR(" "), false); 244 oled_write_P(PSTR(" "), false);
226 oled_write_P(PSTR(" "), false); 245 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_SWAP), swap_hands);
227 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_CAPS), keymap_config.swap_control_capslock); 246#endif
228#ifdef OLED_DISPLAY_128X64 247#ifdef OLED_DISPLAY_128X64
229 oled_advance_page(true); 248 oled_advance_page(true);
230#endif 249#endif
@@ -282,12 +301,22 @@ __attribute__((weak)) void oled_driver_render_logo(void) {
282 301
283void render_wpm(void) { 302void render_wpm(void) {
284#ifdef WPM_ENABLE 303#ifdef WPM_ENABLE
304 uint8_t n = get_current_wpm();
285# ifdef OLED_DISPLAY_128X64 305# ifdef OLED_DISPLAY_128X64
286 char wpm_counter[4]; 306 char wpm_counter[4];
307 wpm_counter[3] = '\0';
308 wpm_counter[2] = '0' + n % 10;
309 wpm_counter[1] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
310 wpm_counter[0] = n / 10 ? '0' + n / 10 : ' ';
287# else 311# else
288 char wpm_counter[6]; 312 char wpm_counter[6];
289# endif 313 wpm_counter[5] = '\0';
290 snprintf(wpm_counter, sizeof(wpm_counter), "%3u", get_current_wpm()); 314 wpm_counter[4] = '0' + n % 10;
315 wpm_counter[3] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
316 wpm_counter[2] = n / 10 ? '0' + n / 10 : ' ';
317 wpm_counter[1] = ' ';
318 wpm_counter[0] = ' ';
319 # endif
291 oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false); 320 oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false);
292 oled_write(wpm_counter, false); 321 oled_write(wpm_counter, false);
293#endif 322#endif
@@ -299,7 +328,13 @@ extern uint16_t dpi_array[];
299 328
300void render_pointing_dpi_status(void) { 329void render_pointing_dpi_status(void) {
301 char dpi_status[6]; 330 char dpi_status[6];
302 snprintf(dpi_status, sizeof(dpi_status), "%5u", dpi_array[keyboard_config.dpi_config]); 331 uint16_t n = dpi_array[keyboard_config.dpi_config];
332 dpi_status[5] = '\0';
333 dpi_status[4] = '0' + n % 10;
334 dpi_status[3] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
335 dpi_status[2] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
336 dpi_status[1] = n / 10 ? '0' + n / 10 : ' ';
337 dpi_status[0] = ' ';
303 oled_write_P(PSTR(" DPI: "), false); 338 oled_write_P(PSTR(" DPI: "), false);
304 oled_write(dpi_status, false); 339 oled_write(dpi_status, false);
305} 340}
@@ -320,7 +355,11 @@ void render_status_secondary(void) {
320void render_status_main(void) { 355void render_status_main(void) {
321#if defined(OLED_DISPLAY_128X64) 356#if defined(OLED_DISPLAY_128X64)
322 oled_driver_render_logo(); 357 oled_driver_render_logo();
358# ifdef DEBUG_MATRIX_SCAN_RATE
359 render_matrix_scan_rate();
360# else
323 render_wpm(); 361 render_wpm();
362# endif
324# ifdef KEYBOARD_handwired_dactyl_manuform_5x6_right_trackball 363# ifdef KEYBOARD_handwired_dactyl_manuform_5x6_right_trackball
325 render_pointing_dpi_status(); 364 render_pointing_dpi_status();
326# endif 365# endif
diff --git a/users/drashna/oled_stuff.h b/users/drashna/oled_stuff.h
index 2224cd90e..1f4440bd4 100644
--- a/users/drashna/oled_stuff.h
+++ b/users/drashna/oled_stuff.h
@@ -57,6 +57,8 @@ extern uint32_t oled_timer;
57# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" 57# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
58# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" 58# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
59# define OLED_RENDER_BOOTMAGIC_GRV "GRV" 59# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
60# define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT"
61# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP"
60# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" 62# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
61 63
62# define OLED_RENDER_USER_NAME "USER:" 64# define OLED_RENDER_USER_NAME "USER:"
@@ -99,6 +101,8 @@ extern uint32_t oled_timer;
99# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" 101# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
100# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" 102# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
101# define OLED_RENDER_BOOTMAGIC_GRV "GRV" 103# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
104# define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT"
105# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP"
102# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" 106# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
103 107
104# define OLED_RENDER_USER_NAME "USER:" 108# define OLED_RENDER_USER_NAME "USER:"
diff --git a/users/drashna/pimoroni_trackball.c b/users/drashna/pimoroni_trackball.c
index 9ae094c05..a6ca6c996 100644
--- a/users/drashna/pimoroni_trackball.c
+++ b/users/drashna/pimoroni_trackball.c
@@ -33,7 +33,7 @@ static float precisionSpeed = 1;
33 33
34void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white) { 34void trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white) {
35 uint8_t data[] = {0x00, red, green, blue, white}; 35 uint8_t data[] = {0x00, red, green, blue, white};
36 i2c_transmit(TRACKBALL_WRITE, data, sizeof(data), I2C_TIMEOUT); 36 i2c_transmit(TRACKBALL_ADDRESS << 1, data, sizeof(data), I2C_TIMEOUT);
37} 37}
38 38
39int16_t mouse_offset(uint8_t positive, uint8_t negative, int16_t scale) { 39int16_t mouse_offset(uint8_t positive, uint8_t negative, int16_t scale) {
@@ -94,7 +94,7 @@ void pointing_device_task(void) {
94 static bool debounce; 94 static bool debounce;
95 static uint16_t debounce_timer; 95 static uint16_t debounce_timer;
96 uint8_t state[5] = {}; 96 uint8_t state[5] = {};
97 if (i2c_readReg(TRACKBALL_WRITE, 0x04, state, 5, I2C_TIMEOUT) == I2C_STATUS_SUCCESS) { 97 if (i2c_readReg(TRACKBALL_ADDRESS << 1, 0x04, state, 5, I2C_TIMEOUT) == I2C_STATUS_SUCCESS) {
98 if (!state[4] && !debounce) { 98 if (!state[4] && !debounce) {
99 if (scrolling) { 99 if (scrolling) {
100#ifdef PIMORONI_TRACKBALL_INVERT_X 100#ifdef PIMORONI_TRACKBALL_INVERT_X
diff --git a/users/drashna/process_records.h b/users/drashna/process_records.h
index 2e2467050..f60e6d7eb 100644
--- a/users/drashna/process_records.h
+++ b/users/drashna/process_records.h
@@ -53,7 +53,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
53#define LOWER MO(_LOWER) 53#define LOWER MO(_LOWER)
54#define RAISE MO(_RAISE) 54#define RAISE MO(_RAISE)
55#define ADJUST MO(_ADJUST) 55#define ADJUST MO(_ADJUST)
56#define TG_MODS TG(_MODS) 56#define TG_MODS OS_TOGG
57#define TG_GAME TG(_GAMEPAD) 57#define TG_GAME TG(_GAMEPAD)
58#define TG_DBLO TG(_DIABLO) 58#define TG_DBLO TG(_DIABLO)
59#define OS_LWR OSL(_LOWER) 59#define OS_LWR OSL(_LOWER)
diff --git a/users/drashna/rgb_matrix_stuff.c b/users/drashna/rgb_matrix_stuff.c
index 573cc7bc9..9e9e1e427 100644
--- a/users/drashna/rgb_matrix_stuff.c
+++ b/users/drashna/rgb_matrix_stuff.c
@@ -62,7 +62,7 @@ __attribute__((weak)) void rgb_matrix_indicator_keymap(void) {}
62 62
63void matrix_scan_rgb_matrix(void) { 63void matrix_scan_rgb_matrix(void) {
64#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) 64#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
65 if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_TYPING_HEATMAP && timer_elapsed32(hypno_timer) > 15000) { 65 if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_TYPING_HEATMAP && sync_timer_elapsed32(hypno_timer) > 15000) {
66 rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE); 66 rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE);
67 } 67 }
68#endif 68#endif
@@ -79,7 +79,7 @@ void keyboard_post_init_rgb_matrix(void) {
79 79
80bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record) { 80bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
81#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) 81#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
82 hypno_timer = timer_read32(); 82 hypno_timer = sync_timer_read32();
83 if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_REST_MODE) { 83 if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_REST_MODE) {
84 rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP); 84 rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP);
85 } 85 }
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index c8b2f4c72..6723ad4bf 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -32,7 +32,7 @@ void scan_rgblight_fadeout(void) { // Don't effing change this function .... rg
32 bool litup = false; 32 bool litup = false;
33 33
34 for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) { 34 for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) {
35 if (lights[light_index].enabled && timer_elapsed(lights[light_index].timer) > 10) { 35 if (lights[light_index].enabled && sync_timer_elapsed(lights[light_index].timer) > 10) {
36 rgblight_fadeout *light = &lights[light_index]; 36 rgblight_fadeout *light = &lights[light_index];
37 litup = true; 37 litup = true;
38 38
@@ -41,7 +41,7 @@ void scan_rgblight_fadeout(void) { // Don't effing change this function .... rg
41 if (get_highest_layer(layer_state) == 0) { 41 if (get_highest_layer(layer_state) == 0) {
42 sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]); 42 sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]);
43 } 43 }
44 light->timer = timer_read(); 44 light->timer = sync_timer_read();
45 } else { 45 } else {
46 if (light->enabled && get_highest_layer(layer_state) == 0) { 46 if (light->enabled && get_highest_layer(layer_state) == 0) {
47 rgblight_sethsv_default_helper(light_index); 47 rgblight_sethsv_default_helper(light_index);
@@ -86,7 +86,7 @@ void start_rgb_light(void) {
86 86
87 rgblight_fadeout *light = &lights[light_index]; 87 rgblight_fadeout *light = &lights[light_index];
88 light->enabled = true; 88 light->enabled = true;
89 light->timer = timer_read(); 89 light->timer = sync_timer_read();
90 light->life = 0xC0 + rand() % 0x40; 90 light->life = 0xC0 + rand() % 0x40;
91 91
92 light->hue = rgblight_get_hue() + (rand() % 0xB4) - 0x54; 92 light->hue = rgblight_get_hue() + (rand() % 0xB4) - 0x54;
@@ -149,11 +149,11 @@ void matrix_scan_rgb_light(void) {
149 149
150# if defined(RGBLIGHT_STARTUP_ANIMATION) 150# if defined(RGBLIGHT_STARTUP_ANIMATION)
151 if (is_rgblight_startup && is_keyboard_master()) { 151 if (is_rgblight_startup && is_keyboard_master()) {
152 if (timer_elapsed(rgblight_startup_loop_timer) > 10) { 152 if (sync_timer_elapsed(rgblight_startup_loop_timer) > 10) {
153 static uint8_t counter; 153 static uint8_t counter;
154 counter++; 154 counter++;
155 rgblight_sethsv_noeeprom((counter + old_hue) % 255, 255, 255); 155 rgblight_sethsv_noeeprom((counter + old_hue) % 255, 255, 255);
156 rgblight_startup_loop_timer = timer_read(); 156 rgblight_startup_loop_timer = sync_timer_read();
157 if (counter == 255) { 157 if (counter == 255) {
158 is_rgblight_startup = false; 158 is_rgblight_startup = false;
159 if (!is_enabled) { 159 if (!is_enabled) {
@@ -177,14 +177,11 @@ void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mo
177layer_state_t layer_state_set_rgb_light(layer_state_t state) { 177layer_state_t layer_state_set_rgb_light(layer_state_t state) {
178# ifdef RGBLIGHT_ENABLE 178# ifdef RGBLIGHT_ENABLE
179 if (userspace_config.rgb_layer_change) { 179 if (userspace_config.rgb_layer_change) {
180 uint8_t mode = layer_state_cmp(state, _MODS) ? RGBLIGHT_MODE_BREATHING : RGBLIGHT_MODE_STATIC_LIGHT;
181 switch (get_highest_layer(state | default_layer_state)) { 180 switch (get_highest_layer(state | default_layer_state)) {
182 case _MACROS: 181 case _MACROS: // mouse
183# ifdef RGBLIGHT_EFFECT_TWINKLE 182 if (!layer_state_cmp(state, _GAMEPAD) && !layer_state_cmp(state, _DIABLO)) {
184 rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_TWINKLE + 5); 183 rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_BREATHING + 3);
185# else 184 }
186 rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_BREATHING + 3);
187# endif
188 break; 185 break;
189 case _MEDIA: 186 case _MEDIA:
190 rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_KNIGHT + 1); 187 rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_KNIGHT + 1);
@@ -205,28 +202,28 @@ layer_state_t layer_state_set_rgb_light(layer_state_t state) {
205 rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2); 202 rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2);
206 break; 203 break;
207 case _COLEMAK: 204 case _COLEMAK:
208 rgblight_set_hsv_and_mode(HSV_MAGENTA, mode); 205 rgblight_set_hsv_and_mode(HSV_MAGENTA, RGBLIGHT_MODE_STATIC_LIGHT);
209 break; 206 break;
210 case _DVORAK: 207 case _DVORAK:
211 rgblight_set_hsv_and_mode(HSV_SPRINGGREEN, mode); 208 rgblight_set_hsv_and_mode(HSV_SPRINGGREEN, RGBLIGHT_MODE_STATIC_LIGHT);
212 break; 209 break;
213 case _WORKMAN: 210 case _WORKMAN:
214 rgblight_set_hsv_and_mode(HSV_GOLDENROD, mode); 211 rgblight_set_hsv_and_mode(HSV_GOLDENROD, RGBLIGHT_MODE_STATIC_LIGHT);
215 break; 212 break;
216 case _NORMAN: 213 case _NORMAN:
217 rgblight_set_hsv_and_mode(HSV_CORAL, mode); 214 rgblight_set_hsv_and_mode(HSV_CORAL, RGBLIGHT_MODE_STATIC_LIGHT);
218 break; 215 break;
219 case _MALTRON: 216 case _MALTRON:
220 rgblight_set_hsv_and_mode(HSV_YELLOW, mode); 217 rgblight_set_hsv_and_mode(HSV_YELLOW, RGBLIGHT_MODE_STATIC_LIGHT);
221 break; 218 break;
222 case _EUCALYN: 219 case _EUCALYN:
223 rgblight_set_hsv_and_mode(HSV_PINK, mode); 220 rgblight_set_hsv_and_mode(HSV_PINK, RGBLIGHT_MODE_STATIC_LIGHT);
224 break; 221 break;
225 case _CARPLAX: 222 case _CARPLAX:
226 rgblight_set_hsv_and_mode(HSV_BLUE, mode); 223 rgblight_set_hsv_and_mode(HSV_BLUE, RGBLIGHT_MODE_STATIC_LIGHT);
227 break; 224 break;
228 default: 225 default:
229 rgblight_set_hsv_and_mode(HSV_CYAN, mode); 226 rgblight_set_hsv_and_mode(HSV_CYAN, RGBLIGHT_MODE_STATIC_LIGHT);
230 break; 227 break;
231 } 228 }
232 } 229 }
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index 2ae01c62e..b79051508 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -16,29 +16,37 @@ ifneq ($(strip $(NO_SECRETS)), yes)
16 endif 16 endif
17endif 17endif
18 18
19CUSTOM_TAP_DANCE ?= yes
19ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) 20ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
20 SRC += tap_dances.c 21 ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
22 SRC += tap_dances.c
23 endif
21endif 24endif
22 25
26CUSTOM_RGBLIGHT ?= yes
23ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) 27ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
24 SRC += rgb_stuff.c 28 ifeq ($(strip $(CUSTOM_RGBLIGHT)), yes)
25 ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes) 29 SRC += rgb_stuff.c
26 OPT_DEFS += -DRGBLIGHT_TWINKLE 30 ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes)
27 endif 31 OPT_DEFS += -DRGBLIGHT_TWINKLE
28 ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes) 32 endif
29 OPT_DEFS += -DRGBLIGHT_NOEEPROM 33 ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes)
30 endif 34 OPT_DEFS += -DRGBLIGHT_NOEEPROM
31 ifeq ($(strip $(RGBLIGHT_STARTUP_ANIMATION)), yes) 35 endif
32 OPT_DEFS += -DRGBLIGHT_STARTUP_ANIMATION 36 ifeq ($(strip $(RGBLIGHT_STARTUP_ANIMATION)), yes)
37 OPT_DEFS += -DRGBLIGHT_STARTUP_ANIMATION
38 endif
33 endif 39 endif
34endif 40endif
35 41
36RGB_MATRIX_ENABLE ?= no 42CUSTOM_RGB_MATRIX ?= yes
37ifneq ($(strip $(RGB_MATRIX_ENABLE)), no) 43ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
38 SRC += rgb_matrix_stuff.c 44 ifeq ($(strip $(CUSTOM_RGB_MATRIX)), yes)
45 SRC += rgb_matrix_stuff.c
46 endif
39endif 47endif
40 48
41 49KEYLOGGER_ENABLE ?= no
42ifdef CONSOLE_ENABLE 50ifdef CONSOLE_ENABLE
43 ifeq ($(strip $(KEYLOGGER_ENABLE)), yes) 51 ifeq ($(strip $(KEYLOGGER_ENABLE)), yes)
44 OPT_DEFS += -DKEYLOGGER_ENABLE 52 OPT_DEFS += -DKEYLOGGER_ENABLE
@@ -56,8 +64,11 @@ ifeq ($(strip $(PROTOCOL)), VUSB)
56 NKRO_ENABLE = no 64 NKRO_ENABLE = no
57endif 65endif
58 66
67CUSTOM_OLED_DRIVER ?= yes
59ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes) 68ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
60 SRC += oled_stuff.c 69 ifeq ($(strip $(CUSTOM_OLED_DRIVER)), yes)
70 SRC += oled_stuff.c
71 endif
61endif 72endif
62 73
63ifeq ($(strip $(PIMORONI_TRACKBALL_ENABLE)), yes) 74ifeq ($(strip $(PIMORONI_TRACKBALL_ENABLE)), yes)
@@ -67,26 +78,30 @@ ifeq ($(strip $(PIMORONI_TRACKBALL_ENABLE)), yes)
67 QUANTUM_LIB_SRC += i2c_master.c 78 QUANTUM_LIB_SRC += i2c_master.c
68endif 79endif
69 80
70 81CUSTOM_SPLIT_TRANSPORT ?= yes
71ifeq ($(strip $(SPLIT_KEYBOARD)), yes) 82ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
72 ifneq ($(strip $(SPLIT_TRANSPORT)), custom) 83 ifneq ($(strip $(SPLIT_TRANSPORT)), custom)
73 SPLIT_TRANSPORT = custom 84 ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT)), yes)
74 QUANTUM_LIB_SRC += drashna_transport.c 85 SPLIT_TRANSPORT = custom
75 OPT_DEFS += -DDRASHNA_CUSTOM_TRANSPORT 86 QUANTUM_LIB_SRC += drashna_transport.c
76 # Unused functions are pruned away, which is why we can add multiple drivers here without bloat. 87 OPT_DEFS += -DDRASHNA_CUSTOM_TRANSPORT
77 ifeq ($(PLATFORM),AVR) 88 # Unused functions are pruned away, which is why we can add multiple drivers here without bloat.
78 ifneq ($(NO_I2C),yes) 89 ifeq ($(PLATFORM),AVR)
79 QUANTUM_LIB_SRC += i2c_master.c \ 90 ifneq ($(NO_I2C),yes)
80 i2c_slave.c 91 QUANTUM_LIB_SRC += i2c_master.c \
92 i2c_slave.c
93 endif
81 endif 94 endif
82 endif
83 95
84 SERIAL_DRIVER ?= bitbang 96 SERIAL_DRIVER ?= bitbang
85 OPT_DEFS += -DSERIAL_DRIVER_$(strip $(shell echo $(SERIAL_DRIVER) | tr '[:lower:]' '[:upper:]')) 97 OPT_DEFS += -DSERIAL_DRIVER_$(strip $(shell echo $(SERIAL_DRIVER) | tr '[:lower:]' '[:upper:]'))
86 ifeq ($(strip $(SERIAL_DRIVER)), bitbang) 98 ifeq ($(strip $(SERIAL_DRIVER)), bitbang)
87 QUANTUM_LIB_SRC += serial.c 99 QUANTUM_LIB_SRC += serial.c
88 else 100 else
89 QUANTUM_LIB_SRC += serial_$(strip $(SERIAL_DRIVER)).c 101 QUANTUM_LIB_SRC += serial_$(strip $(SERIAL_DRIVER)).c
102 endif
90 endif 103 endif
91 endif 104 endif
92endif 105endif
106
107# DEBUG_MATRIX_SCAN_RATE_ENABLE = api