Browse Source

Refactor keyboard/keymap use of deprecated `isLeftHand` (#25891)

Joel Challis 7 months ago
parent
commit
f82d4d8680

+ 2 - 2
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

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 1 - 1
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) {

+ 1 - 1
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);
     }
 

+ 2 - 2
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

+ 1 - 1
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);

+ 2 - 3
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) {

+ 2 - 3
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

+ 2 - 3
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

+ 3 - 5
keyboards/keebio/sinc/sinc.c

@@ -17,14 +17,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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
 

+ 5 - 4
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 <http://www.gnu.org/licenses/>.
  */
-#include "matrix.h"
 #include <string.h>
+#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;
     }

+ 1 - 1
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;
         }
     }

+ 1 - 1
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();