diff options
author | QMK Bot <hello@qmk.fm> | 2020-03-10 20:24:13 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2020-03-10 20:24:13 +0000 |
commit | 1aa40dde46ae38e2768fd23e4d7a3bdd8838f724 (patch) | |
tree | 5db72dfae3dd6d3f6d5e3247b37e56cc795e3859 | |
parent | 2ffb08843ba59f0af0870335934bdb277fc85620 (diff) |
format code according to conventions [skip ci]
-rw-r--r-- | quantum/rgblight.c | 10 | ||||
-rw-r--r-- | quantum/rgblight.h | 33 |
2 files changed, 23 insertions, 20 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index b3f0f18d42..cc35b01ed4 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -104,7 +104,7 @@ LED_TYPE led[RGBLED_NUM]; #endif #ifdef RGBLIGHT_LAYERS -rgblight_segment_t const * const *rgblight_layers = NULL; +rgblight_segment_t const *const *rgblight_layers = NULL; #endif static uint8_t clipping_start_pos = 0; @@ -638,11 +638,11 @@ bool rgblight_get_layer_state(uint8_t layer) { static void rgblight_layers_write(void) { uint8_t i = 0; // For each layer - for (const rgblight_segment_t * const *layer_ptr = rgblight_layers; i < RGBLIGHT_MAX_LAYERS; layer_ptr++, i++) { + for (const rgblight_segment_t *const *layer_ptr = rgblight_layers; i < RGBLIGHT_MAX_LAYERS; layer_ptr++, i++) { if (!rgblight_get_layer_state(i)) { - continue; // Layer is disabled + continue; // Layer is disabled } - const rgblight_segment_t * segment_ptr = pgm_read_ptr(layer_ptr); + const rgblight_segment_t *segment_ptr = pgm_read_ptr(layer_ptr); if (segment_ptr == NULL) { break; // No more layers } @@ -654,7 +654,7 @@ static void rgblight_layers_write(void) { break; // No more segments } // Write segment.count LEDs - LED_TYPE * const limit = &led[MIN(segment.index + segment.count, RGBLED_NUM)]; + LED_TYPE *const limit = &led[MIN(segment.index + segment.count, RGBLED_NUM)]; for (LED_TYPE *led_ptr = &led[segment.index]; led_ptr < limit; led_ptr++) { sethsv(segment.hue, segment.sat, segment.val, led_ptr); } diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 40f267daa2..97882c5b29 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -172,25 +172,28 @@ enum RGBLIGHT_EFFECT_MODE { # ifdef RGBLIGHT_LAYERS typedef struct { - uint8_t index; // The first LED to light - uint8_t count; // The number of LEDs to light + uint8_t index; // The first LED to light + uint8_t count; // The number of LEDs to light uint8_t hue; uint8_t sat; uint8_t val; } rgblight_segment_t; -# define RGBLIGHT_END_SEGMENT_INDEX (255) -# define RGBLIGHT_END_SEGMENTS {RGBLIGHT_END_SEGMENT_INDEX, 0, 0, 0} +# define RGBLIGHT_END_SEGMENT_INDEX (255) +# define RGBLIGHT_END_SEGMENTS \ + { RGBLIGHT_END_SEGMENT_INDEX, 0, 0, 0 } # define RGBLIGHT_MAX_LAYERS 8 -# define RGBLIGHT_LAYER_SEGMENTS(...) { __VA_ARGS__, RGBLIGHT_END_SEGMENTS } -# define RGBLIGHT_LAYERS_LIST(...) { __VA_ARGS__, NULL } +# define RGBLIGHT_LAYER_SEGMENTS(...) \ + { __VA_ARGS__, RGBLIGHT_END_SEGMENTS } +# define RGBLIGHT_LAYERS_LIST(...) \ + { __VA_ARGS__, NULL } // Get/set enabled rgblight layers void rgblight_set_layer_state(uint8_t layer, bool enabled); bool rgblight_get_layer_state(uint8_t layer); // Point this to an array of rgblight_segment_t arrays in keyboard_post_init_user to use rgblight layers -extern const rgblight_segment_t * const * rgblight_layers; +extern const rgblight_segment_t *const *rgblight_layers; # endif extern LED_TYPE led[RGBLED_NUM]; @@ -320,19 +323,19 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom); # define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); -#ifdef RGBLIGHT_USE_TIMER +# ifdef RGBLIGHT_USE_TIMER void rgblight_task(void); void rgblight_timer_init(void); void rgblight_timer_enable(void); void rgblight_timer_disable(void); void rgblight_timer_toggle(void); -#else -#define rgblight_task() -#define rgblight_timer_init() -#define rgblight_timer_enable() -#define rgblight_timer_disable() -#define rgblight_timer_toggle() -#endif +# else +# define rgblight_task() +# define rgblight_timer_init() +# define rgblight_timer_enable() +# define rgblight_timer_disable() +# define rgblight_timer_toggle() +# endif # ifdef RGBLIGHT_SPLIT # define RGBLIGHT_STATUS_CHANGE_MODE (1 << 0) |