From 46f7cdbc2106e916a0976d1be511efdcf5169ffd Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Mon, 23 Mar 2020 11:03:19 -0700 Subject: [PATCH] clang format pass --- users/drashna/oled_stuff.h | 157 +++++++++++++++---------------- users/drashna/process_records.c | 5 +- users/drashna/process_records.h | 18 ++-- users/drashna/rgb_matrix_stuff.c | 1 - users/drashna/rgb_matrix_stuff.h | 6 +- users/drashna/rgb_stuff.c | 117 +++++++++++------------ users/drashna/rgb_stuff.h | 2 +- 7 files changed, 150 insertions(+), 156 deletions(-) diff --git a/users/drashna/oled_stuff.h b/users/drashna/oled_stuff.h index 0a8db51c7f19..88a48c2b6066 100644 --- a/users/drashna/oled_stuff.h +++ b/users/drashna/oled_stuff.h @@ -7,86 +7,85 @@ void oled_driver_render_logo(void); bool process_record_user_oled(uint16_t keycode, keyrecord_t *record); #ifdef OLED_DISPLAY_128X64 -#define OLED_RENDER_KEYLOGGER "Keylogger: " - -#define OLED_RENDER_LAYOUT_NAME "Layout: " -#define OLED_RENDER_LAYOUT_QWERTY "Qwerty" -#define OLED_RENDER_LAYOUT_COLEMAK "Colemak" -#define OLED_RENDER_LAYOUT_DVORAK "Dvorak" -#define OLED_RENDER_LAYOUT_WORKMAN "Workman" -#define OLED_RENDER_LAYOUT_NORMAN "Norman" -#define OLED_RENDER_LAYOUT_MALTRON "Matron" -#define OLED_RENDER_LAYOUT_EUCALYN "Eucalyn" -#define OLED_RENDER_LAYOUT_CARPLAX "Carplax" - -#define OLED_RENDER_LAYER_NAME "Layer:\n" -#define OLED_RENDER_LAYER_LOWER " Lower" -#define OLED_RENDER_LAYER_RAISE " Raise" -#define OLED_RENDER_LAYER_ADJUST " Adjust" -#define OLED_RENDER_LAYER_MODS " Mods" - -#define OLED_RENDER_LOCK_NAME "Lock: " -#define OLED_RENDER_LOCK_NUML "NUML" -#define OLED_RENDER_LOCK_CAPS "CAPS" -#define OLED_RENDER_LOCK_SCLK "SCLK" - -#define OLED_RENDER_MODS_NAME "Mods: " -#define OLED_RENDER_MODS_SFT "Sft" -#define OLED_RENDER_MODS_CTL "Ctl" -#define OLED_RENDER_MODS_ALT "Alt" -#define OLED_RENDER_MODS_GUI "GUI" - -#define OLED_RENDER_BOOTMAGIC_NAME "Boot " -#define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" -#define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" -#define OLED_RENDER_BOOTMAGIC_GRV "GRV" -#define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" - -#define OLED_RENDER_USER_NAME "USER:" -#define OLED_RENDER_USER_ANIM "Anim" -#define OLED_RENDER_USER_LAYR "Layr" -#define OLED_RENDER_USER_NUKE "Nuke" +# define OLED_RENDER_KEYLOGGER "Keylogger: " + +# define OLED_RENDER_LAYOUT_NAME "Layout: " +# define OLED_RENDER_LAYOUT_QWERTY "Qwerty" +# define OLED_RENDER_LAYOUT_COLEMAK "Colemak" +# define OLED_RENDER_LAYOUT_DVORAK "Dvorak" +# define OLED_RENDER_LAYOUT_WORKMAN "Workman" +# define OLED_RENDER_LAYOUT_NORMAN "Norman" +# define OLED_RENDER_LAYOUT_MALTRON "Matron" +# define OLED_RENDER_LAYOUT_EUCALYN "Eucalyn" +# define OLED_RENDER_LAYOUT_CARPLAX "Carplax" + +# define OLED_RENDER_LAYER_NAME "Layer:\n" +# define OLED_RENDER_LAYER_LOWER " Lower" +# define OLED_RENDER_LAYER_RAISE " Raise" +# define OLED_RENDER_LAYER_ADJUST " Adjust" +# define OLED_RENDER_LAYER_MODS " Mods" + +# define OLED_RENDER_LOCK_NAME "Lock: " +# define OLED_RENDER_LOCK_NUML "NUML" +# define OLED_RENDER_LOCK_CAPS "CAPS" +# define OLED_RENDER_LOCK_SCLK "SCLK" + +# define OLED_RENDER_MODS_NAME "Mods: " +# define OLED_RENDER_MODS_SFT "Sft" +# define OLED_RENDER_MODS_CTL "Ctl" +# define OLED_RENDER_MODS_ALT "Alt" +# define OLED_RENDER_MODS_GUI "GUI" + +# define OLED_RENDER_BOOTMAGIC_NAME "Boot " +# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" +# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" +# define OLED_RENDER_BOOTMAGIC_GRV "GRV" +# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" + +# define OLED_RENDER_USER_NAME "USER:" +# define OLED_RENDER_USER_ANIM "Anim" +# define OLED_RENDER_USER_LAYR "Layr" +# define OLED_RENDER_USER_NUKE "Nuke" #else -#define OLED_RENDER_KEYLOGGER "KLogr" - -#define OLED_RENDER_LAYOUT_NAME "Lyout" -#define OLED_RENDER_LAYOUT_QWERTY " QRTY" -#define OLED_RENDER_LAYOUT_COLEMAK " COLE" -#define OLED_RENDER_LAYOUT_DVORAK " DVRK" -#define OLED_RENDER_LAYOUT_WORKMAN " WKMN" -#define OLED_RENDER_LAYOUT_NORMAN " NORM" -#define OLED_RENDER_LAYOUT_MALTRON " MLTN" -#define OLED_RENDER_LAYOUT_EUCALYN " ECLN" -#define OLED_RENDER_LAYOUT_CARPLAX " CRPX" - -#define OLED_RENDER_LAYER_NAME "LAYER" -#define OLED_RENDER_LAYER_LOWER "Lower" -#define OLED_RENDER_LAYER_RAISE "Raise" -#define OLED_RENDER_LAYER_ADJUST "Adjst" -#define OLED_RENDER_LAYER_MODS " Mods" - -#define OLED_RENDER_LOCK_NAME "Lock:" -#define OLED_RENDER_LOCK_NUML "N" -#define OLED_RENDER_LOCK_CAPS "C" -#define OLED_RENDER_LOCK_SCLK "S" - -#define OLED_RENDER_MODS_NAME "Mods: " -#define OLED_RENDER_MODS_SFT "S" -#define OLED_RENDER_MODS_CTL "C" -#define OLED_RENDER_MODS_ALT "A" -#define OLED_RENDER_MODS_GUI "G" - -#define OLED_RENDER_BOOTMAGIC_NAME "BTMGK" -#define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" -#define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" -#define OLED_RENDER_BOOTMAGIC_GRV "GRV" -#define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" - -#define OLED_RENDER_USER_NAME "USER:" -#define OLED_RENDER_USER_ANIM "Anim" -#define OLED_RENDER_USER_LAYR "Layr" -#define OLED_RENDER_USER_NUKE "Nuke" - +# define OLED_RENDER_KEYLOGGER "KLogr" + +# define OLED_RENDER_LAYOUT_NAME "Lyout" +# define OLED_RENDER_LAYOUT_QWERTY " QRTY" +# define OLED_RENDER_LAYOUT_COLEMAK " COLE" +# define OLED_RENDER_LAYOUT_DVORAK " DVRK" +# define OLED_RENDER_LAYOUT_WORKMAN " WKMN" +# define OLED_RENDER_LAYOUT_NORMAN " NORM" +# define OLED_RENDER_LAYOUT_MALTRON " MLTN" +# define OLED_RENDER_LAYOUT_EUCALYN " ECLN" +# define OLED_RENDER_LAYOUT_CARPLAX " CRPX" + +# define OLED_RENDER_LAYER_NAME "LAYER" +# define OLED_RENDER_LAYER_LOWER "Lower" +# define OLED_RENDER_LAYER_RAISE "Raise" +# define OLED_RENDER_LAYER_ADJUST "Adjst" +# define OLED_RENDER_LAYER_MODS " Mods" + +# define OLED_RENDER_LOCK_NAME "Lock:" +# define OLED_RENDER_LOCK_NUML "N" +# define OLED_RENDER_LOCK_CAPS "C" +# define OLED_RENDER_LOCK_SCLK "S" + +# define OLED_RENDER_MODS_NAME "Mods: " +# define OLED_RENDER_MODS_SFT "S" +# define OLED_RENDER_MODS_CTL "C" +# define OLED_RENDER_MODS_ALT "A" +# define OLED_RENDER_MODS_GUI "G" + +# define OLED_RENDER_BOOTMAGIC_NAME "BTMGK" +# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" +# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" +# define OLED_RENDER_BOOTMAGIC_GRV "GRV" +# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" + +# define OLED_RENDER_USER_NAME "USER:" +# define OLED_RENDER_USER_ANIM "Anim" +# define OLED_RENDER_USER_LAYR "Layr" +# define OLED_RENDER_USER_NUKE "Nuke" #endif diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c index 5b6a21979a34..101b3d95ceaa 100644 --- a/users/drashna/process_records.c +++ b/users/drashna/process_records.c @@ -19,10 +19,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif // KEYLOGGER_ENABLE #ifdef OLED_DRIVER_ENABLE process_record_user_oled(keycode, record); -#endif // OLED +#endif // OLED - if (process_record_keymap(keycode, record) - && process_record_secrets(keycode, record) + if (process_record_keymap(keycode, record) && process_record_secrets(keycode, record) #ifdef RGB_MATRIX_ENABLE && process_record_user_rgb_matrix(keycode, record) #endif diff --git a/users/drashna/process_records.h b/users/drashna/process_records.h index cb7ec3ec401d..999882d4bc9c 100644 --- a/users/drashna/process_records.h +++ b/users/drashna/process_records.h @@ -34,13 +34,13 @@ enum userspace_custom_keycodes { bool process_record_secrets(uint16_t keycode, keyrecord_t *record); bool process_record_keymap(uint16_t keycode, keyrecord_t *record); -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) -#define ADJUST MO(_ADJUST) +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) +#define ADJUST MO(_ADJUST) #define TG_MODS TG(_MODS) #define TG_GAME TG(_GAMEPAD) -#define OS_LWR OSL(_LOWER) -#define OS_RSE OSL(_RAISE) +#define OS_LWR OSL(_LOWER) +#define OS_RSE OSL(_RAISE) #define KC_SEC1 KC_SECRET_1 #define KC_SEC2 KC_SECRET_2 @@ -48,13 +48,13 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record); #define KC_SEC4 KC_SECRET_4 #define KC_SEC5 KC_SECRET_5 -#define QWERTY KC_QWERTY -#define DVORAK KC_DVORAK +#define QWERTY KC_QWERTY +#define DVORAK KC_DVORAK #define COLEMAK KC_COLEMAK #define WORKMAN KC_WORKMAN #define KC_RESET RESET -#define KC_RST KC_RESET +#define KC_RST KC_RESET #ifdef SWAP_HANDS_ENABLE # define KC_C1R3 SH_T(KC_TAB) @@ -81,7 +81,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record); #define OS_RCTL OSM(MOD_RCTL) #define OS_LALT OSM(MOD_LALT) #define OS_RALT OSM(MOD_RALT) -#define OS_MEH OSM(MOD_MEH) +#define OS_MEH OSM(MOD_MEH) #define OS_HYPR OSM(MOD_HYPR) #define ALT_APP ALT_T(KC_APP) diff --git a/users/drashna/rgb_matrix_stuff.c b/users/drashna/rgb_matrix_stuff.c index f1e6a99a62c6..0914aab14447 100644 --- a/users/drashna/rgb_matrix_stuff.c +++ b/users/drashna/rgb_matrix_stuff.c @@ -81,7 +81,6 @@ bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record) { } #endif break; - } return true; } diff --git a/users/drashna/rgb_matrix_stuff.h b/users/drashna/rgb_matrix_stuff.h index f110b91e70f8..35b01047b654 100644 --- a/users/drashna/rgb_matrix_stuff.h +++ b/users/drashna/rgb_matrix_stuff.h @@ -1,9 +1,9 @@ #pragma once #include "quantum.h" -bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record); -void keyboard_post_init_rgb_matrix(void); -void matrix_scan_rgb_matrix(void); +bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record); +void keyboard_post_init_rgb_matrix(void); +void matrix_scan_rgb_matrix(void); void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type); diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index e5928a7338e6..06b1e3c0c411 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -7,74 +7,72 @@ bool has_initialized; void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, index); } - - /* Custom indicators for modifiers. * This allows for certain lights to be lit up, based on what mods are active, giving some visual feedback. * This is especially useful for One Shot Mods, since it's not always obvious if they're still lit up. */ -# ifdef INDICATOR_LIGHTS +#ifdef INDICATOR_LIGHTS void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { if (userspace_config.rgb_layer_change && get_highest_layer(layer_state) == 0) { if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) { -# ifdef SHFT_LED1 +# ifdef SHFT_LED1 rgblight_sethsv_at(120, 255, 255, SHFT_LED1); -# endif // SHFT_LED1 -# ifdef SHFT_LED2 +# endif // SHFT_LED1 +# ifdef SHFT_LED2 rgblight_sethsv_at(120, 255, 255, SHFT_LED2); -# endif // SHFT_LED2 +# endif // SHFT_LED2 } else { -# ifdef SHFT_LED1 +# ifdef SHFT_LED1 rgblight_sethsv_default_helper(SHFT_LED1); -# endif // SHFT_LED1 -# ifdef SHFT_LED2 +# endif // SHFT_LED1 +# ifdef SHFT_LED2 rgblight_sethsv_default_helper(SHFT_LED2); -# endif // SHFT_LED2 +# endif // SHFT_LED2 } if ((this_mod | this_osm) & MOD_MASK_CTRL) { -# ifdef CTRL_LED1 +# ifdef CTRL_LED1 rgblight_sethsv_at(0, 255, 255, CTRL_LED1); -# endif // CTRL_LED1 -# ifdef CTRL_LED2 +# endif // CTRL_LED1 +# ifdef CTRL_LED2 rgblight_sethsv_at(0, 255, 255, CTRL_LED2); -# endif // CTRL_LED2 +# endif // CTRL_LED2 } else { -# ifdef CTRL_LED1 +# ifdef CTRL_LED1 rgblight_sethsv_default_helper(CTRL_LED1); -# endif // CTRL_LED1 -# ifdef CTRL_LED2 +# endif // CTRL_LED1 +# ifdef CTRL_LED2 rgblight_sethsv_default_helper(CTRL_LED2); -# endif // CTRL_LED2 +# endif // CTRL_LED2 } if ((this_mod | this_osm) & MOD_MASK_GUI) { -# ifdef GUI_LED1 +# ifdef GUI_LED1 rgblight_sethsv_at(51, 255, 255, GUI_LED1); -# endif // GUI_LED1 -# ifdef GUI_LED2 +# endif // GUI_LED1 +# ifdef GUI_LED2 rgblight_sethsv_at(51, 255, 255, GUI_LED2); -# endif // GUI_LED2 +# endif // GUI_LED2 } else { -# ifdef GUI_LED1 +# ifdef GUI_LED1 rgblight_sethsv_default_helper(GUI_LED1); -# endif // GUI_LED1 -# ifdef GUI_LED2 +# endif // GUI_LED1 +# ifdef GUI_LED2 rgblight_sethsv_default_helper(GUI_LED2); -# endif // GUI_LED2 +# endif // GUI_LED2 } if ((this_mod | this_osm) & MOD_MASK_ALT) { -# ifdef ALT_LED1 +# ifdef ALT_LED1 rgblight_sethsv_at(240, 255, 255, ALT_LED1); -# endif // ALT_LED1 -# ifdef GUI_LED2 +# endif // ALT_LED1 +# ifdef GUI_LED2 rgblight_sethsv_at(240, 255, 255, ALT_LED2); -# endif // GUI_LED2 +# endif // GUI_LED2 } else { -# ifdef GUI_LED1 +# ifdef GUI_LED1 rgblight_sethsv_default_helper(ALT_LED1); -# endif // GUI_LED1 -# ifdef GUI_LED2 +# endif // GUI_LED1 +# ifdef GUI_LED2 rgblight_sethsv_default_helper(ALT_LED2); -# endif // GUI_LED2 +# endif // GUI_LED2 } } } @@ -85,9 +83,9 @@ void matrix_scan_indicator(void) { set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); } } -# endif // INDICATOR_LIGHTS +#endif // INDICATOR_LIGHTS -# ifdef RGBLIGHT_TWINKLE +#ifdef RGBLIGHT_TWINKLE static rgblight_fadeout lights[RGBLED_NUM]; __attribute__((weak)) bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { return false; } @@ -95,40 +93,40 @@ __attribute__((weak)) bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { /* This function checks for used LEDs. This way, collisions don't occur and cause weird rendering */ bool rgblight_twinkle_is_led_used(uint8_t index) { switch (index) { -# ifdef INDICATOR_LIGHTS -# ifdef SHFT_LED1 +# ifdef INDICATOR_LIGHTS +# ifdef SHFT_LED1 case SHFT_LED1: return true; -# endif // SHFT_LED1 -# ifdef SHFT_LED2 +# endif // SHFT_LED1 +# ifdef SHFT_LED2 case SHFT_LED2: return true; -# endif // SHFT_LED2 -# ifdef CTRL_LED1 +# endif // SHFT_LED2 +# ifdef CTRL_LED1 case CTRL_LED1: return true; -# endif // CTRL_LED1 -# ifdef CTRL_LED2 +# endif // CTRL_LED1 +# ifdef CTRL_LED2 case CTRL_LED2: return true; -# endif // CTRL_LED2 -# ifdef GUI_LED1 +# endif // CTRL_LED2 +# ifdef GUI_LED1 case GUI_LED1: return true; -# endif // GUI_LED1 -# ifdef GUI_LED2 +# endif // GUI_LED1 +# ifdef GUI_LED2 case GUI_LED2: return true; -# endif // GUI_LED2 -# ifdef ALT_LED1 +# endif // GUI_LED2 +# ifdef ALT_LED1 case ALT_LED1: return true; -# endif // ALT_LED1 -# ifdef ALT_LED2 +# endif // ALT_LED1 +# ifdef ALT_LED2 case ALT_LED2: return true; -# endif // ALT_LED2 -# endif // INDICATOR_LIGHTS +# endif // ALT_LED2 +# endif // INDICATOR_LIGHTS default: return rgblight_twinkle_is_led_used_keymap(index); } @@ -203,7 +201,7 @@ void start_rgb_light(void) { rgblight_sethsv_at(light->hue, 255, light->life, light_index); } -# endif +#endif bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) { uint16_t temp_keycode = keycode; @@ -224,13 +222,13 @@ bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) { start_rgb_light(); } break; -#endif // RGBLIGHT_TWINKLE +#endif // RGBLIGHT_TWINKLE } return true; } void keyboard_post_init_rgb_light(void) { -# if defined(RGBLIGHT_STARTUP_ANIMATION) +#if defined(RGBLIGHT_STARTUP_ANIMATION) bool is_enabled = rgblight_config.enable; if (userspace_config.rgb_layer_change) { rgblight_enable_noeeprom(); @@ -249,7 +247,7 @@ void keyboard_post_init_rgb_light(void) { rgblight_disable_noeeprom(); } -# endif +#endif layer_state_set_rgb_light(layer_state); } @@ -263,7 +261,6 @@ void matrix_scan_rgb_light(void) { matrix_scan_indicator(); # endif #endif - } void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) { diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h index 6569198e78ae..98a552db1b83 100644 --- a/users/drashna/rgb_stuff.h +++ b/users/drashna/rgb_stuff.h @@ -15,7 +15,7 @@ void keyboard_post_init_rgb_light(void); void matrix_scan_rgb_light(void); layer_state_t layer_state_set_rgb_light(layer_state_t state); layer_state_t default_layer_state_set_rgb_light(layer_state_t state); -void rgblight_sethsv_default_helper(uint8_t index); +void rgblight_sethsv_default_helper(uint8_t index); #if defined(RGBLIGHT_TWINKLE) void scan_rgblight_fadeout(void);