Skip to content

Commit

Permalink
IS31FL3741 driver fixup (qmk#10519)
Browse files Browse the repository at this point in the history
* Fix issue with data transfer of CS1_SW7 to CS18_SW7.

* Fix issue with handling of scaling register buffer's dirty flag.

* Remove unused extern declaration.

* Compaction of struct is31_led utilizing bit fields.
  • Loading branch information
elfmimi authored Oct 3, 2020
1 parent a839dc6 commit 0743096
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions drivers/issi/is31fl3741.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,13 @@ bool IS31FL3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM0);

for (int i = 0; i < 342; i += 18) {
g_twi_transfer_buffer[0] = i % 180;

if (i == 180) {
// unlock the command register and select PG2
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM1);
}

g_twi_transfer_buffer[0] = i % 180;
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 18);

#if ISSI_PERSISTENCE > 0
Expand Down Expand Up @@ -251,4 +250,6 @@ void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t
g_scaling_registers[pled->driver][pled->r] = red;
g_scaling_registers[pled->driver][pled->g] = green;
g_scaling_registers[pled->driver][pled->b] = blue;

g_scaling_registers_update_required[pled->driver] = true;
}
9 changes: 4 additions & 5 deletions drivers/issi/is31fl3741.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@
#include <stdbool.h>

typedef struct is31_led {
uint8_t driver : 2;
uint16_t r;
uint16_t g;
uint16_t b;
uint32_t driver : 2;
uint32_t r : 10;
uint32_t g : 10;
uint32_t b : 10;
} __attribute__((packed)) is31_led;

extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
extern const is31_led g_is31_indicator_leds[DRIVER_INDICATOR_LED_TOTAL];

void IS31FL3741_init(uint8_t addr);
void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data);
Expand Down

0 comments on commit 0743096

Please sign in to comment.