1
0
Fork 0
forked from forks/qmk_firmware

Align SPLIT_HAND_MATRIX_GRID left/right logic with SPLIT_HAND_PIN (#22775)

This commit is contained in:
Joel Challis 2024-01-09 11:24:53 +00:00 committed by GitHub
parent 58806984a6
commit ccec4867c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 19 additions and 17 deletions

View file

@ -275,7 +275,7 @@ There are a few different ways to set handedness for split keyboards (listed in
* For using high/low pin to determine handedness, low = right hand, high = left hand. Replace `B7` with the pin you are using. This is optional, and if you leave `SPLIT_HAND_PIN` undefined, then you can still use the EE_HANDS method or MASTER_LEFT / MASTER_RIGHT defines like the stock Let's Split uses. * For using high/low pin to determine handedness, low = right hand, high = left hand. Replace `B7` with the pin you are using. This is optional, and if you leave `SPLIT_HAND_PIN` undefined, then you can still use the EE_HANDS method or MASTER_LEFT / MASTER_RIGHT defines like the stock Let's Split uses.
* `#define SPLIT_HAND_MATRIX_GRID <out_pin>,<in_pin>` * `#define SPLIT_HAND_MATRIX_GRID <out_pin>,<in_pin>`
* The handedness is determined by using the intersection of the keyswitches in the key matrix, which does not exist. Normally, when this intersection is shorted (level low), it is considered left. If you define `#define SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT`, it is determined to be right when the level is low. * The handedness is determined by using the intersection of the keyswitches in the key matrix, which does not exist. Normally, when this intersection is shorted (level low), it is considered right. If you define `#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT`, it is determined to be left when the level is low.
* `#define EE_HANDS` (only works if `SPLIT_HAND_PIN` and `SPLIT_HAND_MATRIX_GRID` are not defined) * `#define EE_HANDS` (only works if `SPLIT_HAND_PIN` and `SPLIT_HAND_MATRIX_GRID` are not defined)
* Reads the handedness value stored in the EEPROM after `eeprom-lefthand.eep`/`eeprom-righthand.eep` has been flashed to their respective halves. * Reads the handedness value stored in the EEPROM after `eeprom-lefthand.eep`/`eeprom-righthand.eep` has been flashed to their respective halves.

View file

@ -119,12 +119,12 @@ You can configure the firmware to read key matrix pins on the controller to dete
The first pin is the output pin and the second is the input pin. The first pin is the output pin and the second is the input pin.
Some keyboards have unused intersections in the key matrix. This setting uses one of these unused intersections to determine the handness. Some keyboards have unused intersections in the key matrix. This setting uses one of these unused intersections to determine the handedness.
Normally, when a diode is connected to an intersection, it is judged to be left. If you add the following definition, it will be judged to be right. Normally, when a diode is connected to an intersection, it is judged to be right. If you add the following definition, it will be judged to be left.
```c ```c
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT #define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
``` ```
Note that adding a diode at a previously unused intersection will effectively tell the firmware that there is a key held down at that point. You can instruct qmk to ignore that intersection by defining `MATRIX_MASKED` and then defining a `matrix_row_t matrix_mask[MATRIX_ROWS]` array in your keyboard config. Each bit of a single value (starting form the least-significant bit) is used to tell qmk whether or not to pay attention to key presses at that intersection. Note that adding a diode at a previously unused intersection will effectively tell the firmware that there is a key held down at that point. You can instruct qmk to ignore that intersection by defining `MATRIX_MASKED` and then defining a `matrix_row_t matrix_mask[MATRIX_ROWS]` array in your keyboard config. Each bit of a single value (starting form the least-significant bit) is used to tell qmk whether or not to pay attention to key presses at that intersection.

View file

@ -248,7 +248,7 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
* high/low ピンを使って左右を決定します。low = 右手、high = 左手。`B7` を使っているピンに置き換えます。これはオプションで、`SPLIT_HAND_PIN` が未定義のままである場合、EE_HANDS メソッドまたは標準の Let's Splitが使っている MASTER_LEFT / MASTER_RIGHT 定義をまだ使うことができます。 * high/low ピンを使って左右を決定します。low = 右手、high = 左手。`B7` を使っているピンに置き換えます。これはオプションで、`SPLIT_HAND_PIN` が未定義のままである場合、EE_HANDS メソッドまたは標準の Let's Splitが使っている MASTER_LEFT / MASTER_RIGHT 定義をまだ使うことができます。
* `#define SPLIT_HAND_MATRIX_GRID <out_pin>,<in_pin>` * `#define SPLIT_HAND_MATRIX_GRID <out_pin>,<in_pin>`
* 左右はキーマトリックスのキースイッチが存在しない交点を使って決定されます。通常、この交点が短絡している(ローレベル)のときに左側と見なされます。もし `#define SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT` が定義されている場合は、ローレベルの時に右側と決定されます。 * 左右はキーマトリックスのキースイッチが存在しない交点を使って決定されます。通常、この交点が短絡している(ローレベル)のときに右側と見なされます。もし `#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT` が定義されている場合は、ローレベルの時に左側と決定されます。
* `#define EE_HANDS` (`SPLIT_HAND_PIN` と `SPLIT_HAND_MATRIX_GRID` が定義されていない場合のみ動作します) * `#define EE_HANDS` (`SPLIT_HAND_PIN` と `SPLIT_HAND_MATRIX_GRID` が定義されていない場合のみ動作します)
* `eeprom-lefthand.eep`/`eeprom-righthand.eep` がそれぞれの半分に書き込まれた後で、EEPROM 内に格納されている左右の設定の値を読み込みます。 * `eeprom-lefthand.eep`/`eeprom-righthand.eep` がそれぞれの半分に書き込まれた後で、EEPROM 内に格納されている左右の設定の値を読み込みます。

View file

@ -108,10 +108,10 @@ SPLIT_TRANSPORT = custom
キーマトリックスに未使用の交点があるキーボードがあります。この設定は、左右の決定にこれらの未使用の交点の1つを使用します。 キーマトリックスに未使用の交点があるキーボードがあります。この設定は、左右の決定にこれらの未使用の交点の1つを使用します。
通常、ダイオードが交点に接続されている場合、左側と判断されます。次の定義を追加すると、右側と判断されます。 通常、ダイオードが交点に接続されている場合、右側と判断されます。次の定義を追加すると、左側と判断されます。
```c ```c
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT #define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
``` ```
#### EEPROM による左右の設定 #### EEPROM による左右の設定

View file

@ -97,11 +97,11 @@ static enum { UNKNOWN, LEFT, RIGHT } hand_side = UNKNOWN;
hand_side = readPin(SPLIT_HAND_PIN) ? LEFT : RIGHT; hand_side = readPin(SPLIT_HAND_PIN) ? LEFT : RIGHT;
return (hand_side == LEFT); return (hand_side == LEFT);
#elif defined(SPLIT_HAND_MATRIX_GRID) #elif defined(SPLIT_HAND_MATRIX_GRID)
# ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT # ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
hand_side = peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID) ? LEFT : RIGHT; hand_side = peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID) ? RIGHT : LEFT;
return (hand_side == LEFT); return (hand_side == LEFT);
# else # else
hand_side = peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID) ? RIGHT : LEFT; hand_side = peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID) ? LEFT : RIGHT;
return (hand_side == LEFT); return (hand_side == LEFT);
# endif # endif
#elif defined(EE_HANDS) #elif defined(EE_HANDS)

View file

@ -19,6 +19,7 @@
#ifndef MASTER_RIGHT #ifndef MASTER_RIGHT
// SPLIT_HAND_MATRIX_GRID was initially designed to use with left hand side diode D35 mounted and not pressing K7 on the right hand side during boot. However when a USB cable is reconnected immediately, it fails. Decided to use "MASTER_RIGHT" to make it more reliable. // SPLIT_HAND_MATRIX_GRID was initially designed to use with left hand side diode D35 mounted and not pressing K7 on the right hand side during boot. However when a USB cable is reconnected immediately, it fails. Decided to use "MASTER_RIGHT" to make it more reliable.
# define SPLIT_HAND_MATRIX_GRID B5, D0 # define SPLIT_HAND_MATRIX_GRID B5, D0
# define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
#endif #endif
#define SPLIT_USB_DETECT #define SPLIT_USB_DETECT

View file

@ -39,7 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Split hand configration */ /* Split hand configration */
#define SPLIT_HAND_MATRIX_GRID D7,B2 #define SPLIT_HAND_MATRIX_GRID D7,B2
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT
/* Custom font */ /* Custom font */
#define OLED_FONT_H "keyboards/helix/common/glcdfont.c" #define OLED_FONT_H "keyboards/helix/common/glcdfont.c"

View file

@ -39,7 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Split hand configration */ /* Split hand configration */
#define SPLIT_HAND_MATRIX_GRID D7,B2 #define SPLIT_HAND_MATRIX_GRID D7,B2
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT
/* Custom font */ /* Custom font */
#define OLED_FONT_H "keyboards/helix/common/glcdfont.c" #define OLED_FONT_H "keyboards/helix/common/glcdfont.c"

View file

@ -6,6 +6,7 @@
/* Split */ /* Split */
#define SPLIT_HAND_MATRIX_GRID B5, F6 #define SPLIT_HAND_MATRIX_GRID B5, F6
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
#define MATRIX_MASKED #define MATRIX_MASKED
/* Haptic hardware */ /* Haptic hardware */

View file

@ -6,6 +6,7 @@
/* Split */ /* Split */
#define SPLIT_HAND_MATRIX_GRID B5, F6 #define SPLIT_HAND_MATRIX_GRID B5, F6
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
#define MATRIX_MASKED #define MATRIX_MASKED
/* Haptic hardware */ /* Haptic hardware */

View file

@ -22,7 +22,6 @@
/* handedness */ /* handedness */
#define SPLIT_HAND_MATRIX_GRID A2, A15 #define SPLIT_HAND_MATRIX_GRID A2, A15
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT
#define MATRIX_MASKED // actual mask is defined by `matrix_mask` in `q11.c` #define MATRIX_MASKED // actual mask is defined by `matrix_mask` in `q11.c`

View file

@ -18,6 +18,8 @@
/* Select hand configuration */ /* Select hand configuration */
#define SPLIT_HAND_MATRIX_GRID B0,B7 #define SPLIT_HAND_MATRIX_GRID B0,B7
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
#define MATRIX_MASKED #define MATRIX_MASKED
#define SPLIT_USB_DETECT #define SPLIT_USB_DETECT

View file

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Split hand configration */ /* Split hand configration */
#define SPLIT_HAND_MATRIX_GRID D4,D3 #define SPLIT_HAND_MATRIX_GRID D4,D3
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
#define RGBLIGHT_LAYERS #define RGBLIGHT_LAYERS

View file

@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Side detection // Side detection
// col 4 row 3 on right-hand-side // col 4 row 3 on right-hand-side
#define SPLIT_HAND_MATRIX_GRID E6, B3 // row first because the board is col2row #define SPLIT_HAND_MATRIX_GRID E6, B3 // row first because the board is col2row
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT
#define MATRIX_MASKED // actual mask is defined by `matrix_mask` in `rev2.c` #define MATRIX_MASKED // actual mask is defined by `matrix_mask` in `rev2.c`
/* /*

View file

@ -147,10 +147,10 @@ __attribute__((weak)) bool is_keyboard_left_impl(void) {
return readPin(SPLIT_HAND_PIN); return readPin(SPLIT_HAND_PIN);
# endif # endif
#elif defined(SPLIT_HAND_MATRIX_GRID) #elif defined(SPLIT_HAND_MATRIX_GRID)
# ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT # ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
return peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID);
# else
return !peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID); return !peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID);
# else
return peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID);
# endif # endif
#elif defined(EE_HANDS) #elif defined(EE_HANDS)
if (!eeconfig_is_enabled()) { if (!eeconfig_is_enabled()) {