diff options
-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 b3f0f18d4..cc35b01ed 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 40f267daa..97882c5b2 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) |