1
0
Fork 0

format code according to conventions [skip ci]

This commit is contained in:
QMK Bot 2020-03-10 20:24:13 +00:00
parent 2ffb08843b
commit 1aa40dde46
2 changed files with 23 additions and 20 deletions

View file

@ -104,7 +104,7 @@ LED_TYPE led[RGBLED_NUM];
#endif #endif
#ifdef RGBLIGHT_LAYERS #ifdef RGBLIGHT_LAYERS
rgblight_segment_t const * const *rgblight_layers = NULL; rgblight_segment_t const *const *rgblight_layers = NULL;
#endif #endif
static uint8_t clipping_start_pos = 0; 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) { static void rgblight_layers_write(void) {
uint8_t i = 0; uint8_t i = 0;
// For each layer // 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)) { 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) { if (segment_ptr == NULL) {
break; // No more layers break; // No more layers
} }
@ -654,7 +654,7 @@ static void rgblight_layers_write(void) {
break; // No more segments break; // No more segments
} }
// Write segment.count LEDs // 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++) { for (LED_TYPE *led_ptr = &led[segment.index]; led_ptr < limit; led_ptr++) {
sethsv(segment.hue, segment.sat, segment.val, led_ptr); sethsv(segment.hue, segment.sat, segment.val, led_ptr);
} }

View file

@ -180,17 +180,20 @@ typedef struct {
} rgblight_segment_t; } rgblight_segment_t;
# define RGBLIGHT_END_SEGMENT_INDEX (255) # define RGBLIGHT_END_SEGMENT_INDEX (255)
# define RGBLIGHT_END_SEGMENTS {RGBLIGHT_END_SEGMENT_INDEX, 0, 0, 0} # define RGBLIGHT_END_SEGMENTS \
{ RGBLIGHT_END_SEGMENT_INDEX, 0, 0, 0 }
# define RGBLIGHT_MAX_LAYERS 8 # define RGBLIGHT_MAX_LAYERS 8
# define RGBLIGHT_LAYER_SEGMENTS(...) { __VA_ARGS__, RGBLIGHT_END_SEGMENTS } # define RGBLIGHT_LAYER_SEGMENTS(...) \
# define RGBLIGHT_LAYERS_LIST(...) { __VA_ARGS__, NULL } { __VA_ARGS__, RGBLIGHT_END_SEGMENTS }
# define RGBLIGHT_LAYERS_LIST(...) \
{ __VA_ARGS__, NULL }
// Get/set enabled rgblight layers // Get/set enabled rgblight layers
void rgblight_set_layer_state(uint8_t layer, bool enabled); void rgblight_set_layer_state(uint8_t layer, bool enabled);
bool rgblight_get_layer_state(uint8_t layer); 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 // 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 # endif
extern LED_TYPE led[RGBLED_NUM]; 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) # 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); 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_task(void);
void rgblight_timer_init(void); void rgblight_timer_init(void);
void rgblight_timer_enable(void); void rgblight_timer_enable(void);
void rgblight_timer_disable(void); void rgblight_timer_disable(void);
void rgblight_timer_toggle(void); void rgblight_timer_toggle(void);
#else # else
#define rgblight_task() # define rgblight_task()
#define rgblight_timer_init() # define rgblight_timer_init()
#define rgblight_timer_enable() # define rgblight_timer_enable()
#define rgblight_timer_disable() # define rgblight_timer_disable()
#define rgblight_timer_toggle() # define rgblight_timer_toggle()
#endif # endif
# ifdef RGBLIGHT_SPLIT # ifdef RGBLIGHT_SPLIT
# define RGBLIGHT_STATUS_CHANGE_MODE (1 << 0) # define RGBLIGHT_STATUS_CHANGE_MODE (1 << 0)