Refactor keyboard/keymap use of deprecated `isLeftHand` (#25891)
This commit is contained in:
parent
d420bcad33
commit
f82d4d8680
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
void led_init_ports(void) {
|
void led_init_ports(void) {
|
||||||
// Initialize indicator LEDs to output
|
// Initialize indicator LEDs to output
|
||||||
if (isLeftHand) {
|
if (is_keyboard_left()) {
|
||||||
gpio_set_pin_output(C6);
|
gpio_set_pin_output(C6);
|
||||||
gpio_set_pin_output(B6);
|
gpio_set_pin_output(B6);
|
||||||
gpio_set_pin_output(B5);
|
gpio_set_pin_output(B5);
|
||||||
|
|
@ -36,7 +36,7 @@ void led_init_ports(void) {
|
||||||
//
|
//
|
||||||
// (LEFT) 0 1 2 | 3 4 5 (RIGHT)
|
// (LEFT) 0 1 2 | 3 4 5 (RIGHT)
|
||||||
void led_toggle(uint8_t id, bool on) {
|
void led_toggle(uint8_t id, bool on) {
|
||||||
if (isLeftHand) {
|
if (is_keyboard_left()) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 0:
|
case 0:
|
||||||
// Left hand C6
|
// Left hand C6
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ const char *read_logo(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
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) {
|
bool oled_task_user(void) {
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ const char *read_logo(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
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) {
|
bool oled_task_user(void) {
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ const char *read_logo(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
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) {
|
bool oled_task_user(void) {
|
||||||
|
|
|
||||||
|
|
@ -468,7 +468,7 @@ void keyboard_post_init_user(void) {
|
||||||
user_config.raw = eeconfig_read_user();
|
user_config.raw = eeconfig_read_user();
|
||||||
|
|
||||||
// When USB cable is connected to the left side keyboard, use QWERTY layout by default.
|
// 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);
|
default_layer_set(1UL << _QWERTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ void matrix_init(void) {
|
||||||
split_pre_init();
|
split_pre_init();
|
||||||
|
|
||||||
// Set pinout for right half if pinout for that half is defined
|
// Set pinout for right half if pinout for that half is defined
|
||||||
if (!isLeftHand) {
|
if (!is_keyboard_left()) {
|
||||||
#ifdef DIRECT_PINS_RIGHT
|
#ifdef DIRECT_PINS_RIGHT
|
||||||
const pin_t direct_pins_right[MATRIX_ROWS][MATRIX_COLS] = 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++) {
|
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||||
|
|
@ -205,7 +205,7 @@ void matrix_init(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
thisHand = isLeftHand ? 0 : (ROWS_PER_HAND);
|
thisHand = is_keyboard_left() ? 0 : (ROWS_PER_HAND);
|
||||||
thatHand = ROWS_PER_HAND - thisHand;
|
thatHand = ROWS_PER_HAND - thisHand;
|
||||||
|
|
||||||
// initialize key pins
|
// initialize key pins
|
||||||
|
|
|
||||||
|
|
@ -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. */
|
/* Update the layer and LED state if necessary. */
|
||||||
|
|
||||||
if (!isLeftHand) {
|
if (!is_keyboard_left()) {
|
||||||
if (context.led_state.raw != new_context.led_state.raw) {
|
if (context.led_state.raw != new_context.led_state.raw) {
|
||||||
context.led_state.raw = new_context.led_state.raw;
|
context.led_state.raw = new_context.led_state.raw;
|
||||||
led_update_kb(context.led_state);
|
led_update_kb(context.led_state);
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,11 @@ void matrix_init_kb(void) {
|
||||||
matrix_init_user();
|
matrix_init_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool led_update_kb(led_t led_state) {
|
void led_update_ports(led_t led_state) {
|
||||||
// Only update if left half
|
// 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);
|
gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,11 @@ void matrix_init_kb(void) {
|
||||||
matrix_init_user();
|
matrix_init_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool led_update_kb(led_t led_state) {
|
void led_update_ports(led_t led_state) {
|
||||||
// Only update if left half
|
// 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);
|
gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,11 @@ void matrix_init_kb(void) {
|
||||||
matrix_init_user();
|
matrix_init_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool led_update_kb(led_t led_state) {
|
void led_update_ports(led_t led_state) {
|
||||||
// Only update if left half
|
// 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);
|
gpio_write_pin(CAPS_LOCK_LED_PIN, !led_state.caps_lock);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "split_util.h"
|
#include "split_util.h"
|
||||||
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef LED_CAPS_LOCK_PIN
|
||||||
bool led_update_kb(led_t led_state) {
|
void led_update_ports(led_t led_state) {
|
||||||
if (!led_update_user(led_state)) { return false; }
|
|
||||||
// Only update if left half
|
// 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);
|
gpio_write_pin(LED_CAPS_LOCK_PIN, !led_state.caps_lock);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,9 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "matrix.h"
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "matrix.h"
|
||||||
|
#include "keyboard.h"
|
||||||
#include "split_util.h"
|
#include "split_util.h"
|
||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
|
|
||||||
|
|
@ -51,7 +52,7 @@ static void init_pins(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set extended pin (only on right side)
|
// Set extended pin (only on right side)
|
||||||
if (!isLeftHand) {
|
if (!is_keyboard_left()) {
|
||||||
// Set extended pin to input, pullup
|
// Set extended pin to input, pullup
|
||||||
gpio_set_pin_input_high(MATRIX_EXT_PIN_RIGHT);
|
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[]) {
|
static void read_ext_pin(matrix_row_t current_matrix[]) {
|
||||||
// Read the state of the extended matrix pin
|
// Read the state of the extended matrix pin
|
||||||
if (!isLeftHand) {
|
if (!is_keyboard_left()) {
|
||||||
if (gpio_read_pin(MATRIX_EXT_PIN_RIGHT) == 0) {
|
if (gpio_read_pin(MATRIX_EXT_PIN_RIGHT) == 0) {
|
||||||
current_matrix[EXT_PIN_ROW] |= (COL_SHIFTER << EXT_PIN_COL);
|
current_matrix[EXT_PIN_ROW] |= (COL_SHIFTER << EXT_PIN_COL);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -91,7 +92,7 @@ static void read_ext_pin(matrix_row_t current_matrix[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_init_custom(void) {
|
void matrix_init_custom(void) {
|
||||||
if (!isLeftHand) {
|
if (!is_keyboard_left()) {
|
||||||
row_pins = row_pins_right;
|
row_pins = row_pins_right;
|
||||||
col_pins = col_pins_right;
|
col_pins = col_pins_right;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
// Handle RGB Encoder switch press
|
// 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ void matrix_init_custom(void) {
|
||||||
|
|
||||||
ecsm_init(&ecsm_config);
|
ecsm_init(&ecsm_config);
|
||||||
|
|
||||||
thisHand = isLeftHand ? 0 : (ROWS_PER_HAND);
|
thisHand = is_keyboard_left() ? 0 : (ROWS_PER_HAND);
|
||||||
thatHand = ROWS_PER_HAND - thisHand;
|
thatHand = ROWS_PER_HAND - thisHand;
|
||||||
|
|
||||||
split_post_init();
|
split_post_init();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue