From 5a545a83e6534b67e9fc2bc67ad959ebda4e7268 Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 6 Feb 2022 19:47:30 -0800 Subject: [PATCH] Added enum for layer indexing --- keymaps/default/keymap.c | 79 +++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/keymaps/default/keymap.c b/keymaps/default/keymap.c index 8cd4410..fdf84b7 100644 --- a/keymaps/default/keymap.c +++ b/keymaps/default/keymap.c @@ -21,43 +21,54 @@ enum tap_dance_codes { }; -#define LAYER_MAIN_IDX 0 -#define LAYER_COLEMAK_IDX 1 -#define LAYER_NUMPAD_IDX 2 -#define LAYER_SYMBOLS_IDX 3 -#define LAYER_ARROWS_IDX 4 -#define LAYER_FKEYS_IDX 5 -#define LAYER_NAVIGATE_IDX 6 -#define LAYER_DESKTOP_IDX 7 -#define LAYER_KEYBOARD_IDX 8 -#define LAYER_RUSSIAN_IDX 9 -#define LAYER_RUSSIAN_SYMBOLS_IDX 10 - // Assemble key and LED maps -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYER_MAIN, - [1] = LAYER_COLEMAK, - [2] = LAYER_NUMPAD, - [3] = LAYER_SYMBOLS, - [4] = LAYER_ARROWS, - [5] = LAYER_FKEYS, - [6] = LAYER_NAVIGATE, - [7] = LAYER_DESKTOP, - [8] = LAYER_KEYBOARD, - [9] = LAYER_RUSSIAN, - [10] = LAYER_RUSSIAN_SYMBOLS, +enum layer_indices { + LAYER_MAIN_IDX, + LAYER_COLEMAK_IDX, + LAYER_NUMPAD_IDX, + LAYER_SYMBOLS_IDX, + LAYER_ARROWS_IDX, + LAYER_FKEYS_IDX, + LAYER_NAVIGATE_IDX, + LAYER_DESKTOP_IDX, + LAYER_KEYBOARD_IDX, + LAYER_RUSSIAN_IDX, + LAYER_RUSSIAN_SYMBOLS_IDX, +}; +enum led_map_indices { + LAYER_COLEMAK_LEDS_IDX, + LAYER_NUMPAD_LEDS_IDX, + LAYER_SYMBOLS_LEDS_IDX, + LAYER_ARROWS_LEDS_IDX, + LAYER_FKEYS_LEDS_IDX, + LAYER_NAVIGATE_LEDS_IDX, + LAYER_DESKTOP_LEDS_IDX, + LAYER_RUSSIAN_LEDS_IDX, + LAYER_RUSSIAN_SYMBOLS_LEDS_IDX, +}; +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [LAYER_MAIN_IDX] = LAYER_MAIN, + [LAYER_COLEMAK_IDX] = LAYER_COLEMAK, + [LAYER_NUMPAD_IDX] = LAYER_NUMPAD, + [LAYER_SYMBOLS_IDX] = LAYER_SYMBOLS, + [LAYER_ARROWS_IDX] = LAYER_ARROWS, + [LAYER_FKEYS_IDX] = LAYER_FKEYS, + [LAYER_NAVIGATE_IDX] = LAYER_NAVIGATE, + [LAYER_DESKTOP_IDX] = LAYER_DESKTOP, + [LAYER_KEYBOARD_IDX] = LAYER_KEYBOARD, + [LAYER_RUSSIAN_IDX] = LAYER_RUSSIAN, + [LAYER_RUSSIAN_SYMBOLS_IDX] = LAYER_RUSSIAN_SYMBOLS, }; - const uint8_t PROGMEM ledmap[][DRIVER_LED_TOTAL][3] = { - [1] = LAYER_COLEMAK_LEDS, - [2] = LAYER_NUMPAD_LEDS, - [3] = LAYER_SYMBOLS_LEDS, - [4] = LAYER_ARROWS_LEDS, - [5] = LAYER_FKEYS_LEDS, - [6] = LAYER_NAVIGATE_LEDS, - [7] = LAYER_DESKTOP_LEDS, - [9] = LAYER_RUSSIAN_LEDS, - [10] = LAYER_RUSSIAN_SYMBOLS_LEDS + [LAYER_COLEMAK_LEDS_IDX] = LAYER_COLEMAK_LEDS, + [LAYER_NUMPAD_LEDS_IDX] = LAYER_NUMPAD_LEDS, + [LAYER_SYMBOLS_LEDS_IDX] = LAYER_SYMBOLS_LEDS, + [LAYER_ARROWS_LEDS_IDX] = LAYER_ARROWS_LEDS, + [LAYER_FKEYS_LEDS_IDX] = LAYER_FKEYS_LEDS, + [LAYER_NAVIGATE_LEDS_IDX] = LAYER_NAVIGATE_LEDS, + [LAYER_DESKTOP_LEDS_IDX] = LAYER_DESKTOP_LEDS, + [LAYER_RUSSIAN_LEDS_IDX] = LAYER_RUSSIAN_LEDS, + [LAYER_RUSSIAN_SYMBOLS_LEDS_IDX] = LAYER_RUSSIAN_SYMBOLS_LEDS };