diff --git a/drivers/encoder/encoder_quadrature.c b/drivers/encoder/encoder_quadrature.c
index 3dfdb27e8d0..b3aeb136b2f 100644
--- a/drivers/encoder/encoder_quadrature.c
+++ b/drivers/encoder/encoder_quadrature.c
@@ -27,8 +27,6 @@
# define ENCODER_DEFAULT_PIN_API_IMPL
#endif
-extern volatile bool isLeftHand;
-
__attribute__((weak)) void encoder_quadrature_init_pin(uint8_t index, bool pad_b);
__attribute__((weak)) uint8_t encoder_quadrature_read_pin(uint8_t index, bool pad_b);
@@ -108,10 +106,10 @@ void encoder_quadrature_post_init(void) {
void encoder_driver_init(void) {
#ifdef SPLIT_KEYBOARD
- thisHand = isLeftHand ? 0 : NUM_ENCODERS_LEFT;
+ thisHand = is_keyboard_left() ? 0 : NUM_ENCODERS_LEFT;
thatHand = NUM_ENCODERS_LEFT - thisHand;
- thisCount = isLeftHand ? NUM_ENCODERS_LEFT : NUM_ENCODERS_RIGHT;
- thatCount = isLeftHand ? NUM_ENCODERS_RIGHT : NUM_ENCODERS_LEFT;
+ thisCount = is_keyboard_left() ? NUM_ENCODERS_LEFT : NUM_ENCODERS_RIGHT;
+ thatCount = is_keyboard_left() ? NUM_ENCODERS_RIGHT : NUM_ENCODERS_LEFT;
#else // SPLIT_KEYBOARD
thisCount = NUM_ENCODERS;
#endif
@@ -133,7 +131,7 @@ void encoder_driver_init(void) {
#if defined(SPLIT_KEYBOARD) && defined(ENCODER_A_PINS_RIGHT) && defined(ENCODER_B_PINS_RIGHT)
// Re-initialise the pads if it's the right-hand side
- if (!isLeftHand) {
+ if (!is_keyboard_left()) {
const pin_t encoders_pad_a_right[] = ENCODER_A_PINS_RIGHT;
const pin_t encoders_pad_b_right[] = ENCODER_B_PINS_RIGHT;
for (uint8_t i = 0; i < thisCount; i++) {
diff --git a/keyboards/ai03/orbit/orbit.c b/keyboards/ai03/orbit/orbit.c
index 0c1e0dc32ee..dce16e4cc1c 100644
--- a/keyboards/ai03/orbit/orbit.c
+++ b/keyboards/ai03/orbit/orbit.c
@@ -18,7 +18,7 @@
void led_init_ports(void) {
// Initialize indicator LEDs to output
- if (isLeftHand) {
+ if (is_keyboard_left()) {
gpio_set_pin_output(C6);
gpio_set_pin_output(B6);
gpio_set_pin_output(B5);
@@ -36,7 +36,7 @@ void led_init_ports(void) {
//
// (LEFT) 0 1 2 | 3 4 5 (RIGHT)
void led_toggle(uint8_t id, bool on) {
- if (isLeftHand) {
+ if (is_keyboard_left()) {
switch (id) {
case 0:
// Left hand C6
diff --git a/keyboards/basekeys/slice/keymaps/default/keymap.c b/keyboards/basekeys/slice/keymaps/default/keymap.c
index a407d35ab79..b168bcd2478 100644
--- a/keyboards/basekeys/slice/keymaps/default/keymap.c
+++ b/keyboards/basekeys/slice/keymaps/default/keymap.c
@@ -115,7 +115,7 @@ const char *read_logo(void) {
}
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
- return isLeftHand ? OLED_ROTATION_180 : OLED_ROTATION_0;
+ return is_keyboard_left() ? OLED_ROTATION_180 : OLED_ROTATION_0;
}
bool oled_task_user(void) {
diff --git a/keyboards/basekeys/slice/keymaps/default_split_left_space/keymap.c b/keyboards/basekeys/slice/keymaps/default_split_left_space/keymap.c
index 7d4133a99b3..6a87f522689 100644
--- a/keyboards/basekeys/slice/keymaps/default_split_left_space/keymap.c
+++ b/keyboards/basekeys/slice/keymaps/default_split_left_space/keymap.c
@@ -115,7 +115,7 @@ const char *read_logo(void) {
}
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
- return isLeftHand ? OLED_ROTATION_180 : OLED_ROTATION_0;
+ return is_keyboard_left() ? OLED_ROTATION_180 : OLED_ROTATION_0;
}
bool oled_task_user(void) {
diff --git a/keyboards/basekeys/slice/rev1_rgb/keymaps/2moons_rgb/keymap.c b/keyboards/basekeys/slice/rev1_rgb/keymaps/2moons_rgb/keymap.c
index bd7923b36bd..3e3ccb5376f 100644
--- a/keyboards/basekeys/slice/rev1_rgb/keymaps/2moons_rgb/keymap.c
+++ b/keyboards/basekeys/slice/rev1_rgb/keymaps/2moons_rgb/keymap.c
@@ -199,7 +199,7 @@ const char *read_logo(void) {
}
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
- return isLeftHand ? OLED_ROTATION_180 : OLED_ROTATION_0;
+ return is_keyboard_left() ? OLED_ROTATION_180 : OLED_ROTATION_0;
}
bool oled_task_user(void) {
diff --git a/keyboards/giabalanai/keymaps/2firmware/keymap.c b/keyboards/giabalanai/keymaps/2firmware/keymap.c
index f60d1d07e03..9aa7fbc611f 100644
--- a/keyboards/giabalanai/keymaps/2firmware/keymap.c
+++ b/keyboards/giabalanai/keymaps/2firmware/keymap.c
@@ -468,7 +468,7 @@ void keyboard_post_init_user(void) {
user_config.raw = eeconfig_read_user();
// When USB cable is connected to the left side keyboard, use QWERTY layout by default.
- if (is_keyboard_master() && isLeftHand) {
+ if (is_keyboard_master() && is_keyboard_left()) {
default_layer_set(1UL << _QWERTY);
}
diff --git a/keyboards/halfcliff/matrix.c b/keyboards/halfcliff/matrix.c
index fc9d437a450..05073908fae 100644
--- a/keyboards/halfcliff/matrix.c
+++ b/keyboards/halfcliff/matrix.c
@@ -182,7 +182,7 @@ void matrix_init(void) {
split_pre_init();
// Set pinout for right half if pinout for that half is defined
- if (!isLeftHand) {
+ if (!is_keyboard_left()) {
#ifdef DIRECT_PINS_RIGHT
const pin_t direct_pins_right[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS_RIGHT;
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
@@ -205,7 +205,7 @@ void matrix_init(void) {
#endif
}
- thisHand = isLeftHand ? 0 : (ROWS_PER_HAND);
+ thisHand = is_keyboard_left() ? 0 : (ROWS_PER_HAND);
thatHand = ROWS_PER_HAND - thisHand;
// initialize key pins
diff --git a/keyboards/handwired/lagrange/transport.c b/keyboards/handwired/lagrange/transport.c
index 3ff2e9f409e..ef0006172d4 100644
--- a/keyboards/handwired/lagrange/transport.c
+++ b/keyboards/handwired/lagrange/transport.c
@@ -158,7 +158,7 @@ void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[])
/* Update the layer and LED state if necessary. */
- if (!isLeftHand) {
+ if (!is_keyboard_left()) {
if (context.led_state.raw != new_context.led_state.raw) {
context.led_state.raw = new_context.led_state.raw;
led_update_kb(context.led_state);
diff --git a/keyboards/keebio/kbo5000/rev1/rev1.c b/keyboards/keebio/kbo5000/rev1/rev1.c
index 1fd1b9b905b..f2c98da111c 100644
--- a/keyboards/keebio/kbo5000/rev1/rev1.c
+++ b/keyboards/keebio/kbo5000/rev1/rev1.c
@@ -9,12 +9,11 @@ void matrix_init_kb(void) {
matrix_init_user();
}
-bool led_update_kb(led_t led_state) {
+void led_update_ports(led_t led_state) {
// Only update if left half
- if (isLeftHand && led_update_user(led_state)) {
+ if (is_keyboard_left()) {
gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock);
}
- return true;
}
bool encoder_update_kb(uint8_t index, bool clockwise) {
diff --git a/keyboards/keebio/quefrency/rev2/rev2.c b/keyboards/keebio/quefrency/rev2/rev2.c
index 63a02ee20b2..992f621ef68 100644
--- a/keyboards/keebio/quefrency/rev2/rev2.c
+++ b/keyboards/keebio/quefrency/rev2/rev2.c
@@ -9,12 +9,11 @@ void matrix_init_kb(void) {
matrix_init_user();
}
-bool led_update_kb(led_t led_state) {
+void led_update_ports(led_t led_state) {
// Only update if left half
- if (isLeftHand && led_update_user(led_state)) {
+ if (is_keyboard_left()) {
gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock);
}
- return true;
}
#ifdef ENCODER_ENABLE
diff --git a/keyboards/keebio/quefrency/rev3/rev3.c b/keyboards/keebio/quefrency/rev3/rev3.c
index 3e61e07928f..82fb2678794 100644
--- a/keyboards/keebio/quefrency/rev3/rev3.c
+++ b/keyboards/keebio/quefrency/rev3/rev3.c
@@ -22,12 +22,11 @@ void matrix_init_kb(void) {
matrix_init_user();
}
-bool led_update_kb(led_t led_state) {
+void led_update_ports(led_t led_state) {
// Only update if left half
- if (led_update_user(led_state) && isLeftHand) {
+ if (is_keyboard_left()) {
gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock);
}
- return true;
}
#ifdef ENCODER_ENABLE
diff --git a/keyboards/keebio/sinc/sinc.c b/keyboards/keebio/sinc/sinc.c
index faa3540af9a..102ede7cff2 100644
--- a/keyboards/keebio/sinc/sinc.c
+++ b/keyboards/keebio/sinc/sinc.c
@@ -17,14 +17,12 @@ along with this program. If not, see .
#include "quantum.h"
#include "split_util.h"
-#ifdef BACKLIGHT_ENABLE
-bool led_update_kb(led_t led_state) {
- if (!led_update_user(led_state)) { return false; }
+#ifdef LED_CAPS_LOCK_PIN
+void led_update_ports(led_t led_state) {
// Only update if left half
- if (isLeftHand && led_update_user(led_state)) {
+ if (is_keyboard_left()) {
gpio_write_pin(LED_CAPS_LOCK_PIN, !led_state.caps_lock);
}
- return true;
}
#endif
diff --git a/keyboards/nullbitsco/snap/matrix.c b/keyboards/nullbitsco/snap/matrix.c
index 64b451641d3..94716d40324 100644
--- a/keyboards/nullbitsco/snap/matrix.c
+++ b/keyboards/nullbitsco/snap/matrix.c
@@ -13,8 +13,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-#include "matrix.h"
#include
+#include "matrix.h"
+#include "keyboard.h"
#include "split_util.h"
#include "wait.h"
@@ -51,7 +52,7 @@ static void init_pins(void) {
}
// Set extended pin (only on right side)
- if (!isLeftHand) {
+ if (!is_keyboard_left()) {
// Set extended pin to input, pullup
gpio_set_pin_input_high(MATRIX_EXT_PIN_RIGHT);
}
@@ -81,7 +82,7 @@ static void read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
static void read_ext_pin(matrix_row_t current_matrix[]) {
// Read the state of the extended matrix pin
- if (!isLeftHand) {
+ if (!is_keyboard_left()) {
if (gpio_read_pin(MATRIX_EXT_PIN_RIGHT) == 0) {
current_matrix[EXT_PIN_ROW] |= (COL_SHIFTER << EXT_PIN_COL);
} else {
@@ -91,7 +92,7 @@ static void read_ext_pin(matrix_row_t current_matrix[]) {
}
void matrix_init_custom(void) {
- if (!isLeftHand) {
+ if (!is_keyboard_left()) {
row_pins = row_pins_right;
col_pins = col_pins_right;
}
diff --git a/keyboards/rgbkb/sol3/rev1/rev1.c b/keyboards/rgbkb/sol3/rev1/rev1.c
index 96402f851ce..afe0ef17f64 100644
--- a/keyboards/rgbkb/sol3/rev1/rev1.c
+++ b/keyboards/rgbkb/sol3/rev1/rev1.c
@@ -43,7 +43,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
}
case 1: {
// Handle RGB Encoder switch press
- action_exec(MAKE_KEYEVENT(isLeftHand ? 4 : 10, 6, active));
+ action_exec(MAKE_KEYEVENT(is_keyboard_left() ? 4 : 10, 6, active));
break;
}
}
diff --git a/keyboards/sekigon/grs_70ec/matrix.c b/keyboards/sekigon/grs_70ec/matrix.c
index 718423e57b9..cd582b30e48 100644
--- a/keyboards/sekigon/grs_70ec/matrix.c
+++ b/keyboards/sekigon/grs_70ec/matrix.c
@@ -52,7 +52,7 @@ void matrix_init_custom(void) {
ecsm_init(&ecsm_config);
- thisHand = isLeftHand ? 0 : (ROWS_PER_HAND);
+ thisHand = is_keyboard_left() ? 0 : (ROWS_PER_HAND);
thatHand = ROWS_PER_HAND - thisHand;
split_post_init();
diff --git a/quantum/dip_switch.c b/quantum/dip_switch.c
index 65ae21175b4..f662a0e7fc9 100644
--- a/quantum/dip_switch.c
+++ b/quantum/dip_switch.c
@@ -21,6 +21,7 @@
#include "dip_switch.h"
#ifdef SPLIT_KEYBOARD
+# include "keyboard.h"
# include "split_common/split_util.h"
#endif
@@ -87,7 +88,7 @@ static void dip_switch_exec_mapping(uint8_t index, bool on) {
void dip_switch_init(void) {
#ifdef DIP_SWITCH_PINS
# if defined(SPLIT_KEYBOARD) && defined(DIP_SWITCH_PINS_RIGHT)
- if (!isLeftHand) {
+ if (!is_keyboard_left()) {
const pin_t dip_switch_pad_right[] = DIP_SWITCH_PINS_RIGHT;
for (uint8_t i = 0; i < NUM_DIP_SWITCHES; i++) {
dip_switch_pad[i] = dip_switch_pad_right[i];
diff --git a/quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp b/quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp
index 7d6b3e30e6b..590bd2e9f43 100644
--- a/quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp
@@ -41,6 +41,10 @@ bool is_keyboard_master(void) {
return isMaster;
}
+bool is_keyboard_left(void) {
+ return isLeftHand;
+}
+
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!is_keyboard_master()) {
// this method has no effect on slave half
diff --git a/quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp b/quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp
index 2beb4e39720..e6f4db2636d 100644
--- a/quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp
@@ -41,6 +41,10 @@ bool is_keyboard_master(void) {
return isMaster;
}
+bool is_keyboard_left(void) {
+ return isLeftHand;
+}
+
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!is_keyboard_master()) {
// this method has no effect on slave half
diff --git a/quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp b/quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp
index 5612f8b6589..c155f1269ab 100644
--- a/quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp
@@ -41,6 +41,10 @@ bool is_keyboard_master(void) {
return isMaster;
}
+bool is_keyboard_left(void) {
+ return isLeftHand;
+}
+
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!is_keyboard_master()) {
// this method has no effect on slave half
diff --git a/quantum/encoder/tests/encoder_tests_split_no_left.cpp b/quantum/encoder/tests/encoder_tests_split_no_left.cpp
index 980e4074ffd..75244b94a27 100644
--- a/quantum/encoder/tests/encoder_tests_split_no_left.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_no_left.cpp
@@ -41,6 +41,10 @@ bool is_keyboard_master(void) {
return isMaster;
}
+bool is_keyboard_left(void) {
+ return isLeftHand;
+}
+
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!is_keyboard_master()) {
// this method has no effect on slave half
diff --git a/quantum/encoder/tests/encoder_tests_split_no_right.cpp b/quantum/encoder/tests/encoder_tests_split_no_right.cpp
index d39659853b2..bde6e1c29dd 100644
--- a/quantum/encoder/tests/encoder_tests_split_no_right.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_no_right.cpp
@@ -41,6 +41,10 @@ bool is_keyboard_master(void) {
return isMaster;
}
+bool is_keyboard_left(void) {
+ return isLeftHand;
+}
+
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!is_keyboard_master()) {
// this method has no effect on slave half
diff --git a/quantum/encoder/tests/encoder_tests_split_role.cpp b/quantum/encoder/tests/encoder_tests_split_role.cpp
index b588af8c70a..3da6fd6edbf 100644
--- a/quantum/encoder/tests/encoder_tests_split_role.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_role.cpp
@@ -40,6 +40,10 @@ bool is_keyboard_master(void) {
return isMaster;
}
+bool is_keyboard_left(void) {
+ return isLeftHand;
+}
+
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!isMaster) {
ADD_FAILURE() << "We shouldn't get here.";
diff --git a/quantum/matrix.c b/quantum/matrix.c
index e99f7540657..ccedcc3f792 100644
--- a/quantum/matrix.c
+++ b/quantum/matrix.c
@@ -269,7 +269,7 @@ __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[]
void matrix_init(void) {
#ifdef SPLIT_KEYBOARD
// Set pinout for right half if pinout for that half is defined
- if (!isLeftHand) {
+ if (!is_keyboard_left()) {
# ifdef DIRECT_PINS_RIGHT
const pin_t direct_pins_right[MATRIX_ROWS_PER_HAND][MATRIX_COLS] = DIRECT_PINS_RIGHT;
for (uint8_t i = 0; i < MATRIX_ROWS_PER_HAND; i++) {
@@ -292,7 +292,7 @@ void matrix_init(void) {
# endif
}
- thisHand = isLeftHand ? 0 : (MATRIX_ROWS_PER_HAND);
+ thisHand = is_keyboard_left() ? 0 : (MATRIX_ROWS_PER_HAND);
thatHand = MATRIX_ROWS_PER_HAND - thisHand;
#endif
diff --git a/quantum/matrix_common.c b/quantum/matrix_common.c
index 26589f29a64..47669cb6f2b 100644
--- a/quantum/matrix_common.c
+++ b/quantum/matrix_common.c
@@ -144,7 +144,7 @@ __attribute__((weak)) void matrix_slave_scan_user(void) {}
__attribute__((weak)) void matrix_init(void) {
#ifdef SPLIT_KEYBOARD
- thisHand = isLeftHand ? 0 : (MATRIX_ROWS_PER_HAND);
+ thisHand = is_keyboard_left() ? 0 : (MATRIX_ROWS_PER_HAND);
thatHand = MATRIX_ROWS_PER_HAND - thisHand;
#endif