From d81c0350aa8f119530a2164e0a551938ec638208 Mon Sep 17 00:00:00 2001 From: Purdea Andrei Date: Sat, 1 May 2021 17:27:57 +0300 Subject: [PATCH] Universal: only init all 8 row pins with pull-up if all 8 row pins are used. If they're not used for rows, they may be used for something else, and us touching them could affect the operation of whatever is on those pins. --- keyboards/xwhatsit/post_config.h | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/keyboards/xwhatsit/post_config.h b/keyboards/xwhatsit/post_config.h index 25b20e10b7..8071bed875 100644 --- a/keyboards/xwhatsit/post_config.h +++ b/keyboards/xwhatsit/post_config.h @@ -167,13 +167,21 @@ // F5, B5, F4, B4, D4, C6, D1, D0 // pull-ups are only necessary for some variants of the TH controller design: -#define SETUP_ROW_GPIOS() \ - do { \ - PORTF |= (1 << 5) | (1 << 4); \ - PORTB |= (1 << 5) | (1 << 4); \ - PORTD |= (1 << 4) | (1 << 1) | (1 << 0); \ - PORTC |= (1 << 6); \ - } while (0) +#if MATRIX_ROWS > 4 +# define SETUP_ROW_GPIOS() \ + do { \ + PORTF |= (1 << 5) | (1 << 4); \ + PORTB |= (1 << 5) | (1 << 4); \ + PORTD |= (1 << 4) | (1 << 1) | (1 << 0); \ + PORTC |= (1 << 6); \ + } while (0) +#else +# define SETUP_ROW_GPIOS() \ + do { \ + PORTD |= (1 << 4) | (1 << 1) | (1 << 0); \ + PORTC |= (1 << 6); \ + } while (0) +#endif #if 1 #define SETUP_UNUSED_PINS() do {} while (0) -- 2.20.1