mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-09-27 04:19:11 +02:00
Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
@@ -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++) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user