From aaa758f1d3f97dda39879f2b055ad2da9680adfe Mon Sep 17 00:00:00 2001 From: Eric Tang Date: Mon, 23 May 2016 20:42:21 -0700 Subject: Optimize matrix scanning (#343) --- keyboard/Bantam44/config.h | 7 ++++--- keyboard/atomic/config.h | 17 +++++++++-------- keyboard/atomic/keymaps/pvc/config.h | 7 ++++--- keyboard/atreus/config.h | 12 +++++++----- keyboard/clueboard1/config.h | 25 ++++++++++++------------- keyboard/clueboard2/config.h | 19 +++++++++---------- keyboard/cluepad/config.h | 19 +++++++++---------- keyboard/gh60_rev_c/config.h | 17 +++++++++-------- keyboard/jd45/config.h | 9 +++++---- keyboard/planck/config.h | 7 ++++--- keyboard/planck/keymaps/pvc/config.h | 7 ++++--- keyboard/preonic/config.h | 7 ++++--- keyboard/retro_refit/config.h | 9 +++++---- 13 files changed, 85 insertions(+), 77 deletions(-) (limited to 'keyboard') diff --git a/keyboard/Bantam44/config.h b/keyboard/Bantam44/config.h index 26d680704d..a55f629990 100644 --- a/keyboard/Bantam44/config.h +++ b/keyboard/Bantam44/config.h @@ -35,8 +35,9 @@ along with this program. If not, see . // Planck PCB default pin-out // Change this to how you wired your keyboard // COLS: Left to right, ROWS: Top to bottom -#define COLS (int []){ B0, B1, B2, B3, B7, D0, B6, F7, F6, F5, F4, F1 } -#define ROWS (int []){ F0, D6, D4, D5 } +#define MATRIX_ROW_PINS { F0, D6, D4, D5 } +#define MATRIX_COL_PINS { B0, B1, B2, B3, B7, D0, B6, F7, F6, F5, F4, F1 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -48,7 +49,7 @@ along with this program. If not, see . #define BACKLIGHT_LEVELS 3 /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/keyboard/atomic/config.h b/keyboard/atomic/config.h index 1b34decf9c..bf9550e948 100644 --- a/keyboard/atomic/config.h +++ b/keyboard/atomic/config.h @@ -41,15 +41,16 @@ along with this program. If not, see . * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) * -*/ -#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1 } -#define ROWS (int []){ D0, D5, B5, B6, C6 } +*/ +#define MATRIX_ROW_PINS { D0, D5, B5, B6, C6 } +#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* define if matrix has ghost (lacks anti-ghosting diodes) */ //#define MATRIX_HAS_GHOST @@ -62,17 +63,17 @@ along with this program. If not, see . /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE -/* +/* * Force NKRO * - * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the * makefile for this to work.) * * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) * until the next keyboard reset. * - * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is * fully operational during normal computer usage. * * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) @@ -90,7 +91,7 @@ along with this program. If not, see . * the keyboard. They are best used in combination with the HID Listen program, * found here: https://www.pjrc.com/teensy/hid_listen.html * - * The options below allow the magic key functionality to be changed. This is + * The options below allow the magic key functionality to be changed. This is * useful if your keyboard/keypad is missing keys and you want magic key support. * */ diff --git a/keyboard/atomic/keymaps/pvc/config.h b/keyboard/atomic/keymaps/pvc/config.h index 5e956286b5..1473aac34f 100644 --- a/keyboard/atomic/keymaps/pvc/config.h +++ b/keyboard/atomic/keymaps/pvc/config.h @@ -42,14 +42,15 @@ along with this program. If not, see . * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) * */ -#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1 } -#define ROWS (int []){ D0, D5, B5, B6, B3 } +#define MATRIX_ROW_PINS { D0, D5, B5, B6, B3 } +#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* define if matrix has ghost (lacks anti-ghosting diodes) */ //#define MATRIX_HAS_GHOST diff --git a/keyboard/atreus/config.h b/keyboard/atreus/config.h index 55d3b62b92..624d90188c 100644 --- a/keyboard/atreus/config.h +++ b/keyboard/atreus/config.h @@ -36,11 +36,13 @@ along with this program. If not, see . // Change this to how you wired your keyboard // COLS: Left to right, ROWS: Top to bottom #if defined(ATREUS_ASTAR) - #define COLS (int []){ D7, C6, B5, B4, E6, D4, B6, F6, F7, D6, B7 } - #define ROWS (int []){ D0, D1, D3, D2 } +# define MATRIX_ROW_PINS { D0, D1, D3, D2 } +# define MATRIX_COL_PINS { D7, C6, B5, B4, E6, D4, B6, F6, F7, D6, B7 } +# define UNUSED_PINS #elif defined(ATREUS_TEENSY2) - #define COLS (int []){ F6, F5, F4, B7, B6, B5, B4, B3, B2, B1, B0} - #define ROWS (int []){ D0, D1, D2, D3 } +# define MATRIX_ROW_PINS { D0, D1, D2, D3 } +# define MATRIX_COL_PINS { F6, F5, F4, B7, B6, B5, B4, B3, B2, B1, B0 } +# define UNUSED_PINS #endif /* COL2ROW or ROW2COL */ @@ -53,7 +55,7 @@ along with this program. If not, see . //#define BACKLIGHT_LEVELS 3 /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/keyboard/clueboard1/config.h b/keyboard/clueboard1/config.h index 2b20c3873d..16338ddb03 100644 --- a/keyboard/clueboard1/config.h +++ b/keyboard/clueboard1/config.h @@ -32,19 +32,18 @@ along with this program. If not, see . #define MATRIX_ROWS 5 #define MATRIX_COLS 16 -// COLS: Left to right, ROWS: Top to bottom - +// ROWS: Top to bottom, COLS: Left to right /* Column pin configuration - * col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - * pin: B3 F1 F4 F5 F6 C7 C6 B6 B5 B4 D7 D6 D4 F7 B0 B1 - */ -#define COLS (int []){ B3, F1, F4, F5, F6, C7, C6, B6, B5, B4, D7, D6, D4, F7, B0, B1 } - - /* Row pin configuration - * row: 0 1 2 3 4 - * pin: D1 D0 D2 D5 D3 - */ -#define ROWS (int []){ D1, D0, D2, D5, D3 } +* col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +* pin: B3 F1 F4 F5 F6 C7 C6 B6 B5 B4 D7 D6 D4 F7 B0 B1 +*/ +#define MATRIX_COL_PINS { B3, F1, F4, F5, F6, C7, C6, B6, B5, B4, D7, D6, D4, F7, B0, B1 } +/* Row pin configuration +* row: 0 1 2 3 4 +* pin: D1 D0 D2 D5 D3 +*/ +#define MATRIX_ROW_PINS { D1, D0, D2, D5, D3 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -53,7 +52,7 @@ along with this program. If not, see . //#define MATRIX_HAS_GHOST /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/keyboard/clueboard2/config.h b/keyboard/clueboard2/config.h index 04166c20f6..2887519afd 100644 --- a/keyboard/clueboard2/config.h +++ b/keyboard/clueboard2/config.h @@ -32,19 +32,18 @@ along with this program. If not, see . #define MATRIX_ROWS 10 #define MATRIX_COLS 8 -// COLS: Left to right, ROWS: Top to bottom - +// ROWS: Top to bottom, COLS: Left to right +/* Row pin configuration +* row: 0 1 2 3 4 5 6 7 8 9 +* pin: B2 C7 C6 B6 B5 B0 B3 D5 D3 D2 +*/ +#define MATRIX_ROW_PINS { B2, C7, C6, B6, B5, B0, B3, D5, D3, D2 } /* Column pin configuration * col: 0 1 2 3 4 5 6 7 * pin: F0 F1 F4 F5 F6 F7 E6 B1 */ -#define COLS (int []){ F0, F1, F4, F5, F6, F7, E6, B1 } - - /* Row pin configuration - * row: 0 1 2 3 4 5 6 7 8 9 - * pin: B2 C7 C6 B6 B5 B0 B3 D5 D3 D2 - */ -#define ROWS (int []){ B2, C7, C6, B6, B5, B0, B3, D5, D3, D2 } +#define MATRIX_COL_PINS { F0, F1, F4, F5, F6, F7, E6, B1 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -53,7 +52,7 @@ along with this program. If not, see . //#define MATRIX_HAS_GHOST /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/keyboard/cluepad/config.h b/keyboard/cluepad/config.h index 5ed421a6e0..0955e0f702 100644 --- a/keyboard/cluepad/config.h +++ b/keyboard/cluepad/config.h @@ -32,19 +32,18 @@ along with this program. If not, see . #define MATRIX_ROWS 5 #define MATRIX_COLS 4 -// COLS: Left to right, ROWS: Top to bottom - +// ROWS: Top to bottom, COLS: Left to right +/* Row pin configuration +* row: 0 1 2 3 4 +* pin: +*/ +#define MATRIX_ROW_PINS { B0, D3, D5, D4, D6 } /* Column pin configuration * col: 0 1 2 3 * pin: F4 E6 B1 D2 */ -#define COLS (int []){ F4, E6, B1, D2 } - - /* Row pin configuration - * row: 0 1 2 3 4 - * pin: - */ -#define ROWS (int []){ B0, D3, D5, D4, D6 } +#define MATRIX_COL_PINS { F4, E6, B1, D2 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -53,7 +52,7 @@ along with this program. If not, see . //#define MATRIX_HAS_GHOST /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* Number of backlighting levels */ #define BACKLIGHT_LEVELS 3 diff --git a/keyboard/gh60_rev_c/config.h b/keyboard/gh60_rev_c/config.h index 2fd8f57439..827c08d1be 100644 --- a/keyboard/gh60_rev_c/config.h +++ b/keyboard/gh60_rev_c/config.h @@ -41,15 +41,16 @@ along with this program. If not, see . * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) * -*/ -#define COLS (int []){ F0, F1, E6, C7, C6, B6, D4, B1, B7, B5, B4, D7, D6, B3 } -#define ROWS (int []){ D0, D1, D2, D3, D5 } +*/ +#define MATRIX_ROW_PINS { D0, D1, D2, D3, D5 } +#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B6, D4, B1, B7, B5, B4, D7, D6, B3 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* define if matrix has ghost (lacks anti-ghosting diodes) */ //#define MATRIX_HAS_GHOST @@ -62,17 +63,17 @@ along with this program. If not, see . /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE -/* +/* * Force NKRO * - * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the * makefile for this to work.) * * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) * until the next keyboard reset. * - * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is * fully operational during normal computer usage. * * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) @@ -90,7 +91,7 @@ along with this program. If not, see . * the keyboard. They are best used in combination with the HID Listen program, * found here: https://www.pjrc.com/teensy/hid_listen.html * - * The options below allow the magic key functionality to be changed. This is + * The options below allow the magic key functionality to be changed. This is * useful if your keyboard/keypad is missing keys and you want magic key support. * */ diff --git a/keyboard/jd45/config.h b/keyboard/jd45/config.h index 1b81fe32ed..ffedb6a1a9 100644 --- a/keyboard/jd45/config.h +++ b/keyboard/jd45/config.h @@ -30,11 +30,12 @@ along with this program. If not, see . /* key matrix size */ #define MATRIX_ROWS 4 -#define MATRIX_COLS 13 +#define MATRIX_COLS 13 /* Planck PCB default pin-out */ -#define COLS (int []){F4, D7, B5, B6, C6, C7, D4, D6, D5, D0, D1, D2, B0} -#define ROWS (int []){F0, F1, F5, B4} +#define MATRIX_ROW_PINS { F0, F1, F5, B4 } +#define MATRIX_COL_PINS { F4, D7, B5, B6, C6, C7, D4, D6, D5, D0, D1, D2, B0 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -46,7 +47,7 @@ along with this program. If not, see . #define BACKLIGHT_LEVELS 3 /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/keyboard/planck/config.h b/keyboard/planck/config.h index 7d64f09773..b648931081 100644 --- a/keyboard/planck/config.h +++ b/keyboard/planck/config.h @@ -33,8 +33,9 @@ along with this program. If not, see . #define MATRIX_COLS 12 /* Planck PCB default pin-out */ -#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } -#define ROWS (int []){ D0, D5, B5, B6 } +#define MATRIX_ROW_PINS { D0, D5, B5, B6 } +#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -46,7 +47,7 @@ along with this program. If not, see . #define BACKLIGHT_LEVELS 3 /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/keyboard/planck/keymaps/pvc/config.h b/keyboard/planck/keymaps/pvc/config.h index d435cc795c..b8960038ab 100644 --- a/keyboard/planck/keymaps/pvc/config.h +++ b/keyboard/planck/keymaps/pvc/config.h @@ -33,8 +33,9 @@ along with this program. If not, see . #define MATRIX_COLS 12 /* Planck PCB default pin-out */ -#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } -#define ROWS (int []){ D0, D5, B5, B6 } +#define MATRIX_ROW_PINS { D0, D5, B5, B6 } +#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -46,7 +47,7 @@ along with this program. If not, see . #define BACKLIGHT_LEVELS 3 /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/keyboard/preonic/config.h b/keyboard/preonic/config.h index bb9d29dab7..e8d0e82fc9 100644 --- a/keyboard/preonic/config.h +++ b/keyboard/preonic/config.h @@ -33,8 +33,9 @@ along with this program. If not, see . #define MATRIX_COLS 12 /* Planck PCB default pin-out */ -#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } -#define ROWS (int []){ D2, D5, B5, B6, D3 } +#define MATRIX_ROW_PINS { D2, D5, B5, B6, D3 } +#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -46,7 +47,7 @@ along with this program. If not, see . #define BACKLIGHT_LEVELS 3 /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/keyboard/retro_refit/config.h b/keyboard/retro_refit/config.h index 05fceb92b2..f2194e550c 100644 --- a/keyboard/retro_refit/config.h +++ b/keyboard/retro_refit/config.h @@ -33,8 +33,9 @@ along with this program. If not, see . #define MATRIX_COLS 8 // See note in retro_refit.h for an explanation of how this matrix is wired up -#define COLS (int []){ B0, B1, B2, B3, D2, D3, C7, D5 } -#define ROWS (int []){ D4, D7, B4, B5, B6, F7, F6, F5, F4, F1, F0 } +#define MATRIX_ROW_PINS { D4, D7, B4, B5, B6, F7, F6, F5, F4, F1, F0 } +#define MATRIX_COL_PINS { B0, B1, B2, B3, D2, D3, C7, D5 } +#define UNUSED_PINS /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW @@ -46,7 +47,7 @@ along with this program. If not, see . #define BACKLIGHT_LEVELS 0 /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCING_DELAY 5 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE @@ -119,4 +120,4 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION -#endif \ No newline at end of file +#endif -- cgit v1.2.3