aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2022-02-09 15:50:13 +1100
committerGitHub <noreply@github.com>2022-02-09 15:50:13 +1100
commitefdaa7f97205f8964c076677519d1848c5ac4b41 (patch)
treea9befb11625c69b06523de248fe8a6a312d5ca38 /quantum
parente26778ceb572f3aa6cff7cc08479663899c32a92 (diff)
downloadqmk_firmware-efdaa7f97205f8964c076677519d1848c5ac4b41.tar.gz
qmk_firmware-efdaa7f97205f8964c076677519d1848c5ac4b41.zip
Add support for driving unselected row/col. (#16278)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/matrix.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/quantum/matrix.c b/quantum/matrix.c
index 483d518ec..8596c2eab 100644
--- a/quantum/matrix.c
+++ b/quantum/matrix.c
@@ -82,6 +82,13 @@ static inline void setPinOutput_writeLow(pin_t pin) {
82 } 82 }
83} 83}
84 84
85static inline void setPinOutput_writeHigh(pin_t pin) {
86 ATOMIC_BLOCK_FORCEON {
87 setPinOutput(pin);
88 writePinHigh(pin);
89 }
90}
91
85static inline void setPinInputHigh_atomic(pin_t pin) { 92static inline void setPinInputHigh_atomic(pin_t pin) {
86 ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } 93 ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); }
87} 94}
@@ -141,7 +148,11 @@ static bool select_row(uint8_t row) {
141static void unselect_row(uint8_t row) { 148static void unselect_row(uint8_t row) {
142 pin_t pin = row_pins[row]; 149 pin_t pin = row_pins[row];
143 if (pin != NO_PIN) { 150 if (pin != NO_PIN) {
151# ifdef MATRIX_UNSELECT_DRIVE_HIGH
152 setPinOutput_writeHigh(pin);
153# else
144 setPinInputHigh_atomic(pin); 154 setPinInputHigh_atomic(pin);
155# endif
145 } 156 }
146} 157}
147 158
@@ -200,7 +211,11 @@ static bool select_col(uint8_t col) {
200static void unselect_col(uint8_t col) { 211static void unselect_col(uint8_t col) {
201 pin_t pin = col_pins[col]; 212 pin_t pin = col_pins[col];
202 if (pin != NO_PIN) { 213 if (pin != NO_PIN) {
214# ifdef MATRIX_UNSELECT_DRIVE_HIGH
215 setPinOutput_writeHigh(pin);
216# else
203 setPinInputHigh_atomic(pin); 217 setPinInputHigh_atomic(pin);
218# endif
204 } 219 }
205} 220}
206 221