Refactor core use of deprecated isLeftHand (#25888)

This commit is contained in:
Joel Challis
2025-12-21 20:52:55 +00:00
committed by GitHub
parent f82d4d8680
commit c1161a7a32
10 changed files with 33 additions and 10 deletions
+4 -6
View File
@@ -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++) {
+2 -1
View File
@@ -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];
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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.";
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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