diff options
Diffstat (limited to 'users')
27 files changed, 71 insertions, 83 deletions
diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c index da85d4f6d4..00abbf2ae3 100644 --- a/users/arkag/arkag.c +++ b/users/arkag/arkag.c @@ -190,7 +190,7 @@ void set_os (uint8_t os, bool update) { } switch (os) { case OS_MAC: - set_unicode_input_mode(UC_OSX); + set_unicode_input_mode(UC_MAC); underglow = (Color){ 213, 255, 255 }; break; case OS_WIN: diff --git a/users/brandonschlack/rgb_bs.c b/users/brandonschlack/rgb_bs.c index 1abf785b49..6b88503f41 100644 --- a/users/brandonschlack/rgb_bs.c +++ b/users/brandonschlack/rgb_bs.c @@ -75,7 +75,7 @@ void rgb_theme_step_reverse(void) { rgb_theme_color_t get_rgb_theme_color(uint8_t index) { rgb_theme_t theme = get_rgb_theme(); - size_t rgb_theme_color_max = sizeof theme.colors / sizeof *theme.colors; + size_t rgb_theme_color_max = ARRAY_SIZE(theme.colors); if (index == _ADJUST) { return default_adjust; @@ -98,7 +98,7 @@ void rgb_theme_layer(layer_state_t state) { #ifdef RGB_MATRIX_ENABLE void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, uint8_t led_type) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (!HAS_ANY_FLAGS(g_led_config.flags[i], led_type)) { rgb_matrix_set_color( i, red, green, blue ); } diff --git a/users/byungyoonc/saturated_solid_multisplash.h b/users/byungyoonc/saturated_solid_multisplash.h index f302348524..c6850a7873 100644 --- a/users/byungyoonc/saturated_solid_multisplash.h +++ b/users/byungyoonc/saturated_solid_multisplash.h @@ -43,7 +43,7 @@ static bool saturated_solid_multisplash(effect_params_t* params) { RGB rgb = rgb_matrix_hsv_to_rgb(hsv); rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } - return led_max < DRIVER_LED_TOTAL; + return led_max < RGB_MATRIX_LED_COUNT; } # endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/users/curry/oled.c b/users/curry/oled.c index 5a8f0de61d..89112af121 100644 --- a/users/curry/oled.c +++ b/users/curry/oled.c @@ -41,7 +41,7 @@ void add_keylog(uint16_t keycode) { keylog_str[i] = keylog_str[i - 1]; } - if (keycode < (sizeof(code_to_name) / sizeof(char))) { + if (keycode < ARRAY_SIZE(code_to_name)) { keylog_str[0] = pgm_read_byte(&code_to_name[keycode]); } diff --git a/users/curry/rgb_matrix_user.c b/users/curry/rgb_matrix_user.c index 96f1f1d4f3..053226ab60 100644 --- a/users/curry/rgb_matrix_user.c +++ b/users/curry/rgb_matrix_user.c @@ -131,7 +131,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode uint16_t time = scale16by8(RGBLED_NUM, speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } @@ -141,7 +141,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode default: // Solid Color { RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/users/davidkristoffersen/util/functions.c b/users/davidkristoffersen/util/functions.c index 781d8f214d..3ab4ace2d6 100644 --- a/users/davidkristoffersen/util/functions.c +++ b/users/davidkristoffersen/util/functions.c @@ -33,14 +33,14 @@ code_set_t EN_SHIFT_CODES [] = { const shift_code_t SHIFT_CODES [] = { #ifdef LAYER_NO {.lang = LAYER_NO, - .size = ARR_LEN(NO_SHIFT_CODES), + .size = ARRAY_SIZE(NO_SHIFT_CODES), .codes = NO_SHIFT_CODES}, #endif {.lang = LAYER_EN, - .size = ARR_LEN(EN_SHIFT_CODES), + .size = ARRAY_SIZE(EN_SHIFT_CODES), .codes = EN_SHIFT_CODES}, }; -const int SHIFT_CODES_SIZE = ARR_LEN(SHIFT_CODES); +const int SHIFT_CODES_SIZE = ARRAY_SIZE(SHIFT_CODES); #endif #ifdef LAYER_NO @@ -72,7 +72,7 @@ const code_set_t EN2NO_CODES [] = { {KC_DLR, NO_DLR}, {KC_GRV, NO_GRV} }; -const int EN2NO_CODES_SIZE = ARR_LEN(EN2NO_CODES); +const int EN2NO_CODES_SIZE = ARRAY_SIZE(EN2NO_CODES); #endif // Check if layer is an active default layer diff --git a/users/davidkristoffersen/util/functions.h b/users/davidkristoffersen/util/functions.h index eee1dadc57..5fef010694 100644 --- a/users/davidkristoffersen/util/functions.h +++ b/users/davidkristoffersen/util/functions.h @@ -15,8 +15,6 @@ // Return false if test equal false #define HANDLE_FALSE(bool) if (!bool) return false; -// Generic array lenght define -#define ARR_LEN(arr) (sizeof(arr) / sizeof(arr)[0]) // Printf-like functionality for send_string #define SEND_VAR(str, ...) \ do { \ diff --git a/users/drashna/keyrecords/tap_dance.md b/users/drashna/keyrecords/tap_dance.md index 0bf67cbd5a..fef1435918 100644 --- a/users/drashna/keyrecords/tap_dance.md +++ b/users/drashna/keyrecords/tap_dance.md @@ -88,7 +88,7 @@ void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode; // if the tapdance is hit more than the number of elemints in the array, reset - if (state->count >= (sizeof(diablo_times) / sizeof(uint8_t) ) ) { + if (state->count >= ARRAY_SIZE(diablo_times) ) { diablo_timer[diablo_keys->index].key_interval = 0; reset_tap_dance(state); } else { // else set the interval (tapdance count starts at 1, array starts at 0, so offset by one) diff --git a/users/drashna/keyrecords/tap_dances.c b/users/drashna/keyrecords/tap_dances.c index 6caf6b6b3e..7bdea3cae3 100644 --- a/users/drashna/keyrecords/tap_dances.c +++ b/users/drashna/keyrecords/tap_dances.c @@ -23,7 +23,7 @@ void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode; // if the tapdance is hit more than the number of elemints in the array, reset - if (state->count >= (sizeof(diablo_times) / sizeof(uint8_t))) { + if (state->count >= ARRAY_SIZE(diablo_times)) { diablo_timer[diablo_keys->index].key_interval = 0; reset_tap_dance(state); } else { // else set the interval (tapdance count starts at 1, array starts at 0, so offset by one) diff --git a/users/drashna/keyrecords/unicode.c b/users/drashna/keyrecords/unicode.c index b3fc71cb09..bfce38f555 100644 --- a/users/drashna/keyrecords/unicode.c +++ b/users/drashna/keyrecords/unicode.c @@ -43,7 +43,7 @@ typedef uint32_t (*translator_function_t)(bool is_shifted, uint32_t keycode); static inline uint32_t translator_name(bool is_shifted, uint32_t keycode) { \ static const uint32_t translation[] = {__VA_ARGS__}; \ uint32_t ret = keycode; \ - if ((keycode - KC_A) < (sizeof(translation) / sizeof(uint32_t))) { \ + if ((keycode - KC_A) < ARRAY_SIZE(translation)) { \ ret = translation[keycode - KC_A]; \ } \ return ret; \ diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c index e082f8ab3e..68801b80a4 100644 --- a/users/drashna/oled/oled_stuff.c +++ b/users/drashna/oled/oled_stuff.c @@ -87,7 +87,7 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) { memmove(keylog_str, keylog_str + 1, OLED_KEYLOGGER_LENGTH - 1); - if (keycode < (sizeof(code_to_name) / sizeof(char))) { + if (keycode < ARRAY_SIZE(code_to_name)) { keylog_str[(OLED_KEYLOGGER_LENGTH - 1)] = pgm_read_byte(&code_to_name[keycode]); } diff --git a/users/drashna/rgb/rgb_matrix_stuff.c b/users/drashna/rgb/rgb_matrix_stuff.c index 2c23c29784..64549d8fae 100644 --- a/users/drashna/rgb/rgb_matrix_stuff.c +++ b/users/drashna/rgb/rgb_matrix_stuff.c @@ -20,7 +20,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode uint16_t time = scale16by8(g_rgb_timer, speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); } @@ -30,7 +30,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode default: // Solid Color { RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b); } diff --git a/users/gary/gary.h b/users/gary/gary.h index 10f2331591..ce920cf776 100644 --- a/users/gary/gary.h +++ b/users/gary/gary.h @@ -1,7 +1,6 @@ #include QMK_KEYBOARD_H #pragma once -#define USE_SERIAL #define MASTER_LEFT // Layers diff --git a/users/gourdo1/gourdo1.h b/users/gourdo1/gourdo1.h index ecf6eaf25d..a198fd0805 100644 --- a/users/gourdo1/gourdo1.h +++ b/users/gourdo1/gourdo1.h @@ -17,9 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once -// DEFINE MACROS -#define ARRAYSIZE(arr) sizeof(arr) / sizeof(arr[0]) - // LAYERS -- Note: to avoid compile problems, make sure total layers matches DYNAMIC_KEYMAP_LAYER_COUNT defined in config.h (where _COLEMAK layer is defined) enum custom_user_layers { _BASE, diff --git a/users/jonavin/jonavin.h b/users/jonavin/jonavin.h index 3ebd3fe9f2..97f72c1248 100644 --- a/users/jonavin/jonavin.h +++ b/users/jonavin/jonavin.h @@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define ARRAYSIZE(arr) sizeof(arr)/sizeof(arr[0]) #endif // !ARRAYSIZE - // LAYERS enum custom_user_layers { _BASE, diff --git a/users/sigma/sigma.c b/users/sigma/sigma.c index 8470060a53..64fa68228b 100644 --- a/users/sigma/sigma.c +++ b/users/sigma/sigma.c @@ -67,7 +67,7 @@ void set_os(uint8_t os) { #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) switch (os) { case _OS_MACOS: - set_unicode_input_mode(UC_OSX); + set_unicode_input_mode(UC_MAC); break; case _OS_LINUX: set_unicode_input_mode(UC_LNX); diff --git a/users/spidey3/config.h b/users/spidey3/config.h index 91bcf910ee..36d59b6a5d 100644 --- a/users/spidey3/config.h +++ b/users/spidey3/config.h @@ -42,7 +42,7 @@ #define SPI_DEBUG_SCAN_RATE #undef MANUFACTURER -#define MANUFACTURER Window of Fire +#define MANUFACTURER "Window of Fire" // Some keyboards enable BACKLIGHT_CAPS_LOCK without checking if backlight is enabled. // Undef as appropriate to avoid compiler warnings in that case. diff --git a/users/spidey3/layer_rgb.c b/users/spidey3/layer_rgb.c index c867468194..bdf4584ef1 100644 --- a/users/spidey3/layer_rgb.c +++ b/users/spidey3/layer_rgb.c @@ -97,7 +97,7 @@ const rgblight_segment_t *const PROGMEM _rgb_layers[] = { // clang-format on -const uint8_t PROGMEM _n_rgb_layers = sizeof(_rgb_layers) / sizeof(_rgb_layers[0]) - 1; +const uint8_t PROGMEM _n_rgb_layers = ARRAY_SIZE(_rgb_layers) - 1; void clear_rgb_layers() { for (uint8_t i = 0; i < _n_rgb_layers; i++) { @@ -112,8 +112,7 @@ void do_rgb_layers(layer_state_t state, uint8_t start, uint8_t end) { } } -void do_rgb_unicode(void) { - uint8_t uc_mode = get_unicode_input_mode(); +void do_rgb_unicode(uint8_t uc_mode) { for (uint8_t i = 0; i < UC__COUNT; i++) { bool is_on = i == uc_mode; rgblight_set_layer_state(UNICODE_OFFSET + i, is_on); @@ -123,7 +122,7 @@ void do_rgb_unicode(void) { void do_rgb_all(void) { do_rgb_layers(default_layer_state, LAYER_BASE_DEFAULT, LAYER_BASE_REGULAR); do_rgb_layers(layer_state, LAYER_BASE_REGULAR, LAYER_BASE_END); - do_rgb_unicode(); + do_rgb_unicode(get_unicode_input_mode()); rgblight_set_layer_state(MISC_OFFSET + 0, spi_gflock); rgblight_set_layer_state(MISC_OFFSET + 1, spi_replace_mode != SPI_NORMAL); } @@ -148,7 +147,7 @@ extern rgblight_status_t rgblight_status; # define STARTUP_ANIMATION_CYCLE_STEP 2 # define STARTUP_ANIMATION_RAMP_TO_STEPS 70 # define STARTUP_ANIMATION_STEP_TIME 10 -# define STARTUP_ANIMATION_INITIAL_DELAY 0 // milliseconds, must be < 255 * STEP_TIME +# define STARTUP_ANIMATION_INITIAL_DELAY 0 // milliseconds, must be < 255 * STEP_TIME // clang-format off typedef enum { @@ -382,6 +381,13 @@ bool led_update_user_rgb(led_t led_state) { return true; } +#if defined(UNICODE_COMMON_ENABLE) +void unicode_input_mode_set_user_rgb(uint8_t input_mode) { + rgb_layer_ack(ACK_MEH); + do_rgb_unicode(input_mode); +} +#endif + void rgb_layer_ack_yn(bool yn) { rgb_layer_ack(yn ? ACK_YES : ACK_NO); } void rgb_layer_ack(layer_ack_t n) { @@ -458,7 +464,7 @@ void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { break; case RGB_TOG: - // Hack - we only get called on the press for RGB_TOG, + // Hack - we only get called on the press for RGB_TOG, // but the flag is only flipped on the release... rgb_layer_ack_yn(!rgblight_config.enable); break; @@ -476,20 +482,5 @@ void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { rgb_layer_ack_yn(keymap_config.nkro); break; #endif - -#if defined(UNICODE_COMMON_ENABLE) - case UC_M_MA: - case UC_M_LN: - case UC_M_WI: - case UC_M_BS: - case UC_M_WC: - case UC_M_EM: - - case UC_MOD: - case UC_RMOD: - rgb_layer_ack(ACK_MEH); - do_rgb_unicode(); - break; -#endif } } diff --git a/users/spidey3/rules.mk b/users/spidey3/rules.mk index c95582e176..35cfdb4187 100644 --- a/users/spidey3/rules.mk +++ b/users/spidey3/rules.mk @@ -11,5 +11,5 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) SRC += layer_rgb.c endif ifeq ($(strip $(UNICODEMAP_ENABLE)), yes) - SRC += unicode.c + SRC += spidey3_unicode.c endif diff --git a/users/spidey3/spidey3.c b/users/spidey3/spidey3.c index 842bb465f7..b4c261ce1d 100644 --- a/users/spidey3/spidey3.c +++ b/users/spidey3/spidey3.c @@ -98,14 +98,14 @@ bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uin clear_oneshot_mods(); #endif - bool caps = host_keyboard_led_state().caps_lock; + bool caps = host_keyboard_led_state().caps_lock; uint32_t base = ((shifted == caps) ? baseAlphaLower : baseAlphaUpper); _register(base + (keycode - KC_A)); set_mods(temp_mod); } return false; case KC_0: - if (shifted) { // skip shifted numbers, so that we can still use symbols etc. + if (shifted) { // skip shifted numbers, so that we can still use symbols etc. return true; } if (record->event.pressed) { @@ -113,7 +113,7 @@ bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uin } return false; case KC_1 ... KC_9: - if (shifted) { // skip shifted numbers, so that we can still use symbols etc. + if (shifted) { // skip shifted numbers, so that we can still use symbols etc. return true; } if (record->event.pressed) { @@ -122,7 +122,7 @@ bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uin return false; case KC_SPACE: if (record->event.pressed) { - _register(spaceGlyph); // em space + _register(spaceGlyph); // em space } return false; } @@ -199,8 +199,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // clang-format off - case CH_CPNL: host_consumer_send(AL_CONTROL_PANEL); return false; - case CH_ASST: host_consumer_send(AL_ASSISTANT); return false; case CH_SUSP: tap_code16(LGUI(LSFT(KC_L))); return true; // clang-format on @@ -285,11 +283,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } else { switch (keycode) { - case CH_CPNL: - case CH_ASST: - host_consumer_send(0); - return false; - case SPI_KP_00: unregister_code(KC_KP_0); return false; @@ -338,7 +331,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { set_mods(mods); return false; } - } else { // on release of KC_BSPC + } else { // on release of KC_BSPC // In case KC_DEL is still being sent even after the release of KC_BSPC if (delkey_registered) { unregister_code(KC_DEL); @@ -387,3 +380,11 @@ bool led_update_user(led_t led_state) { return true; #endif } + +#if defined(UNICODE_COMMON_ENABLE) +void unicode_input_mode_set_user(uint8_t input_mode) { +# ifdef RGBLIGHT_ENABLE + unicode_input_mode_set_user_rgb(input_mode); +# endif +} +#endif diff --git a/users/spidey3/spidey3.h b/users/spidey3/spidey3.h index e91b299e55..2b2cac0a20 100644 --- a/users/spidey3/spidey3.h +++ b/users/spidey3/spidey3.h @@ -6,7 +6,7 @@ #include QMK_KEYBOARD_H #ifdef UNICODEMAP_ENABLE -# include "unicode.h" +# include "spidey3_unicode.h" #endif enum userspace_layers { @@ -17,9 +17,7 @@ enum userspace_layers { }; enum custom_keycodes { - CH_CPNL = SAFE_RANGE, // AL Control Panel - CH_ASST, // AL Context-aware Desktop Assistant - CH_SUSP, // Suspend + CH_SUSP = SAFE_RANGE, // Suspend SPI_NORMAL, SPI_WIDE, @@ -65,6 +63,11 @@ void rgb_layer_ack(layer_ack_t n); void rgb_layer_ack_yn(bool yn); void clear_rgb_layers(void); void shutdown_user_rgb(void); + +# if defined(UNICODE_COMMON_ENABLE) +void unicode_input_mode_set_user_rgb(uint8_t input_mode); +# endif + #endif #ifdef UNICODEMAP_ENABLE diff --git a/users/spidey3/unicode.c b/users/spidey3/spidey3_unicode.c index 5292b0809b..c2804d8805 100644 --- a/users/spidey3/unicode.c +++ b/users/spidey3/spidey3_unicode.c @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later -#include "unicode.h" +#include "spidey3_unicode.h" const uint32_t PROGMEM unicode_map[] = { [BUL1] = 0x2022, // • diff --git a/users/spidey3/unicode.h b/users/spidey3/spidey3_unicode.h index ee8e00056c..ee8e00056c 100644 --- a/users/spidey3/unicode.h +++ b/users/spidey3/spidey3_unicode.h diff --git a/users/tominabox1/config.h b/users/tominabox1/config.h index f853e18605..5fd8ba3a74 100644 --- a/users/tominabox1/config.h +++ b/users/tominabox1/config.h @@ -22,7 +22,7 @@ #ifdef RGB_MATRIX_ENABLE #undef RGBLED_NUM #define RGBLED_NUM 50 - #define DRIVER_LED_TOTAL RGBLED_NUM + #define RGB_MATRIX_LED_COUNT RGBLED_NUM #endif // RGBL_MATRIX_ENABLE #endif // KEYBOARD_lazydesigners_dimple diff --git a/users/tominabox1/dimple_rgb.c b/users/tominabox1/dimple_rgb.c index 49d95eb43a..299dc830f1 100644 --- a/users/tominabox1/dimple_rgb.c +++ b/users/tominabox1/dimple_rgb.c @@ -1,7 +1,7 @@ #include "dz60rgb.h" #include "config.h" #if defined (dzrgb60_iso) -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, {0, K_12, J_12, L_12}, @@ -86,7 +86,7 @@ led_config_t g_led_config = { { } }; #elif defined (dzrgb60_hhkb) -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { {0, H_15, G_15, I_15}, {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, @@ -172,7 +172,7 @@ led_config_t g_led_config = { { } }; #elif defined (dzrgb60_hhkb_iso) -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { {0, H_15, G_15, I_15}, {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, @@ -258,7 +258,7 @@ led_config_t g_led_config = { { } }; #elif defined (dzrgb60_ansi) -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, {0, K_12, J_12, L_12}, @@ -343,7 +343,7 @@ led_config_t g_led_config = { { } }; #else -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { {0, K_14, J_14, L_14}, {0, K_13, J_13, L_13}, {0, K_12, J_12, L_12}, diff --git a/users/tominabox1/tominabox1.c b/users/tominabox1/tominabox1.c index b4ec224d07..999222fa67 100644 --- a/users/tominabox1/tominabox1.c +++ b/users/tominabox1/tominabox1.c @@ -58,7 +58,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode uint16_t time = scale16by8(g_rgb_counters.tick, speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } @@ -68,7 +68,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode default: // Solid Color { RGB rgb = hsv_to_rgb(hsv); - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { + for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) { if (HAS_FLAGS(g_led_config.flags[i], led_type)) { rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); } diff --git a/users/uqs/uqs.c b/users/uqs/uqs.c index 72284143c6..7e2d09e0f6 100644 --- a/users/uqs/uqs.c +++ b/users/uqs/uqs.c @@ -78,9 +78,9 @@ const rgblight_segment_t* const PROGMEM my_rgb_layers[] = { my_rgb_segments[L_MOUSE], }; -_Static_assert(sizeof(my_rgb_layers) / sizeof(my_rgb_layers[0]) == - sizeof(my_rgb_segments) / sizeof(my_rgb_segments[0]), - "Number of rgb_segment definitions does not match up!"); +_Static_assert(ARRAY_SIZE(my_rgb_layers) == + ARRAY_SIZE(my_rgb_segments), + "Number of rgb_segment definitions does not match up!"); #endif #ifdef COMBO_ENABLE @@ -125,7 +125,7 @@ const uint16_t PROGMEM my_combos[][4] = { {KC_BTN1, KC_BTN2, KC_BTN3, COMBO_END}, }; -const uint16_t COMBO_LEN = sizeof(my_action_combos) / sizeof(my_action_combos[0]) + sizeof(my_combos) / sizeof(my_combos[0]); +const uint16_t COMBO_LEN = ARRAY_SIZE(my_action_combos) + ARRAY_SIZE(my_combos); #define MY_ACTION_COMBO(ck) \ [ck] = { .keys = &(my_action_combos[ck][0]) } @@ -162,11 +162,11 @@ combo_t key_combos[] = { MY_COMBO(14), }; -_Static_assert(sizeof(key_combos) / sizeof(key_combos[0]) == - (sizeof(my_action_combos) / sizeof(my_action_combos[0]) + sizeof(my_combos) / sizeof(my_combos[0])), - "Number of combo definitions does not match up!"); +_Static_assert(ARRAY_SIZE(key_combos) == + (ARRAY_SIZE(my_action_combos) + ARRAY_SIZE(my_combos)), + "Number of combo definitions does not match up!"); #else -combo_t key_combos[sizeof(my_action_combos) / sizeof(my_action_combos[0]) + sizeof(my_combos) / sizeof(my_combos[0])]; +combo_t key_combos[ARRAY_SIZE(my_action_combos) + ARRAY_SIZE(my_combos)]; #endif void process_combo_event(uint16_t combo_index, bool pressed) { @@ -235,10 +235,10 @@ void keyboard_post_init_user(void) { #endif #if defined(COMBO_ENABLE) && !defined(COMBO_STATICALLY) uint8_t i = 0; - for (; i < sizeof(my_action_combos) / sizeof(my_action_combos[0]); i++) { + for (; i < ARRAY_SIZE(my_action_combos); i++) { key_combos[i].keys = &(my_action_combos[i][0]); } - for (uint8_t j = 0; j < sizeof(my_combos) / sizeof(my_combos[0]); j++, i++) { + for (uint8_t j = 0; j < ARRAY_SIZE(my_combos); j++, i++) { key_combos[i].keycode = my_combos[j][0]; key_combos[i].keys = &(my_combos[j][1]); } |