diff options
Diffstat (limited to 'drivers/led/issi/is31fl3736.h')
-rw-r--r-- | drivers/led/issi/is31fl3736.h | 102 |
1 files changed, 78 insertions, 24 deletions
diff --git a/drivers/led/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h index 32bdef4a80..cd3505b0b6 100644 --- a/drivers/led/issi/is31fl3736.h +++ b/drivers/led/issi/is31fl3736.h @@ -19,28 +19,78 @@ #include <stdint.h> #include <stdbool.h> -#include <string.h> #include "progmem.h" -// Simple interface option. -// If these aren't defined, just define them to make it compile - -#ifndef DRIVER_COUNT -# define DRIVER_COUNT 2 +// ======== DEPRECATED DEFINES - DO NOT USE ======== +#ifdef DRIVER_ADDR_1 +# define IS31FL3736_I2C_ADDRESS_1 DRIVER_ADDR_1 #endif - -#ifndef RGB_MATRIX_LED_COUNT -# define RGB_MATRIX_LED_COUNT 96 +#ifdef DRIVER_ADDR_2 +# define IS31FL3736_I2C_ADDRESS_2 DRIVER_ADDR_2 +#endif +#ifdef DRIVER_ADDR_3 +# define IS31FL3736_I2C_ADDRESS_3 DRIVER_ADDR_3 +#endif +#ifdef DRIVER_ADDR_4 +# define IS31FL3736_I2C_ADDRESS_4 DRIVER_ADDR_4 +#endif +#ifdef DRIVER_COUNT +# define IS31FL3736_DRIVER_COUNT DRIVER_COUNT +#endif +#ifdef ISSI_TIMEOUT +# define IS31FL3736_I2C_TIMEOUT ISSI_TIMEOUT +#endif +#ifdef ISSI_PERSISTENCE +# define IS31FL3736_I2C_PERSISTENCE ISSI_PERSISTENCE +#endif +#ifdef ISSI_SWPULLUP +# define IS31FL3736_SWPULLUP ISSI_SWPULLUP +#endif +#ifdef ISSI_CSPULLUP +# define IS31FL3736_CSPULLUP ISSI_CSPULLUP +#endif +#ifdef ISSI_GLOBALCURRENT +# define IS31FL3736_GLOBALCURRENT ISSI_GLOBALCURRENT #endif -typedef struct is31_led { +#define is31_led is31fl3736_led_t +#define g_is31_leds g_is31fl3736_leds + +#define PUR_0R IS31FL3736_PUR_0R +#define PUR_05KR IS31FL3736_PUR_05KR +#define PUR_1KR IS31FL3736_PUR_1KR +#define PUR_2KR IS31FL3736_PUR_2KR +#define PUR_4KR IS31FL3736_PUR_4KR +#define PUR_8KR IS31FL3736_PUR_8KR +#define PUR_16KR IS31FL3736_PUR_16KR +#define PUR_32KR IS31FL3736_PUR_32KR +// ======== + +#define IS31FL3736_I2C_ADDRESS_GND_GND 0x50 +#define IS31FL3736_I2C_ADDRESS_GND_SCL 0x51 +#define IS31FL3736_I2C_ADDRESS_GND_SDA 0x52 +#define IS31FL3736_I2C_ADDRESS_GND_VCC 0x53 +#define IS31FL3736_I2C_ADDRESS_SCL_GND 0x54 +#define IS31FL3736_I2C_ADDRESS_SCL_SCL 0x55 +#define IS31FL3736_I2C_ADDRESS_SCL_SDA 0x56 +#define IS31FL3736_I2C_ADDRESS_SCL_VCC 0x57 +#define IS31FL3736_I2C_ADDRESS_SDA_GND 0x58 +#define IS31FL3736_I2C_ADDRESS_SDA_SCL 0x59 +#define IS31FL3736_I2C_ADDRESS_SDA_SDA 0x5A +#define IS31FL3736_I2C_ADDRESS_SDA_VCC 0x5B +#define IS31FL3736_I2C_ADDRESS_VCC_GND 0x5C +#define IS31FL3736_I2C_ADDRESS_VCC_SCL 0x5D +#define IS31FL3736_I2C_ADDRESS_VCC_SDA 0x5E +#define IS31FL3736_I2C_ADDRESS_VCC_VCC 0x5F + +typedef struct is31fl3736_led_t { uint8_t driver : 2; uint8_t r; uint8_t g; uint8_t b; -} __attribute__((packed)) is31_led; +} __attribute__((packed)) is31fl3736_led_t; -extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; +extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[RGB_MATRIX_LED_COUNT]; void is31fl3736_init(uint8_t addr); void is31fl3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); @@ -51,10 +101,6 @@ void is31fl3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue); void is31fl3736_set_led_control_register(uint8_t index, bool red, bool green, bool blue); -void is31fl3736_mono_set_brightness(int index, uint8_t value); -void is31fl3736_mono_set_brightness_all(uint8_t value); -void is31fl3736_mono_set_led_control_register(uint8_t index, bool enabled); - // This should not be called from an interrupt // (eg. from a timer interrupt). // Call this while idle (in between matrix scans). @@ -62,14 +108,22 @@ void is31fl3736_mono_set_led_control_register(uint8_t index, bool enabled); void is31fl3736_update_pwm_buffers(uint8_t addr, uint8_t index); void is31fl3736_update_led_control_registers(uint8_t addr, uint8_t index); -#define PUR_0R 0x00 // No PUR resistor -#define PUR_05KR 0x01 // 0.5k Ohm resistor -#define PUR_1KR 0x02 // 1.0k Ohm resistor -#define PUR_2KR 0x03 // 2.0k Ohm resistor -#define PUR_4KR 0x04 // 4.0k Ohm resistor -#define PUR_8KR 0x05 // 8.0k Ohm resistor -#define PUR_16KR 0x06 // 16k Ohm resistor -#define PUR_32KR 0x07 // 32k Ohm resistor +void is31fl3736_flush(void); + +#define IS31FL3736_PUR_0R 0x00 // No PUR resistor +#define IS31FL3736_PUR_05KR 0x01 // 0.5k Ohm resistor +#define IS31FL3736_PUR_1KR 0x02 // 1.0k Ohm resistor +#define IS31FL3736_PUR_2KR 0x03 // 2.0k Ohm resistor +#define IS31FL3736_PUR_4KR 0x04 // 4.0k Ohm resistor +#define IS31FL3736_PUR_8KR 0x05 // 8.0k Ohm resistor +#define IS31FL3736_PUR_16KR 0x06 // 16k Ohm resistor +#define IS31FL3736_PUR_32KR 0x07 // 32k Ohm resistor + +#define IS31FL3736_PWM_FREQUENCY_8K4_HZ 0b000 +#define IS31FL3736_PWM_FREQUENCY_4K2_HZ 0b001 +#define IS31FL3736_PWM_FREQUENCY_26K7_HZ 0b010 +#define IS31FL3736_PWM_FREQUENCY_2K1_HZ 0b011 +#define IS31FL3736_PWM_FREQUENCY_1K05_HZ 0b100 #define A_1 0x00 #define A_2 0x02 |