Skip to content

Commit

Permalink
Allow invert of SPLIT_HAND_PIN logic (qmk#13433)
Browse files Browse the repository at this point in the history
* added support for inverting the hand pin for split keyboards

* Added docs about SPLIT_HAND_LOW_IS_LEFT

* Update docs/feature_split_keyboard.md

bring #define for split hand pin low for left half name in line with grid pin define

Co-authored-by: Joel Challis <git@zvecr.com>

* Update quantum/split_common/split_util.c

update split hand pin low is left name to match split hand grid define

Co-authored-by: Joel Challis <git@zvecr.com>

Co-authored-by: Joel Challis <git@zvecr.com>
  • Loading branch information
2 people authored and nhongooi committed Dec 5, 2021
1 parent 94d4647 commit 5e945d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/feature_split_keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ You can configure the firmware to read a pin on the controller to determine hand
#define SPLIT_HAND_PIN B7
```
This will read the specified pin. If it's high, then the controller assumes it is the left hand, and if it's low, it's assumed to be the right side.
This will read the specified pin. By default, if it's high, then the controller assumes it is the left hand, and if it's low, it's assumed to be the right side.
This behaviour can be flipped by adding this to you `config.h` file:
```c
#define SPLIT_HAND_PIN_LOW_IS_LEFT
```

#### Handedness by Matrix Pin

Expand Down
4 changes: 4 additions & 0 deletions quantum/split_common/split_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ __attribute__((weak)) bool is_keyboard_left(void) {
#if defined(SPLIT_HAND_PIN)
// Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
setPinInput(SPLIT_HAND_PIN);
# ifdef SPLIT_HAND_PIN_LOW_IS_LEFT
return !readPin(SPLIT_HAND_PIN);
# else
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);
Expand Down

0 comments on commit 5e945d4

Please sign in to comment.