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: 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 --- keyboards/40percentclub/nori/keymaps/default/keymap.c | 14 ++++++++------ keyboards/ergotravel/keymaps/default/keymap.c | 14 ++++++++------ keyboards/handwired/atreus50/keymaps/default/keymap.c | 16 +++++++++------- keyboards/handwired/ortho5x13/keymaps/default/keymap.c | 14 ++++++++------ keyboards/keebio/levinson/keymaps/default/keymap.c | 14 ++++++++------ keyboards/keebio/nyquist/keymaps/default/keymap.c | 14 ++++++++------ keyboards/keebio/rorschach/keymaps/default/keymap.c | 10 ++++++---- keyboards/keebio/viterbi/keymaps/default/keymap.c | 10 ++++++---- keyboards/keebio/wavelet/keymaps/default/keymap.c | 14 ++++++++------ keyboards/lets_split/keymaps/default/keymap.c | 14 ++++++++------ .../maple_computing/launchpad/keymaps/default/keymap.c | 7 ++++--- .../launchpad/keymaps/default_rgb/keymap.c | 8 +++++--- .../maple_computing/minidox/keymaps/default/keymap.c | 10 ++++++---- keyboards/miniaxe/keymaps/default/keymap.c | 10 ++++++---- keyboards/miniaxe/keymaps/underglow/keymap.c | 10 ++++++---- keyboards/omkbd/ergodash/mini/keymaps/default/keymap.c | 10 ++++++---- keyboards/omkbd/ergodash/rev1/keymaps/default/keymap.c | 10 ++++++---- keyboards/orthodox/keymaps/default/keymap.c | 14 ++++++++------ .../unikeyboard/divergetm2/keymaps/default/keymap.c | 14 ++++++++------ .../woodkeys/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 25d5c89af3..f7760a268f 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 7c96296a16..2a43968814 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 68724c0506..52a450c3a0 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 39ae1872a2..aeecfa1d8e 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 ed4c7243d1..72da4addc3 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 03de74a80d..a06cde9555 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 00f2a9cffb..c1efce8f2b 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 1db80b7452..d23ebe6797 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 ed4c7243d1..72da4addc3 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 bc240b5f00..34b470d533 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 62dee131f8..efd67e8c1b 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 529fa91f65..69fb3ce561 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 7886eec172..d71e5b6e55 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 45e1e131e8..81f8004e69 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 2cadbb824f..31a7ccddf9 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 1d18383652..d1016ecc5d 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 c5e0a30147..0251700433 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 1e06d7106d..3ad20a288a 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 e4ba788b70..d4f38e4a19 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 707e9fa132..b9cf12cd7e 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 7a96f802ef..179b5eb037 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)))) -- cgit v1.2.1