mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-26 19:11:13 +00:00
Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
commit
f6742693ec
@ -25,10 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#ifdef SPLIT_KEYBOARD
|
#ifdef SPLIT_KEYBOARD
|
||||||
# include "split_common/split_util.h"
|
# include "split_common/split_util.h"
|
||||||
# include "split_common/transactions.h"
|
# include "split_common/transactions.h"
|
||||||
|
|
||||||
# define ROWS_PER_HAND (MATRIX_ROWS / 2)
|
|
||||||
#else
|
|
||||||
# define ROWS_PER_HAND (MATRIX_ROWS)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DIRECT_PINS_RIGHT
|
#ifdef DIRECT_PINS_RIGHT
|
||||||
@ -52,13 +48,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DIRECT_PINS
|
#ifdef DIRECT_PINS
|
||||||
static SPLIT_MUTABLE pin_t direct_pins[ROWS_PER_HAND][MATRIX_COLS] = DIRECT_PINS;
|
static SPLIT_MUTABLE pin_t direct_pins[MATRIX_ROWS_PER_HAND][MATRIX_COLS] = DIRECT_PINS;
|
||||||
#elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
|
#elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
|
||||||
# ifdef MATRIX_ROW_PINS
|
# ifdef MATRIX_ROW_PINS
|
||||||
static SPLIT_MUTABLE_ROW pin_t row_pins[ROWS_PER_HAND] = MATRIX_ROW_PINS;
|
static SPLIT_MUTABLE_ROW pin_t row_pins[MATRIX_ROWS_PER_HAND] = MATRIX_ROW_PINS;
|
||||||
# endif // MATRIX_ROW_PINS
|
# endif // MATRIX_ROW_PINS
|
||||||
# ifdef MATRIX_COL_PINS
|
# ifdef MATRIX_COL_PINS
|
||||||
static SPLIT_MUTABLE_COL pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
static SPLIT_MUTABLE_COL pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||||
# endif // MATRIX_COL_PINS
|
# endif // MATRIX_COL_PINS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -109,7 +105,7 @@ static inline uint8_t readMatrixPin(pin_t pin) {
|
|||||||
#ifdef DIRECT_PINS
|
#ifdef DIRECT_PINS
|
||||||
|
|
||||||
__attribute__((weak)) void matrix_init_pins(void) {
|
__attribute__((weak)) void matrix_init_pins(void) {
|
||||||
for (int row = 0; row < ROWS_PER_HAND; row++) {
|
for (int row = 0; row < MATRIX_ROWS_PER_HAND; row++) {
|
||||||
for (int col = 0; col < MATRIX_COLS; col++) {
|
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||||
pin_t pin = direct_pins[row][col];
|
pin_t pin = direct_pins[row][col];
|
||||||
if (pin != NO_PIN) {
|
if (pin != NO_PIN) {
|
||||||
@ -158,7 +154,7 @@ static void unselect_row(uint8_t row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void unselect_rows(void) {
|
static void unselect_rows(void) {
|
||||||
for (uint8_t x = 0; x < ROWS_PER_HAND; x++) {
|
for (uint8_t x = 0; x < MATRIX_ROWS_PER_HAND; x++) {
|
||||||
unselect_row(x);
|
unselect_row(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +224,7 @@ static void unselect_cols(void) {
|
|||||||
|
|
||||||
__attribute__((weak)) void matrix_init_pins(void) {
|
__attribute__((weak)) void matrix_init_pins(void) {
|
||||||
unselect_cols();
|
unselect_cols();
|
||||||
for (uint8_t x = 0; x < ROWS_PER_HAND; x++) {
|
for (uint8_t x = 0; x < MATRIX_ROWS_PER_HAND; x++) {
|
||||||
if (row_pins[x] != NO_PIN) {
|
if (row_pins[x] != NO_PIN) {
|
||||||
gpio_atomic_set_pin_input_high(row_pins[x]);
|
gpio_atomic_set_pin_input_high(row_pins[x]);
|
||||||
}
|
}
|
||||||
@ -245,7 +241,7 @@ __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[]
|
|||||||
matrix_output_select_delay();
|
matrix_output_select_delay();
|
||||||
|
|
||||||
// For each row...
|
// For each row...
|
||||||
for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) {
|
for (uint8_t row_index = 0; row_index < MATRIX_ROWS_PER_HAND; row_index++) {
|
||||||
// Check row pin state
|
// Check row pin state
|
||||||
if (readMatrixPin(row_pins[row_index]) == 0) {
|
if (readMatrixPin(row_pins[row_index]) == 0) {
|
||||||
// Pin LO, set col bit
|
// Pin LO, set col bit
|
||||||
@ -275,16 +271,16 @@ void matrix_init(void) {
|
|||||||
// 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 (!isLeftHand) {
|
||||||
# ifdef DIRECT_PINS_RIGHT
|
# ifdef DIRECT_PINS_RIGHT
|
||||||
const pin_t direct_pins_right[ROWS_PER_HAND][MATRIX_COLS] = DIRECT_PINS_RIGHT;
|
const pin_t direct_pins_right[MATRIX_ROWS_PER_HAND][MATRIX_COLS] = DIRECT_PINS_RIGHT;
|
||||||
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
|
for (uint8_t i = 0; i < MATRIX_ROWS_PER_HAND; i++) {
|
||||||
for (uint8_t j = 0; j < MATRIX_COLS; j++) {
|
for (uint8_t j = 0; j < MATRIX_COLS; j++) {
|
||||||
direct_pins[i][j] = direct_pins_right[i][j];
|
direct_pins[i][j] = direct_pins_right[i][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# ifdef MATRIX_ROW_PINS_RIGHT
|
# ifdef MATRIX_ROW_PINS_RIGHT
|
||||||
const pin_t row_pins_right[ROWS_PER_HAND] = MATRIX_ROW_PINS_RIGHT;
|
const pin_t row_pins_right[MATRIX_ROWS_PER_HAND] = MATRIX_ROW_PINS_RIGHT;
|
||||||
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
|
for (uint8_t i = 0; i < MATRIX_ROWS_PER_HAND; i++) {
|
||||||
row_pins[i] = row_pins_right[i];
|
row_pins[i] = row_pins_right[i];
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@ -296,8 +292,8 @@ void matrix_init(void) {
|
|||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
thisHand = isLeftHand ? 0 : (ROWS_PER_HAND);
|
thisHand = isLeftHand ? 0 : (MATRIX_ROWS_PER_HAND);
|
||||||
thatHand = ROWS_PER_HAND - thisHand;
|
thatHand = MATRIX_ROWS_PER_HAND - thisHand;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// initialize key pins
|
// initialize key pins
|
||||||
@ -307,7 +303,7 @@ void matrix_init(void) {
|
|||||||
memset(matrix, 0, sizeof(matrix));
|
memset(matrix, 0, sizeof(matrix));
|
||||||
memset(raw_matrix, 0, sizeof(raw_matrix));
|
memset(raw_matrix, 0, sizeof(raw_matrix));
|
||||||
|
|
||||||
debounce_init(ROWS_PER_HAND);
|
debounce_init(MATRIX_ROWS_PER_HAND);
|
||||||
|
|
||||||
matrix_init_kb();
|
matrix_init_kb();
|
||||||
}
|
}
|
||||||
@ -325,7 +321,7 @@ uint8_t matrix_scan(void) {
|
|||||||
|
|
||||||
#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)
|
#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)
|
||||||
// Set row, read cols
|
// Set row, read cols
|
||||||
for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) {
|
for (uint8_t current_row = 0; current_row < MATRIX_ROWS_PER_HAND; current_row++) {
|
||||||
matrix_read_cols_on_row(curr_matrix, current_row);
|
matrix_read_cols_on_row(curr_matrix, current_row);
|
||||||
}
|
}
|
||||||
#elif (DIODE_DIRECTION == ROW2COL)
|
#elif (DIODE_DIRECTION == ROW2COL)
|
||||||
@ -340,9 +336,9 @@ uint8_t matrix_scan(void) {
|
|||||||
if (changed) memcpy(raw_matrix, curr_matrix, sizeof(curr_matrix));
|
if (changed) memcpy(raw_matrix, curr_matrix, sizeof(curr_matrix));
|
||||||
|
|
||||||
#ifdef SPLIT_KEYBOARD
|
#ifdef SPLIT_KEYBOARD
|
||||||
changed = debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, changed) | matrix_post_scan();
|
changed = debounce(raw_matrix, matrix + thisHand, MATRIX_ROWS_PER_HAND, changed) | matrix_post_scan();
|
||||||
#else
|
#else
|
||||||
changed = debounce(raw_matrix, matrix, ROWS_PER_HAND, changed);
|
changed = debounce(raw_matrix, matrix, MATRIX_ROWS_PER_HAND, changed);
|
||||||
matrix_scan_kb();
|
matrix_scan_kb();
|
||||||
#endif
|
#endif
|
||||||
return (uint8_t)changed;
|
return (uint8_t)changed;
|
||||||
|
@ -35,6 +35,12 @@ typedef uint32_t matrix_row_t;
|
|||||||
# error "MATRIX_COLS: invalid value"
|
# error "MATRIX_COLS: invalid value"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SPLIT_KEYBOARD
|
||||||
|
# define MATRIX_ROWS_PER_HAND (MATRIX_ROWS / 2)
|
||||||
|
#else
|
||||||
|
# define MATRIX_ROWS_PER_HAND (MATRIX_ROWS)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MATRIX_ROW_SHIFTER ((matrix_row_t)1)
|
#define MATRIX_ROW_SHIFTER ((matrix_row_t)1)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -8,10 +8,6 @@
|
|||||||
# include "split_common/split_util.h"
|
# include "split_common/split_util.h"
|
||||||
# include "split_common/transactions.h"
|
# include "split_common/transactions.h"
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
|
|
||||||
# define ROWS_PER_HAND (MATRIX_ROWS / 2)
|
|
||||||
#else
|
|
||||||
# define ROWS_PER_HAND (MATRIX_ROWS)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MATRIX_IO_DELAY
|
#ifndef MATRIX_IO_DELAY
|
||||||
@ -95,8 +91,8 @@ void matrix_print(void) {
|
|||||||
bool matrix_post_scan(void) {
|
bool matrix_post_scan(void) {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
if (is_keyboard_master()) {
|
if (is_keyboard_master()) {
|
||||||
static bool last_connected = false;
|
static bool last_connected = false;
|
||||||
matrix_row_t slave_matrix[ROWS_PER_HAND] = {0};
|
matrix_row_t slave_matrix[MATRIX_ROWS_PER_HAND] = {0};
|
||||||
if (transport_master_if_connected(matrix + thisHand, slave_matrix)) {
|
if (transport_master_if_connected(matrix + thisHand, slave_matrix)) {
|
||||||
changed = memcmp(matrix + thatHand, slave_matrix, sizeof(slave_matrix)) != 0;
|
changed = memcmp(matrix + thatHand, slave_matrix, sizeof(slave_matrix)) != 0;
|
||||||
|
|
||||||
@ -148,8 +144,8 @@ __attribute__((weak)) void matrix_slave_scan_user(void) {}
|
|||||||
|
|
||||||
__attribute__((weak)) void matrix_init(void) {
|
__attribute__((weak)) void matrix_init(void) {
|
||||||
#ifdef SPLIT_KEYBOARD
|
#ifdef SPLIT_KEYBOARD
|
||||||
thisHand = isLeftHand ? 0 : (ROWS_PER_HAND);
|
thisHand = isLeftHand ? 0 : (MATRIX_ROWS_PER_HAND);
|
||||||
thatHand = ROWS_PER_HAND - thisHand;
|
thatHand = MATRIX_ROWS_PER_HAND - thisHand;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
matrix_init_custom();
|
matrix_init_custom();
|
||||||
@ -160,7 +156,7 @@ __attribute__((weak)) void matrix_init(void) {
|
|||||||
matrix[i] = 0;
|
matrix[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
debounce_init(ROWS_PER_HAND);
|
debounce_init(MATRIX_ROWS_PER_HAND);
|
||||||
|
|
||||||
matrix_init_kb();
|
matrix_init_kb();
|
||||||
}
|
}
|
||||||
@ -169,9 +165,9 @@ __attribute__((weak)) uint8_t matrix_scan(void) {
|
|||||||
bool changed = matrix_scan_custom(raw_matrix);
|
bool changed = matrix_scan_custom(raw_matrix);
|
||||||
|
|
||||||
#ifdef SPLIT_KEYBOARD
|
#ifdef SPLIT_KEYBOARD
|
||||||
changed = debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, changed) | matrix_post_scan();
|
changed = debounce(raw_matrix, matrix + thisHand, MATRIX_ROWS_PER_HAND, changed) | matrix_post_scan();
|
||||||
#else
|
#else
|
||||||
changed = debounce(raw_matrix, matrix, ROWS_PER_HAND, changed);
|
changed = debounce(raw_matrix, matrix, MATRIX_ROWS_PER_HAND, changed);
|
||||||
matrix_scan_kb();
|
matrix_scan_kb();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user