diff options
Diffstat (limited to 'drivers/led/issi/is31fl3731-simple.c')
-rw-r--r-- | drivers/led/issi/is31fl3731-simple.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/led/issi/is31fl3731-simple.c b/drivers/led/issi/is31fl3731-simple.c index d295772f5e..f51e2e38af 100644 --- a/drivers/led/issi/is31fl3731-simple.c +++ b/drivers/led/issi/is31fl3731-simple.c @@ -1,6 +1,7 @@ /* Copyright 2017 Jason Williams * Copyright 2018 Jack Humbert * Copyright 2019 Clueboard + * Copyright 2021 Doni Crosby * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,6 +41,9 @@ #define ISSI_REG_PICTUREFRAME 0x01 +// Not defined in the datasheet -- See AN for IC +#define ISSI_REG_GHOST_IMAGE_PREVENTION 0xC2 // Set bit 4 to enable de-ghosting + #define ISSI_REG_SHUTDOWN 0x0A #define ISSI_REG_AUDIOSYNC 0x06 @@ -144,6 +148,9 @@ void IS31FL3731_init(uint8_t addr) { // enable software shutdown IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00); +#ifdef ISSI_3731_DEGHOST // set to enable de-ghosting of the array + IS31FL3731_write_register(addr, ISSI_REG_GHOST_IMAGE_PREVENTION, 0x10); +#endif // this delay was copied from other drivers, might not be needed wait_ms(10); @@ -186,8 +193,9 @@ void IS31FL3731_init(uint8_t addr) { } void IS31FL3731_set_value(int index, uint8_t value) { + is31_led led; if (index >= 0 && index < DRIVER_LED_TOTAL) { - is31_led led = g_is31_leds[index]; + memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); // Subtract 0x24 to get the second index of g_pwm_buffer g_pwm_buffer[led.driver][led.v - 0x24] = value; @@ -202,7 +210,8 @@ void IS31FL3731_set_value_all(uint8_t value) { } void IS31FL3731_set_led_control_register(uint8_t index, bool value) { - is31_led led = g_is31_leds[index]; + is31_led led; + memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); uint8_t control_register = (led.v - 0x24) / 8; uint8_t bit_value = (led.v - 0x24) % 8; |