Browse Source

fix lint with clang-format

xmkb
Nick 4 years ago
parent
commit
608ae0df6d
  1. 39
      app/src/rgb_underglow.c
  2. 9
      app/src/settings.c

39
app/src/rgb_underglow.c

@ -52,9 +52,7 @@ struct led_rgb pixels[STRIP_NUM_PIXELS]; @@ -52,9 +52,7 @@ struct led_rgb pixels[STRIP_NUM_PIXELS];
struct rgb_underglow_state state;
#if IS_ENABLED(CONFIG_SETTINGS)
static int rgb_settings_set(const char *name, size_t len,
settings_read_cb read_cb, void *cb_arg)
{
static int rgb_settings_set(const char *name, size_t len, settings_read_cb read_cb, void *cb_arg) {
const char *next;
int rc;
@ -74,14 +72,10 @@ static int rgb_settings_set(const char *name, size_t len, @@ -74,14 +72,10 @@ static int rgb_settings_set(const char *name, size_t len,
return -ENOENT;
}
struct settings_handler rgb_conf = {
.name = "rgb/underglow",
.h_set = rgb_settings_set
};
struct settings_handler rgb_conf = {.name = "rgb/underglow", .h_set = rgb_settings_set};
#endif
static struct led_rgb hsb_to_rgb(struct led_hsb hsb)
{
static struct led_rgb hsb_to_rgb(struct led_hsb hsb) {
double r, g, b;
u8_t i = hsb.h / 60;
@ -130,20 +124,16 @@ static struct led_rgb hsb_to_rgb(struct led_hsb hsb) @@ -130,20 +124,16 @@ static struct led_rgb hsb_to_rgb(struct led_hsb hsb)
return rgb;
}
static void zmk_rgb_underglow_off()
{
for (int i=0; i<STRIP_NUM_PIXELS; i++)
{
static void zmk_rgb_underglow_off() {
for (int i = 0; i < STRIP_NUM_PIXELS; i++) {
pixels[i] = (struct led_rgb){r : 0, g : 0, b : 0};
}
led_strip_update_rgb(led_strip, pixels, STRIP_NUM_PIXELS);
}
static void zmk_rgb_underglow_effect_solid()
{
for (int i=0; i<STRIP_NUM_PIXELS; i++)
{
static void zmk_rgb_underglow_effect_solid() {
for (int i = 0; i < STRIP_NUM_PIXELS; i++) {
int hue = state.hue;
int sat = state.saturation;
int brt = state.brightness;
@ -223,10 +213,8 @@ static void zmk_rgb_underglow_tick(struct k_work *work) { @@ -223,10 +213,8 @@ static void zmk_rgb_underglow_tick(struct k_work *work) {
K_WORK_DEFINE(underglow_work, zmk_rgb_underglow_tick);
static void zmk_rgb_underglow_tick_handler(struct k_timer *timer)
{
if (!state.on)
{
static void zmk_rgb_underglow_tick_handler(struct k_timer *timer) {
if (!state.on) {
zmk_rgb_underglow_off();
k_timer_stop(timer);
@ -267,8 +255,7 @@ static int zmk_rgb_underglow_init(struct device *_arg) { @@ -267,8 +255,7 @@ static int zmk_rgb_underglow_init(struct device *_arg) {
return 0;
}
int zmk_rgb_underglow_save_state()
{
int zmk_rgb_underglow_save_state() {
#if IS_ENABLED(CONFIG_SETTINGS)
return settings_save_one("rgb/underglow/state", &state, sizeof(state));
#else
@ -276,9 +263,9 @@ int zmk_rgb_underglow_save_state() @@ -276,9 +263,9 @@ int zmk_rgb_underglow_save_state()
#endif
}
int zmk_rgb_underglow_cycle_effect(int direction)
{
if (!led_strip) return -ENODEV;
int zmk_rgb_underglow_cycle_effect(int direction) {
if (!led_strip)
return -ENODEV;
if (state.current_effect == 0 && direction < 0) {
state.current_effect = UNDERGLOW_EFFECT_NUMBER - 1;

9
app/src/settings.c

@ -3,11 +3,6 @@ @@ -3,11 +3,6 @@
#include <kernel.h>
#include <settings/settings.h>
static int zmk_settings_init(struct device *_arg)
{
return settings_load();
}
static int zmk_settings_init(struct device *_arg) { return settings_load(); }
SYS_INIT(zmk_settings_init,
APPLICATION,
CONFIG_APPLICATION_INIT_PRIORITY);
SYS_INIT(zmk_settings_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);

Loading…
Cancel
Save