diff options
| author | Ryan <fauxpark@gmail.com> | 2024-01-08 17:28:40 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-08 17:28:40 +1100 |
| commit | 8b95dc6e00a9e5c9123a5b9dce7f50326dfb96aa (patch) | |
| tree | 1f945a273485b063793a6d7338097ac95cf57826 /keyboards/input_club | |
| parent | 7467231158476d050962a64a222c557480ce6666 (diff) | |
LED drivers: more formatting (#22865)
Diffstat (limited to 'keyboards/input_club')
| -rw-r--r-- | keyboards/input_club/k_type/is31fl3733-dual.c | 6 | ||||
| -rw-r--r-- | keyboards/input_club/k_type/is31fl3733-dual.h | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/keyboards/input_club/k_type/is31fl3733-dual.c b/keyboards/input_club/k_type/is31fl3733-dual.c index 33734001e0..4b40175994 100644 --- a/keyboards/input_club/k_type/is31fl3733-dual.c +++ b/keyboards/input_club/k_type/is31fl3733-dual.c | |||
| @@ -125,6 +125,7 @@ bool is31fl3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffe | |||
| 125 | 125 | ||
| 126 | void is31fl3733_init_drivers(void) { | 126 | void is31fl3733_init_drivers(void) { |
| 127 | i2c_init(&I2CD1, I2C1_SCL_PIN, I2C1_SDA_PIN); | 127 | i2c_init(&I2CD1, I2C1_SCL_PIN, I2C1_SDA_PIN); |
| 128 | |||
| 128 | is31fl3733_init(0, IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); | 129 | is31fl3733_init(0, IS31FL3733_I2C_ADDRESS_1, IS31FL3733_SYNC_1); |
| 129 | # ifdef USE_I2C2 | 130 | # ifdef USE_I2C2 |
| 130 | i2c_init(&I2CD2, I2C2_SCL_PIN, I2C2_SDA_PIN); | 131 | i2c_init(&I2CD2, I2C2_SCL_PIN, I2C2_SDA_PIN); |
| @@ -180,12 +181,14 @@ void is31fl3733_init(uint8_t bus, uint8_t addr, uint8_t sync) { | |||
| 180 | 181 | ||
| 181 | void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 182 | void is31fl3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 182 | is31fl3733_led_t led; | 183 | is31fl3733_led_t led; |
| 184 | |||
| 183 | if (index >= 0 && index < IS31FL3733_LED_COUNT) { | 185 | if (index >= 0 && index < IS31FL3733_LED_COUNT) { |
| 184 | memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); | 186 | memcpy_P(&led, (&g_is31fl3733_leds[index]), sizeof(led)); |
| 185 | 187 | ||
| 186 | if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { | 188 | if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { |
| 187 | return; | 189 | return; |
| 188 | } | 190 | } |
| 191 | |||
| 189 | g_pwm_buffer[led.driver][led.r] = red; | 192 | g_pwm_buffer[led.driver][led.r] = red; |
| 190 | g_pwm_buffer[led.driver][led.g] = green; | 193 | g_pwm_buffer[led.driver][led.g] = green; |
| 191 | g_pwm_buffer[led.driver][led.b] = blue; | 194 | g_pwm_buffer[led.driver][led.b] = blue; |
| @@ -249,8 +252,9 @@ void is31fl3733_update_led_control_registers(uint8_t addr, uint8_t index) { | |||
| 249 | for (int i = 0; i < IS31FL3733_LED_CONTROL_REGISTER_COUNT; i++) { | 252 | for (int i = 0; i < IS31FL3733_LED_CONTROL_REGISTER_COUNT; i++) { |
| 250 | is31fl3733_write_register(index, addr, i, g_led_control_registers[index][i]); | 253 | is31fl3733_write_register(index, addr, i, g_led_control_registers[index][i]); |
| 251 | } | 254 | } |
| 255 | |||
| 256 | g_led_control_registers_update_required[index] = false; | ||
| 252 | } | 257 | } |
| 253 | g_led_control_registers_update_required[index] = false; | ||
| 254 | } | 258 | } |
| 255 | 259 | ||
| 256 | void is31fl3733_flush(void) { | 260 | void is31fl3733_flush(void) { |
diff --git a/keyboards/input_club/k_type/is31fl3733-dual.h b/keyboards/input_club/k_type/is31fl3733-dual.h index 3368794cba..21dd701525 100644 --- a/keyboards/input_club/k_type/is31fl3733-dual.h +++ b/keyboards/input_club/k_type/is31fl3733-dual.h | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <stdint.h> | 21 | #include <stdint.h> |
| 22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
| 23 | #include "progmem.h" | 23 | #include "progmem.h" |
| 24 | #include "util.h" | ||
| 24 | 25 | ||
| 25 | #define IS31FL3733_REG_INTERRUPT_MASK 0xF0 | 26 | #define IS31FL3733_REG_INTERRUPT_MASK 0xF0 |
| 26 | #define IS31FL3733_REG_INTERRUPT_STATUS 0xF1 | 27 | #define IS31FL3733_REG_INTERRUPT_STATUS 0xF1 |
| @@ -77,7 +78,7 @@ typedef struct is31fl3733_led_t { | |||
| 77 | uint8_t r; | 78 | uint8_t r; |
| 78 | uint8_t g; | 79 | uint8_t g; |
| 79 | uint8_t b; | 80 | uint8_t b; |
| 80 | } __attribute__((packed)) is31fl3733_led_t; | 81 | } PACKED is31fl3733_led_t; |
| 81 | 82 | ||
| 82 | extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT]; | 83 | extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT]; |
| 83 | 84 | ||
