add SPLIT_HAND_MATRIX_GRID support (#8685)
Co-authored-by: Danny <nooges@users.noreply.github.com>
This commit is contained in:
committed by
Drashna Jael're
parent
e0ab67fb43
commit
063f14f72d
@@ -5,6 +5,7 @@
|
|||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "transport.h"
|
#include "transport.h"
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
#include "wait.h"
|
||||||
|
|
||||||
#ifdef PROTOCOL_LUFA
|
#ifdef PROTOCOL_LUFA
|
||||||
# include <LUFA/Drivers/USB/USB.h>
|
# include <LUFA/Drivers/USB/USB.h>
|
||||||
@@ -79,11 +80,34 @@ static inline bool usbIsActive(void) {
|
|||||||
static inline bool usbIsActive(void) { return true; }
|
static inline bool usbIsActive(void) { return true; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SPLIT_HAND_MATRIX_GRID
|
||||||
|
void matrix_io_delay(void);
|
||||||
|
|
||||||
|
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);
|
||||||
|
matrix_io_delay(); // Wait for the pull-up to go HIGH.
|
||||||
|
return pin_state;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
__attribute__((weak)) bool is_keyboard_left(void) {
|
__attribute__((weak)) bool is_keyboard_left(void) {
|
||||||
#if defined(SPLIT_HAND_PIN)
|
#if defined(SPLIT_HAND_PIN)
|
||||||
// Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
|
// Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
|
||||||
setPinInput(SPLIT_HAND_PIN);
|
setPinInput(SPLIT_HAND_PIN);
|
||||||
return readPin(SPLIT_HAND_PIN);
|
return readPin(SPLIT_HAND_PIN);
|
||||||
|
#elif defined(SPLIT_HAND_MATRIX_GRID)
|
||||||
|
# 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
|
||||||
#elif defined(EE_HANDS)
|
#elif defined(EE_HANDS)
|
||||||
return eeconfig_read_handedness();
|
return eeconfig_read_handedness();
|
||||||
#elif defined(MASTER_RIGHT)
|
#elif defined(MASTER_RIGHT)
|
||||||
|
|||||||
Reference in New Issue
Block a user