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

helix/rev2 SPLIT_HAND_MATRIX_GRID test #30

Closed
Closed
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
3 changes: 2 additions & 1 deletion keyboards/helix/rev2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define SERIAL_USE_MULTI_TRANSACTION

/* Select hand configuration */
#define MASTER_LEFT
#define SPLIT_HAND_MATRIX_GRID D7,B2
// #define MASTER_LEFT
// #define MASTER_RIGHT
// #define EE_HANDS

Expand Down
26 changes: 26 additions & 0 deletions keyboards/helix/rev2/rev2.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "helix.h"
#include "quantum.h"

// Each keymap.c should use is_keyboard_master() instead of 'is_master'.
// But keep 'is_master' for a while for backwards compatibility
Expand Down Expand Up @@ -39,3 +40,28 @@ void matrix_slave_scan_user(void) {
matrix_scan_user();
}
#endif

#ifdef SPLIT_HAND_MATRIX_GRID

static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) {
setPinInputHigh(in_pin);
setPinOutput(out_pin);
writePinLow(out_pin);
// It's almost unnecessary, but wait until it's down to low, just in case.
wait_us(1);
uint8_t pin_state = readPin(in_pin);
// Set out_pin to a setting that is less susceptible to noise.
setPinInputHigh(out_pin);
wait_us(30);
return pin_state;
}

bool is_keyboard_left(void) {
#ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT
return peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID);
#else
return ! peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID);
#endif
}

#endif /* SPLIT_HAND_MATRIX_GRID */
2 changes: 1 addition & 1 deletion keyboards/helix/rev2/split_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ bool waitForUsb(void) {
return false;
}


__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
Expand Down