From efdd4f4d50e09e0f71d09333d15acf197406a09c Mon Sep 17 00:00:00 2001 From: James Young <18669334+noroadsleft@users.noreply.github.com> Date: Sat, 27 Aug 2022 23:13:44 -0700 Subject: [PATCH] Clean-up of `#define _ADJUST 16` instances (#18182) * enum layer_names: 40percentclub/nori default keymap * enum layer_names: ergotravel default keymap * enum layer_names: handwired/atreus50 default keymap * enum layer_names: handwired/ortho5x13 default keymap * enum layer_names: keebio/levinson default keymap * enum layer_names: keebio/nyquist default keymap * enum layer_names: keebio/rorschach default keymap * enum layer_names: keebio/viterbi default keymap * enum layer_names: keebio/wavelet default keymap * enum layer_names: lets_split default keymap * enum layer_names: maple_computing/launchpad reference keymaps Update `default` and `default_rgb` keymaps. * enum layer_names: maple_computing/minidox default keymap * enum layer_names: miniaxe reference keymaps Update `default` and `underglow` keymaps. * enum layer_names: omkbd/ergodash/mini default keymap * enum layer_names: omkbd/ergodash/rev1 default keymap * enum layer_names: orthodox default keymap * enum layer_names: unikeyboard/divergetm2 default keymap * enum layer_names: woodkeys/scarletbandana default keymap * add _Static_assert to keymap_introspection.c --- .../40percentclub/nori/keymaps/default/keymap.c | 14 ++++++++------ keyboards/ergotravel/keymaps/default/keymap.c | 14 ++++++++------ .../handwired/atreus50/keymaps/default/keymap.c | 16 +++++++++------- .../handwired/ortho5x13/keymaps/default/keymap.c | 14 ++++++++------ .../keebio/levinson/keymaps/default/keymap.c | 14 ++++++++------ .../keebio/nyquist/keymaps/default/keymap.c | 14 ++++++++------ .../keebio/rorschach/keymaps/default/keymap.c | 10 ++++++---- .../keebio/viterbi/keymaps/default/keymap.c | 10 ++++++---- .../keebio/wavelet/keymaps/default/keymap.c | 14 ++++++++------ keyboards/lets_split/keymaps/default/keymap.c | 14 ++++++++------ .../launchpad/keymaps/default/keymap.c | 7 ++++--- .../launchpad/keymaps/default_rgb/keymap.c | 8 +++++--- .../minidox/keymaps/default/keymap.c | 10 ++++++---- keyboards/miniaxe/keymaps/default/keymap.c | 10 ++++++---- keyboards/miniaxe/keymaps/underglow/keymap.c | 10 ++++++---- .../omkbd/ergodash/mini/keymaps/default/keymap.c | 10 ++++++---- .../omkbd/ergodash/rev1/keymaps/default/keymap.c | 10 ++++++---- keyboards/orthodox/keymaps/default/keymap.c | 14 ++++++++------ .../divergetm2/keymaps/default/keymap.c | 14 ++++++++------ .../scarletbandana/keymaps/default/keymap.c | 14 ++++++++------ quantum/keymap_introspection.c | 2 ++ 21 files changed, 142 insertions(+), 101 deletions(-) diff --git a/keyboards/40percentclub/nori/keymaps/default/keymap.c b/keyboards/40percentclub/nori/keymaps/default/keymap.c index 25d5c89af3f..f7760a268f9 100644 --- a/keyboards/40percentclub/nori/keymaps/default/keymap.c +++ b/keyboards/40percentclub/nori/keymaps/default/keymap.c @@ -4,12 +4,14 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/ergotravel/keymaps/default/keymap.c b/keyboards/ergotravel/keymaps/default/keymap.c index 7c96296a16b..2a439688148 100644 --- a/keyboards/ergotravel/keymaps/default/keymap.c +++ b/keyboards/ergotravel/keymaps/default/keymap.c @@ -1,10 +1,12 @@ #include QMK_KEYBOARD_H -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST, +}; enum custom_keycodes { QWERTY = SAFE_RANGE, @@ -39,12 +41,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_RAISE] = LAYOUT( - + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, _______, KC_4, KC_5, KC_6, KC_PLUS, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, _______, KC_ENT, KC_7, KC_8, KC_9, KC_MINS, _______, _______, _______, _______, KC_NUHS, KC_NUBS, KC_MUTE, _______, KC_BSLS, _______, KC_COMM, KC_0, KC_DOT, _______, KC_BSPC, KC_BSPC, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY - + ), [_ADJUST] = LAYOUT( diff --git a/keyboards/handwired/atreus50/keymaps/default/keymap.c b/keyboards/handwired/atreus50/keymaps/default/keymap.c index 68724c05067..52a450c3a0e 100644 --- a/keyboards/handwired/atreus50/keymaps/default/keymap.c +++ b/keyboards/handwired/atreus50/keymaps/default/keymap.c @@ -4,13 +4,15 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _MOVEMENT 5 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _MOVEMENT, + _ADJUST, +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/handwired/ortho5x13/keymaps/default/keymap.c b/keyboards/handwired/ortho5x13/keymaps/default/keymap.c index 39ae1872a20..aeecfa1d8e3 100644 --- a/keyboards/handwired/ortho5x13/keymaps/default/keymap.c +++ b/keyboards/handwired/ortho5x13/keymaps/default/keymap.c @@ -4,12 +4,14 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/keebio/levinson/keymaps/default/keymap.c b/keyboards/keebio/levinson/keymaps/default/keymap.c index ed4c7243d10..72da4addc31 100644 --- a/keyboards/keebio/levinson/keymaps/default/keymap.c +++ b/keyboards/keebio/levinson/keymaps/default/keymap.c @@ -5,12 +5,14 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/keebio/nyquist/keymaps/default/keymap.c b/keyboards/keebio/nyquist/keymaps/default/keymap.c index 03de74a80dc..a06cde95553 100644 --- a/keyboards/keebio/nyquist/keymaps/default/keymap.c +++ b/keyboards/keebio/nyquist/keymaps/default/keymap.c @@ -5,12 +5,14 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/keebio/rorschach/keymaps/default/keymap.c b/keyboards/keebio/rorschach/keymaps/default/keymap.c index 00f2a9cffbb..c1efce8f2b8 100644 --- a/keyboards/keebio/rorschach/keymaps/default/keymap.c +++ b/keyboards/keebio/rorschach/keymaps/default/keymap.c @@ -1,10 +1,12 @@ #include QMK_KEYBOARD_H -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; #define LOWER MO(_LOWER) #define RAISE MO(_RAISE) diff --git a/keyboards/keebio/viterbi/keymaps/default/keymap.c b/keyboards/keebio/viterbi/keymaps/default/keymap.c index 1db80b74524..d23ebe6797b 100644 --- a/keyboards/keebio/viterbi/keymaps/default/keymap.c +++ b/keyboards/keebio/viterbi/keymaps/default/keymap.c @@ -5,10 +5,12 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/keebio/wavelet/keymaps/default/keymap.c b/keyboards/keebio/wavelet/keymaps/default/keymap.c index ed4c7243d10..72da4addc31 100644 --- a/keyboards/keebio/wavelet/keymaps/default/keymap.c +++ b/keyboards/keebio/wavelet/keymaps/default/keymap.c @@ -5,12 +5,14 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/lets_split/keymaps/default/keymap.c b/keyboards/lets_split/keymaps/default/keymap.c index bc240b5f003..34b470d533e 100644 --- a/keyboards/lets_split/keymaps/default/keymap.c +++ b/keyboards/lets_split/keymaps/default/keymap.c @@ -4,12 +4,14 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/maple_computing/launchpad/keymaps/default/keymap.c b/keyboards/maple_computing/launchpad/keymaps/default/keymap.c index 62dee131f88..efd67e8c1b4 100644 --- a/keyboards/maple_computing/launchpad/keymaps/default/keymap.c +++ b/keyboards/maple_computing/launchpad/keymaps/default/keymap.c @@ -6,9 +6,10 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 - -#define _FUNC 15 +enum layer_names { + _QWERTY, + _FUNC +}; // Defines for task manager and such #define CALTDEL LCTL(LALT(KC_DEL)) diff --git a/keyboards/maple_computing/launchpad/keymaps/default_rgb/keymap.c b/keyboards/maple_computing/launchpad/keymaps/default_rgb/keymap.c index 529fa91f651..69fb3ce5613 100644 --- a/keyboards/maple_computing/launchpad/keymaps/default_rgb/keymap.c +++ b/keyboards/maple_computing/launchpad/keymaps/default_rgb/keymap.c @@ -7,9 +7,11 @@ extern keymap_config_t keymap_config; // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _RGB 1 -#define _FUNC 15 +enum layer_names { + _QWERTY, + _RGB, + _FUNC +}; // Defines for task manager and such #define CALTDEL LCTL(LALT(KC_DEL)) diff --git a/keyboards/maple_computing/minidox/keymaps/default/keymap.c b/keyboards/maple_computing/minidox/keymaps/default/keymap.c index 7886eec1723..d71e5b6e559 100644 --- a/keyboards/maple_computing/minidox/keymaps/default/keymap.c +++ b/keyboards/maple_computing/minidox/keymaps/default/keymap.c @@ -5,10 +5,12 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/miniaxe/keymaps/default/keymap.c b/keyboards/miniaxe/keymaps/default/keymap.c index 45e1e131e89..81f8004e694 100644 --- a/keyboards/miniaxe/keymaps/default/keymap.c +++ b/keyboards/miniaxe/keymaps/default/keymap.c @@ -16,10 +16,12 @@ #include QMK_KEYBOARD_H // Defines the keycodes used by our macros in process_record_user -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/miniaxe/keymaps/underglow/keymap.c b/keyboards/miniaxe/keymaps/underglow/keymap.c index 2cadbb824fd..31a7ccddf93 100644 --- a/keyboards/miniaxe/keymaps/underglow/keymap.c +++ b/keyboards/miniaxe/keymaps/underglow/keymap.c @@ -16,10 +16,12 @@ #include QMK_KEYBOARD_H // Defines the keycodes used by our macros in process_record_user -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/omkbd/ergodash/mini/keymaps/default/keymap.c b/keyboards/omkbd/ergodash/mini/keymaps/default/keymap.c index 1d183836524..d1016ecc5dd 100644 --- a/keyboards/omkbd/ergodash/mini/keymaps/default/keymap.c +++ b/keyboards/omkbd/ergodash/mini/keymaps/default/keymap.c @@ -1,10 +1,12 @@ #include QMK_KEYBOARD_H -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/omkbd/ergodash/rev1/keymaps/default/keymap.c b/keyboards/omkbd/ergodash/rev1/keymaps/default/keymap.c index c5e0a301473..02517004338 100644 --- a/keyboards/omkbd/ergodash/rev1/keymaps/default/keymap.c +++ b/keyboards/omkbd/ergodash/rev1/keymaps/default/keymap.c @@ -1,10 +1,12 @@ #include QMK_KEYBOARD_H -#define _QWERTY 0 -#define _LOWER 1 -#define _RAISE 2 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/orthodox/keymaps/default/keymap.c b/keyboards/orthodox/keymaps/default/keymap.c index 1e06d7106d1..3ad20a288a5 100644 --- a/keyboards/orthodox/keymaps/default/keymap.c +++ b/keyboards/orthodox/keymaps/default/keymap.c @@ -25,12 +25,14 @@ along with this program. If not, see . // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/unikeyboard/divergetm2/keymaps/default/keymap.c b/keyboards/unikeyboard/divergetm2/keymaps/default/keymap.c index e4ba788b700..d4f38e4a199 100644 --- a/keyboards/unikeyboard/divergetm2/keymaps/default/keymap.c +++ b/keyboards/unikeyboard/divergetm2/keymaps/default/keymap.c @@ -22,12 +22,14 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/keyboards/woodkeys/scarletbandana/keymaps/default/keymap.c b/keyboards/woodkeys/scarletbandana/keymaps/default/keymap.c index 707e9fa132d..b9cf12cd7ea 100644 --- a/keyboards/woodkeys/scarletbandana/keymaps/default/keymap.c +++ b/keyboards/woodkeys/scarletbandana/keymaps/default/keymap.c @@ -20,12 +20,14 @@ extern rgblight_config_t rgblight_config; #endif -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 +enum layer_names { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _ADJUST +}; enum custom_keycodes { QWERTY = SAFE_RANGE, diff --git a/quantum/keymap_introspection.c b/quantum/keymap_introspection.c index 7a96f802ef2..179b5eb0376 100644 --- a/quantum/keymap_introspection.c +++ b/quantum/keymap_introspection.c @@ -17,6 +17,8 @@ uint8_t keymap_layer_count(void) { return NUM_KEYMAP_LAYERS; } +_Static_assert(NUM_KEYMAP_LAYERS <= MAX_LAYER, "Number of keymap layers exceeds maximum set by LAYER_STATE_(8|16|32)BIT"); + #if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) # define NUM_ENCODERMAP_LAYERS ((uint8_t)(sizeof(encoder_map) / ((NUM_ENCODERS) * (2) * sizeof(uint16_t))))