Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align SPLIT_HAND_MATRIX_GRID left/right logic with SPLIT_HAND_PIN #22775

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

* `#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)
* Reads the handedness value stored in the EEPROM after `eeprom-lefthand.eep`/`eeprom-righthand.eep` has been flashed to their respective halves.
Expand Down
6 changes: 3 additions & 3 deletions docs/feature_split_keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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
#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.
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
* 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_LOW_IS_RIGHT` が定義されている場合は、ローレベルの時に右側と決定されます
* 左右はキーマトリックスのキースイッチが存在しない交点を使って決定されます。通常、この交点が短絡している(ローレベル)のときに右側と見なされます。もし `#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT` が定義されている場合は、ローレベルの時に左側と決定されます

* `#define EE_HANDS` (`SPLIT_HAND_PIN` と `SPLIT_HAND_MATRIX_GRID` が定義されていない場合のみ動作します)
* `eeprom-lefthand.eep`/`eeprom-righthand.eep` がそれぞれの半分に書き込まれた後で、EEPROM 内に格納されている左右の設定の値を読み込みます。
Expand Down
4 changes: 2 additions & 2 deletions docs/ja/feature_split_keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ SPLIT_TRANSPORT = custom

キーマトリックスに未使用の交点があるキーボードがあります。この設定は、左右の決定にこれらの未使用の交点の1つを使用します。

通常、ダイオードが交点に接続されている場合、左側と判断されます。次の定義を追加すると、右側と判断されます
通常、ダイオードが交点に接続されている場合、右側と判断されます。次の定義を追加すると、左側と判断されます

```c
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
```

#### EEPROM による左右の設定
Expand Down
6 changes: 3 additions & 3 deletions keyboards/bandominedoni/bandominedoni.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ static enum { UNKNOWN, LEFT, RIGHT } hand_side = UNKNOWN;
hand_side = readPin(SPLIT_HAND_PIN) ? LEFT : RIGHT;
return (hand_side == LEFT);
#elif defined(SPLIT_HAND_MATRIX_GRID)
# ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT
hand_side = peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID) ? LEFT : RIGHT;
# ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
hand_side = peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID) ? RIGHT : LEFT;
return (hand_side == LEFT);
# 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);
# endif
#elif defined(EE_HANDS)
Expand Down
1 change: 1 addition & 0 deletions keyboards/bandominedoni/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#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.
# define SPLIT_HAND_MATRIX_GRID B5, D0
# define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
#endif

#define SPLIT_USB_DETECT
Expand Down
1 change: 0 additions & 1 deletion keyboards/helix/rev3_4rows/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Split hand configration */
#define SPLIT_HAND_MATRIX_GRID D7,B2
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT

#ifdef RGB_MATRIX_ENABLE
#define RGB_MATRIX_LED_COUNT 50
Expand Down
1 change: 0 additions & 1 deletion keyboards/helix/rev3_5rows/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Split hand configration */
#define SPLIT_HAND_MATRIX_GRID D7,B2
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT

#ifdef RGB_MATRIX_ENABLE
#define RGB_MATRIX_LED_COUNT 64
Expand Down
1 change: 1 addition & 0 deletions keyboards/hillside/46/0_1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/* Split */
#define SPLIT_HAND_MATRIX_GRID B5, F6
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
#define MATRIX_MASKED

/* Haptic hardware */
Expand Down
1 change: 1 addition & 0 deletions keyboards/hillside/52/0_1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/* Split */
#define SPLIT_HAND_MATRIX_GRID B5, F6
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT
#define MATRIX_MASKED

/* Haptic hardware */
Expand Down
1 change: 0 additions & 1 deletion keyboards/keychron/q11/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

/* handedness */
#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`

Expand Down
2 changes: 2 additions & 0 deletions keyboards/pisces/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

/* Select hand configuration */
#define SPLIT_HAND_MATRIX_GRID B0,B7
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT

#define MATRIX_MASKED
#define SPLIT_USB_DETECT

Expand Down
1 change: 1 addition & 0 deletions keyboards/rate/pistachio/rev2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Split hand configration */
#define SPLIT_HAND_MATRIX_GRID D4,D3
#define SPLIT_HAND_MATRIX_GRID_LOW_IS_LEFT

#define RGBLIGHT_LAYERS

Expand Down
1 change: 0 additions & 1 deletion keyboards/splitkb/kyria/rev2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Side detection
// 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_LOW_IS_RIGHT
#define MATRIX_MASKED // actual mask is defined by `matrix_mask` in `rev2.c`

/*
Expand Down
6 changes: 3 additions & 3 deletions quantum/split_common/split_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ __attribute__((weak)) bool is_keyboard_left_impl(void) {
return readPin(SPLIT_HAND_PIN);
# endif
#elif defined(SPLIT_HAND_MATRIX_GRID)
# ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT
return peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID);
# else
# 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);
# endif
#elif defined(EE_HANDS)
if (!eeconfig_is_enabled()) {
Expand Down