From a8d0ec0749046b0ab89c18b1b7083b1e8674de2a Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Tue, 1 Dec 2020 12:04:42 -0600 Subject: [Split] Sync Timer feature (#10997) A timer that is kept in sync between the halves of a split keyboard --- quantum/split_common/transport.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'quantum/split_common/transport.c') diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index 467ff81a97..6856b60558 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -6,6 +6,7 @@ #include "quantum.h" #define ROWS_PER_HAND (MATRIX_ROWS / 2) +#define SYNC_TIMER_OFFSET 2 #ifdef RGBLIGHT_ENABLE # include "rgblight.h" @@ -27,6 +28,9 @@ static pin_t encoders_pad[] = ENCODERS_PAD_A; # include "i2c_slave.h" typedef struct _I2C_slave_buffer_t { +# ifndef DISABLE_SYNC_TIMER + uint32_t sync_timer; +# endif matrix_row_t smatrix[ROWS_PER_HAND]; uint8_t backlight_level; # if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) @@ -44,6 +48,7 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re # define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level) # define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) +# define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer) # define I2C_KEYMAP_START offsetof(I2C_slave_buffer_t, smatrix) # define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state) # define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm) @@ -91,10 +96,18 @@ bool transport_master(matrix_row_t matrix[]) { } } # endif + +# ifndef DISABLE_SYNC_TIMER + i2c_buffer->sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; + i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_SYNC_TIME_START, (void *)&i2c_buffer->sync_timer, sizeof(i2c_buffer->sync_timer), TIMEOUT); +# endif return true; } void transport_slave(matrix_row_t matrix[]) { +# ifndef DISABLE_SYNC_TIMER + sync_timer_update(i2c_buffer->sync_timer); +# endif // Copy matrix to I2C buffer memcpy((void *)i2c_buffer->smatrix, (void *)matrix, sizeof(i2c_buffer->smatrix)); @@ -133,12 +146,15 @@ typedef struct _Serial_s2m_buffer_t { matrix_row_t smatrix[ROWS_PER_HAND]; # ifdef ENCODER_ENABLE - uint8_t encoder_state[NUMBER_OF_ENCODERS]; + uint8_t encoder_state[NUMBER_OF_ENCODERS]; # endif } Serial_s2m_buffer_t; typedef struct _Serial_m2s_buffer_t { +# ifndef DISABLE_SYNC_TIMER + uint32_t sync_timer; +# endif # ifdef BACKLIGHT_ENABLE uint8_t backlight_level; # endif @@ -251,11 +267,19 @@ bool transport_master(matrix_row_t matrix[]) { // Write wpm to slave serial_m2s_buffer.current_wpm = get_current_wpm(); # endif + +# ifndef DISABLE_SYNC_TIMER + serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; +# endif return true; } void transport_slave(matrix_row_t matrix[]) { transport_rgblight_slave(); +# ifndef DISABLE_SYNC_TIMER + sync_timer_update(serial_m2s_buffer.sync_timer); +# endif + // TODO: if MATRIX_COLS > 8 change to pack() for (int i = 0; i < ROWS_PER_HAND; ++i) { serial_s2m_buffer.smatrix[i] = matrix[i]; -- cgit v1.2.1 From 5e2b53541bef9b380380286724b321cc8a0ac413 Mon Sep 17 00:00:00 2001 From: Casey Webster Date: Wed, 16 Dec 2020 23:21:26 -0600 Subject: Add modifier state to the split keyboard transport (#10400) * Add modifier state to the split transport This adds modifier state to the i2c and serial transport for split keyboards. The purpose of this is to allow e.g. displaying modifier state on the slave side of a split keyboard on an oled. This adds one byte to the data transferred between halves. This also fixes a missing ifdef guard for BLACKLIGHT_ENABLE. Break modifiers into real/weak/oneshot Fix incorrect slave serial mod setting Fix typo in serial weal mod setter Fix build errors for the I2C code that I introduced Code cleanup and formatting per project preferences Correctly get oneshot mods Fix missing braces Remove unneeded ifdef guard Make the added state transport optional Add documentation for the new define to enable this feature Fix stray grave mark * Fix error introduced in conflict resolution --- quantum/split_common/transport.c | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'quantum/split_common/transport.c') diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index 6856b60558..ae0c10b827 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -32,7 +32,16 @@ typedef struct _I2C_slave_buffer_t { uint32_t sync_timer; # endif matrix_row_t smatrix[ROWS_PER_HAND]; +# ifdef SPLIT_MODS_ENABLE + uint8_t real_mods; + uint8_t weak_mods; +# ifndef NO_ACTION_ONESHOT + uint8_t oneshot_mods; +# endif +# endif +# ifdef BACKLIGHT_ENABLE uint8_t backlight_level; +# endif # if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) rgblight_syncinfo_t rgblight_sync; # endif @@ -46,6 +55,10 @@ typedef struct _I2C_slave_buffer_t { static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; +# define I2C_KEYMAP_START offsetof(I2C_slave_buffer_t, smatrix) +# define I2C_REAL_MODS_START offsetof(I2C_slave_buffer_t, real_mods) +# define I2C_WEAK_MODS_START offsetof(I2C_slave_buffer_t, weak_mods) +# define I2C_ONESHOT_MODS_START offsetof(I2C_slave_buffer_t, oneshot_mods) # define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level) # define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) # define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer) @@ -97,6 +110,31 @@ bool transport_master(matrix_row_t matrix[]) { } # endif +# ifdef SPLIT_MODS_ENABLE + uint8_t real_mods = get_mods(); + if (real_mods != i2c_buffer->real_mods) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_REAL_MODS_START, (void *)&real_mods, sizeof(real_mods), TIMEOUT) >= 0) { + i2c_buffer->real_mods = real_mods; + } + } + + uint8_t weak_mods = get_weak_mods(); + if (weak_mods != i2c_buffer->weak_mods) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_WEAK_MODS_START, (void *)&weak_mods, sizeof(weak_mods), TIMEOUT) >= 0) { + i2c_buffer->weak_mods = weak_mods; + } + } + +# ifndef NO_ACTION_ONESHOT + uint8_t oneshot_mods = get_oneshot_mods(); + if (oneshot_mods != i2c_buffer->oneshot_mods) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_ONESHOT_MODS_START, (void *)&oneshot_mods, sizeof(oneshot_mods), TIMEOUT) >= 0) { + i2c_buffer->oneshot_mods = oneshot_mods; + } + } +# endif +# endif + # ifndef DISABLE_SYNC_TIMER i2c_buffer->sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_SYNC_TIME_START, (void *)&i2c_buffer->sync_timer, sizeof(i2c_buffer->sync_timer), TIMEOUT); @@ -131,6 +169,14 @@ void transport_slave(matrix_row_t matrix[]) { # ifdef WPM_ENABLE set_current_wpm(i2c_buffer->current_wpm); # endif + +# ifdef SPLIT_MODS_ENABLE + set_mods(i2c_buffer->real_mods); + set_weak_mods(i2c_buffer->weak_mods); +# ifndef NO_ACTION_ONESHOT + set_oneshot_mods(i2c_buffer->oneshot_mods); +# endif +# endif } void transport_master_init(void) { i2c_init(); } @@ -152,6 +198,13 @@ typedef struct _Serial_s2m_buffer_t { } Serial_s2m_buffer_t; typedef struct _Serial_m2s_buffer_t { +# ifdef SPLIT_MODS_ENABLE + uint8_t real_mods; + uint8_t weak_mods; +# ifndef NO_ACTION_ONESHOT + uint8_t oneshot_mods; +# endif +# endif # ifndef DISABLE_SYNC_TIMER uint32_t sync_timer; # endif @@ -268,6 +321,13 @@ bool transport_master(matrix_row_t matrix[]) { serial_m2s_buffer.current_wpm = get_current_wpm(); # endif +# ifdef SPLIT_MODS_ENABLE + serial_m2s_buffer.real_mods = get_mods(); + serial_m2s_buffer.weak_mods = get_weak_mods(); +# ifndef NO_ACTION_ONESHOT + serial_m2s_buffer.oneshot_mods = get_oneshot_mods(); +# endif +# endif # ifndef DISABLE_SYNC_TIMER serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; # endif @@ -295,6 +355,14 @@ void transport_slave(matrix_row_t matrix[]) { # ifdef WPM_ENABLE set_current_wpm(serial_m2s_buffer.current_wpm); # endif + +# ifdef SPLIT_MODS_ENABLE + set_mods(serial_m2s_buffer.real_mods); + set_weak_mods(serial_m2s_buffer.weak_mods); +# ifndef NO_ACTION_ONESHOT + set_oneshot_mods(serial_m2s_buffer.oneshot_mods); +# endif +# endif } #endif -- cgit v1.2.1 From 115b60b0e11f8661385b2219ce5ddbf2982b1f8c Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 18 Dec 2020 02:49:24 +1100 Subject: Fix duplicate I2C_KEYMAP_START define (#11237) --- quantum/split_common/transport.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'quantum/split_common/transport.c') diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index ae0c10b827..e601fb4df5 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -55,14 +55,13 @@ typedef struct _I2C_slave_buffer_t { static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; +# define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer) # define I2C_KEYMAP_START offsetof(I2C_slave_buffer_t, smatrix) # define I2C_REAL_MODS_START offsetof(I2C_slave_buffer_t, real_mods) # define I2C_WEAK_MODS_START offsetof(I2C_slave_buffer_t, weak_mods) # define I2C_ONESHOT_MODS_START offsetof(I2C_slave_buffer_t, oneshot_mods) # define I2C_BACKLIGHT_START offsetof(I2C_slave_buffer_t, backlight_level) # define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) -# define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer) -# define I2C_KEYMAP_START offsetof(I2C_slave_buffer_t, smatrix) # define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state) # define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm) -- cgit v1.2.1 From 31c57aab35e6fd49c4c8336f449419afe7630e93 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Mon, 18 Jan 2021 05:12:15 +1100 Subject: `qmk cformat` --- quantum/split_common/transport.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'quantum/split_common/transport.c') diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index e601fb4df5..b45ba92c3b 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -40,7 +40,7 @@ typedef struct _I2C_slave_buffer_t { # endif # endif # ifdef BACKLIGHT_ENABLE - uint8_t backlight_level; + uint8_t backlight_level; # endif # if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) rgblight_syncinfo_t rgblight_sync; @@ -172,9 +172,9 @@ void transport_slave(matrix_row_t matrix[]) { # ifdef SPLIT_MODS_ENABLE set_mods(i2c_buffer->real_mods); set_weak_mods(i2c_buffer->weak_mods); -# ifndef NO_ACTION_ONESHOT +# ifndef NO_ACTION_ONESHOT set_oneshot_mods(i2c_buffer->oneshot_mods); -# endif +# endif # endif } @@ -191,27 +191,27 @@ typedef struct _Serial_s2m_buffer_t { matrix_row_t smatrix[ROWS_PER_HAND]; # ifdef ENCODER_ENABLE - uint8_t encoder_state[NUMBER_OF_ENCODERS]; + uint8_t encoder_state[NUMBER_OF_ENCODERS]; # endif } Serial_s2m_buffer_t; typedef struct _Serial_m2s_buffer_t { # ifdef SPLIT_MODS_ENABLE - uint8_t real_mods; - uint8_t weak_mods; + uint8_t real_mods; + uint8_t weak_mods; # ifndef NO_ACTION_ONESHOT - uint8_t oneshot_mods; + uint8_t oneshot_mods; # endif # endif # ifndef DISABLE_SYNC_TIMER uint32_t sync_timer; # endif # ifdef BACKLIGHT_ENABLE - uint8_t backlight_level; + uint8_t backlight_level; # endif # ifdef WPM_ENABLE - uint8_t current_wpm; + uint8_t current_wpm; # endif } Serial_m2s_buffer_t; @@ -317,18 +317,18 @@ bool transport_master(matrix_row_t matrix[]) { # ifdef WPM_ENABLE // Write wpm to slave - serial_m2s_buffer.current_wpm = get_current_wpm(); + serial_m2s_buffer.current_wpm = get_current_wpm(); # endif # ifdef SPLIT_MODS_ENABLE - serial_m2s_buffer.real_mods = get_mods(); - serial_m2s_buffer.weak_mods = get_weak_mods(); + serial_m2s_buffer.real_mods = get_mods(); + serial_m2s_buffer.weak_mods = get_weak_mods(); # ifndef NO_ACTION_ONESHOT serial_m2s_buffer.oneshot_mods = get_oneshot_mods(); # endif # endif # ifndef DISABLE_SYNC_TIMER - serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; + serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; # endif return true; } -- cgit v1.2.1 From d1806a26e4ad75fa0e0405283803eba22c1a49ba Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Mon, 15 Feb 2021 18:30:33 -0600 Subject: Split transport mirror (#11046) * Split transport mirror support * Updated RGB Matrix to respond to electrical events instead of key events * split matrix slave fix --- quantum/split_common/transport.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'quantum/split_common/transport.c') diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index b45ba92c3b..977b5dc33e 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -30,6 +30,9 @@ static pin_t encoders_pad[] = ENCODERS_PAD_A; typedef struct _I2C_slave_buffer_t { # ifndef DISABLE_SYNC_TIMER uint32_t sync_timer; +# endif +# ifdef SPLIT_TRANSPORT_MIRROR + matrix_row_t mmatrix[ROWS_PER_HAND]; # endif matrix_row_t smatrix[ROWS_PER_HAND]; # ifdef SPLIT_MODS_ENABLE @@ -56,7 +59,8 @@ typedef struct _I2C_slave_buffer_t { static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; # define I2C_SYNC_TIME_START offsetof(I2C_slave_buffer_t, sync_timer) -# define I2C_KEYMAP_START offsetof(I2C_slave_buffer_t, smatrix) +# define I2C_KEYMAP_MASTER_START offsetof(I2C_slave_buffer_t, mmatrix) +# define I2C_KEYMAP_SLAVE_START offsetof(I2C_slave_buffer_t, smatrix) # define I2C_REAL_MODS_START offsetof(I2C_slave_buffer_t, real_mods) # define I2C_WEAK_MODS_START offsetof(I2C_slave_buffer_t, weak_mods) # define I2C_ONESHOT_MODS_START offsetof(I2C_slave_buffer_t, oneshot_mods) @@ -72,8 +76,11 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re # endif // Get rows from other half over i2c -bool transport_master(matrix_row_t matrix[]) { - i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_START, (void *)matrix, sizeof(i2c_buffer->smatrix), TIMEOUT); +bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_SLAVE_START, (void *)slave_matrix, sizeof(i2c_buffer->smatrix), TIMEOUT); +#ifdef SPLIT_TRANSPORT_MIRROR + i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_MASTER_START, (void *)master_matrix, sizeof(i2c_buffer->mmatrix), TIMEOUT); +#endif // write backlight info # ifdef BACKLIGHT_ENABLE @@ -141,12 +148,15 @@ bool transport_master(matrix_row_t matrix[]) { return true; } -void transport_slave(matrix_row_t matrix[]) { +void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { # ifndef DISABLE_SYNC_TIMER sync_timer_update(i2c_buffer->sync_timer); # endif // Copy matrix to I2C buffer - memcpy((void *)i2c_buffer->smatrix, (void *)matrix, sizeof(i2c_buffer->smatrix)); + memcpy((void*)i2c_buffer->smatrix, (void *)slave_matrix, sizeof(i2c_buffer->smatrix)); +#ifdef SPLIT_TRANSPORT_MIRROR + memcpy((void*)master_matrix, (void *)i2c_buffer->mmatrix, sizeof(i2c_buffer->mmatrix)); +#endif // Read Backlight Info # ifdef BACKLIGHT_ENABLE @@ -207,6 +217,9 @@ typedef struct _Serial_m2s_buffer_t { # ifndef DISABLE_SYNC_TIMER uint32_t sync_timer; # endif +# ifdef SPLIT_TRANSPORT_MIRROR + matrix_row_t mmatrix[ROWS_PER_HAND]; +# endif # ifdef BACKLIGHT_ENABLE uint8_t backlight_level; # endif @@ -289,7 +302,7 @@ void transport_rgblight_slave(void) { # define transport_rgblight_slave() # endif -bool transport_master(matrix_row_t matrix[]) { +bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { # ifndef SERIAL_USE_MULTI_TRANSACTION if (soft_serial_transaction() != TRANSACTION_END) { return false; @@ -303,7 +316,10 @@ bool transport_master(matrix_row_t matrix[]) { // TODO: if MATRIX_COLS > 8 change to unpack() for (int i = 0; i < ROWS_PER_HAND; ++i) { - matrix[i] = serial_s2m_buffer.smatrix[i]; + slave_matrix[i] = serial_s2m_buffer.smatrix[i]; +#ifdef SPLIT_TRANSPORT_MIRROR + serial_m2s_buffer.mmatrix[i] = master_matrix[i]; +#endif } # ifdef BACKLIGHT_ENABLE @@ -333,7 +349,7 @@ bool transport_master(matrix_row_t matrix[]) { return true; } -void transport_slave(matrix_row_t matrix[]) { +void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { transport_rgblight_slave(); # ifndef DISABLE_SYNC_TIMER sync_timer_update(serial_m2s_buffer.sync_timer); @@ -341,7 +357,10 @@ void transport_slave(matrix_row_t matrix[]) { // TODO: if MATRIX_COLS > 8 change to pack() for (int i = 0; i < ROWS_PER_HAND; ++i) { - serial_s2m_buffer.smatrix[i] = matrix[i]; + serial_s2m_buffer.smatrix[i] = slave_matrix[i]; +#ifdef SPLIT_TRANSPORT_MIRROR + master_matrix[i] = serial_m2s_buffer.mmatrix[i]; +#endif } # ifdef BACKLIGHT_ENABLE backlight_set(serial_m2s_buffer.backlight_level); -- cgit v1.2.1 From b0e161e33d8ec030c6965daa57a76ec70b1a1122 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 16 Feb 2021 11:33:03 +1100 Subject: Format code according to conventions (#11928) Co-authored-by: QMK Bot --- quantum/split_common/transport.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'quantum/split_common/transport.c') diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index 977b5dc33e..61b61ea08c 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -78,9 +78,9 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re // Get rows from other half over i2c bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_SLAVE_START, (void *)slave_matrix, sizeof(i2c_buffer->smatrix), TIMEOUT); -#ifdef SPLIT_TRANSPORT_MIRROR +# ifdef SPLIT_TRANSPORT_MIRROR i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_MASTER_START, (void *)master_matrix, sizeof(i2c_buffer->mmatrix), TIMEOUT); -#endif +# endif // write backlight info # ifdef BACKLIGHT_ENABLE @@ -153,10 +153,10 @@ void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) sync_timer_update(i2c_buffer->sync_timer); # endif // Copy matrix to I2C buffer - memcpy((void*)i2c_buffer->smatrix, (void *)slave_matrix, sizeof(i2c_buffer->smatrix)); -#ifdef SPLIT_TRANSPORT_MIRROR - memcpy((void*)master_matrix, (void *)i2c_buffer->mmatrix, sizeof(i2c_buffer->mmatrix)); -#endif + memcpy((void *)i2c_buffer->smatrix, (void *)slave_matrix, sizeof(i2c_buffer->smatrix)); +# ifdef SPLIT_TRANSPORT_MIRROR + memcpy((void *)master_matrix, (void *)i2c_buffer->mmatrix, sizeof(i2c_buffer->mmatrix)); +# endif // Read Backlight Info # ifdef BACKLIGHT_ENABLE @@ -208,23 +208,23 @@ typedef struct _Serial_s2m_buffer_t { typedef struct _Serial_m2s_buffer_t { # ifdef SPLIT_MODS_ENABLE - uint8_t real_mods; - uint8_t weak_mods; + uint8_t real_mods; + uint8_t weak_mods; # ifndef NO_ACTION_ONESHOT - uint8_t oneshot_mods; + uint8_t oneshot_mods; # endif # endif # ifndef DISABLE_SYNC_TIMER - uint32_t sync_timer; + uint32_t sync_timer; # endif # ifdef SPLIT_TRANSPORT_MIRROR matrix_row_t mmatrix[ROWS_PER_HAND]; # endif # ifdef BACKLIGHT_ENABLE - uint8_t backlight_level; + uint8_t backlight_level; # endif # ifdef WPM_ENABLE - uint8_t current_wpm; + uint8_t current_wpm; # endif } Serial_m2s_buffer_t; @@ -316,10 +316,10 @@ bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) // TODO: if MATRIX_COLS > 8 change to unpack() for (int i = 0; i < ROWS_PER_HAND; ++i) { - slave_matrix[i] = serial_s2m_buffer.smatrix[i]; -#ifdef SPLIT_TRANSPORT_MIRROR + slave_matrix[i] = serial_s2m_buffer.smatrix[i]; +# ifdef SPLIT_TRANSPORT_MIRROR serial_m2s_buffer.mmatrix[i] = master_matrix[i]; -#endif +# endif } # ifdef BACKLIGHT_ENABLE @@ -358,9 +358,9 @@ void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) // TODO: if MATRIX_COLS > 8 change to pack() for (int i = 0; i < ROWS_PER_HAND; ++i) { serial_s2m_buffer.smatrix[i] = slave_matrix[i]; -#ifdef SPLIT_TRANSPORT_MIRROR - master_matrix[i] = serial_m2s_buffer.mmatrix[i]; -#endif +# ifdef SPLIT_TRANSPORT_MIRROR + master_matrix[i] = serial_m2s_buffer.mmatrix[i]; +# endif } # ifdef BACKLIGHT_ENABLE backlight_set(serial_m2s_buffer.backlight_level); -- cgit v1.2.1