mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 03:19:24 +00:00
LED Matrix: driver naming cleanups (#21580)
This commit is contained in:
parent
b4a7b9253a
commit
571b8bac82
@ -352,8 +352,8 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
LED_MATRIX_ENABLE ?= no
|
LED_MATRIX_ENABLE ?= no
|
||||||
VALID_LED_MATRIX_TYPES := IS31FL3731 IS31FL3742A IS31FL3743A IS31FL3745 IS31FL3746A CKLED2001 custom
|
VALID_LED_MATRIX_TYPES := is31fl3731 is31fl3742a is31fl3743a is31fl3745 is31fl3746a ckled2001 custom
|
||||||
# TODO: IS31FL3733 IS31FL3737 IS31FL3741
|
# TODO: is31fl3733 is31fl3737 is31fl3741
|
||||||
|
|
||||||
ifeq ($(strip $(LED_MATRIX_ENABLE)), yes)
|
ifeq ($(strip $(LED_MATRIX_ENABLE)), yes)
|
||||||
ifeq ($(filter $(LED_MATRIX_DRIVER),$(VALID_LED_MATRIX_TYPES)),)
|
ifeq ($(filter $(LED_MATRIX_DRIVER),$(VALID_LED_MATRIX_TYPES)),)
|
||||||
@ -373,42 +373,42 @@ endif
|
|||||||
SRC += $(LIB_PATH)/lib8tion/lib8tion.c
|
SRC += $(LIB_PATH)/lib8tion/lib8tion.c
|
||||||
CIE1931_CURVE := yes
|
CIE1931_CURVE := yes
|
||||||
|
|
||||||
ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3731)
|
ifeq ($(strip $(LED_MATRIX_DRIVER)), is31fl3731)
|
||||||
OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
||||||
COMMON_VPATH += $(DRIVER_PATH)/led/issi
|
COMMON_VPATH += $(DRIVER_PATH)/led/issi
|
||||||
SRC += is31fl3731-simple.c
|
SRC += is31fl3731-simple.c
|
||||||
QUANTUM_LIB_SRC += i2c_master.c
|
QUANTUM_LIB_SRC += i2c_master.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3742A)
|
ifeq ($(strip $(LED_MATRIX_DRIVER)), is31fl3742a)
|
||||||
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3742A -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3742A -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
||||||
COMMON_VPATH += $(DRIVER_PATH)/led/issi
|
COMMON_VPATH += $(DRIVER_PATH)/led/issi
|
||||||
SRC += is31flcommon.c
|
SRC += is31flcommon.c
|
||||||
QUANTUM_LIB_SRC += i2c_master.c
|
QUANTUM_LIB_SRC += i2c_master.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3743A)
|
ifeq ($(strip $(LED_MATRIX_DRIVER)), is31fl3743a)
|
||||||
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3743A -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3743A -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
||||||
COMMON_VPATH += $(DRIVER_PATH)/led/issi
|
COMMON_VPATH += $(DRIVER_PATH)/led/issi
|
||||||
SRC += is31flcommon.c
|
SRC += is31flcommon.c
|
||||||
QUANTUM_LIB_SRC += i2c_master.c
|
QUANTUM_LIB_SRC += i2c_master.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3745)
|
ifeq ($(strip $(LED_MATRIX_DRIVER)), is31fl3745)
|
||||||
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3745 -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3745 -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
||||||
COMMON_VPATH += $(DRIVER_PATH)/led/issi
|
COMMON_VPATH += $(DRIVER_PATH)/led/issi
|
||||||
SRC += is31flcommon.c
|
SRC += is31flcommon.c
|
||||||
QUANTUM_LIB_SRC += i2c_master.c
|
QUANTUM_LIB_SRC += i2c_master.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3746A)
|
ifeq ($(strip $(LED_MATRIX_DRIVER)), is31fl3746a)
|
||||||
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3746A -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
OPT_DEFS += -DIS31FLCOMMON -DIS31FL3746A -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
||||||
COMMON_VPATH += $(DRIVER_PATH)/led/issi
|
COMMON_VPATH += $(DRIVER_PATH)/led/issi
|
||||||
SRC += is31flcommon.c
|
SRC += is31flcommon.c
|
||||||
QUANTUM_LIB_SRC += i2c_master.c
|
QUANTUM_LIB_SRC += i2c_master.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(LED_MATRIX_DRIVER)), CKLED2001)
|
ifeq ($(strip $(LED_MATRIX_DRIVER)), ckled2001)
|
||||||
OPT_DEFS += -DCKLED2001 -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
OPT_DEFS += -DCKLED2001 -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
||||||
COMMON_VPATH += $(DRIVER_PATH)/led
|
COMMON_VPATH += $(DRIVER_PATH)/led
|
||||||
SRC += ckled2001-simple.c
|
SRC += ckled2001-simple.c
|
||||||
|
@ -12,7 +12,7 @@ There is basic support for addressable LED matrix lighting with the I2C IS31FL37
|
|||||||
|
|
||||||
```make
|
```make
|
||||||
LED_MATRIX_ENABLE = yes
|
LED_MATRIX_ENABLE = yes
|
||||||
LED_MATRIX_DRIVER = IS31FL3731
|
LED_MATRIX_DRIVER = is31fl3731
|
||||||
```
|
```
|
||||||
|
|
||||||
You can use between 1 and 4 IS31FL3731 IC's. Do not specify `LED_DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
|
You can use between 1 and 4 IS31FL3731 IC's. Do not specify `LED_DRIVER_ADDR_<N>` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
|
||||||
|
@ -42,7 +42,7 @@ uint8_t g_twi_transfer_buffer[20];
|
|||||||
// The control buffers match the PG0 LED On/Off registers.
|
// The control buffers match the PG0 LED On/Off registers.
|
||||||
// Storing them like this is optimal for I2C transfers to the registers.
|
// Storing them like this is optimal for I2C transfers to the registers.
|
||||||
// We could optimize this and take out the unused registers from these
|
// We could optimize this and take out the unused registers from these
|
||||||
// buffers and the transfers in CKLED2001_write_pwm_buffer() but it's
|
// buffers and the transfers in ckled2001_write_pwm_buffer() but it's
|
||||||
// probably not worth the extra complexity.
|
// probably not worth the extra complexity.
|
||||||
uint8_t g_pwm_buffer[DRIVER_COUNT][192];
|
uint8_t g_pwm_buffer[DRIVER_COUNT][192];
|
||||||
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
|
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
|
||||||
@ -50,7 +50,7 @@ bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
|
|||||||
uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0};
|
uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0};
|
||||||
bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
|
bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
|
||||||
|
|
||||||
bool CKLED2001_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
bool ckled2001_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||||
// If the transaction fails function returns false.
|
// If the transaction fails function returns false.
|
||||||
g_twi_transfer_buffer[0] = reg;
|
g_twi_transfer_buffer[0] = reg;
|
||||||
g_twi_transfer_buffer[1] = data;
|
g_twi_transfer_buffer[1] = data;
|
||||||
@ -69,7 +69,7 @@ bool CKLED2001_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CKLED2001_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
bool ckled2001_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||||
// Assumes PG1 is already selected.
|
// Assumes PG1 is already selected.
|
||||||
// If any of the transactions fails function returns false.
|
// If any of the transactions fails function returns false.
|
||||||
// Transmit PWM registers in 12 transfers of 16 bytes.
|
// Transmit PWM registers in 12 transfers of 16 bytes.
|
||||||
@ -100,53 +100,53 @@ bool CKLED2001_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKLED2001_init(uint8_t addr) {
|
void ckled2001_init(uint8_t addr) {
|
||||||
// Select to function page
|
// Select to function page
|
||||||
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
|
ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
|
||||||
// Setting LED driver to shutdown mode
|
// Setting LED driver to shutdown mode
|
||||||
CKLED2001_write_register(addr, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE);
|
ckled2001_write_register(addr, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE);
|
||||||
// Setting internal channel pulldown/pullup
|
// Setting internal channel pulldown/pullup
|
||||||
CKLED2001_write_register(addr, PDU_REG, MSKSET_CA_CB_CHANNEL);
|
ckled2001_write_register(addr, PDU_REG, MSKSET_CA_CB_CHANNEL);
|
||||||
// Select number of scan phase
|
// Select number of scan phase
|
||||||
CKLED2001_write_register(addr, SCAN_PHASE_REG, PHASE_CHANNEL);
|
ckled2001_write_register(addr, SCAN_PHASE_REG, PHASE_CHANNEL);
|
||||||
// Setting PWM Delay Phase
|
// Setting PWM Delay Phase
|
||||||
CKLED2001_write_register(addr, SLEW_RATE_CONTROL_MODE1_REG, MSKPWM_DELAY_PHASE_ENABLE);
|
ckled2001_write_register(addr, SLEW_RATE_CONTROL_MODE1_REG, MSKPWM_DELAY_PHASE_ENABLE);
|
||||||
// Setting Driving/Sinking Channel Slew Rate
|
// Setting Driving/Sinking Channel Slew Rate
|
||||||
CKLED2001_write_register(addr, SLEW_RATE_CONTROL_MODE2_REG, MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_ENABLE);
|
ckled2001_write_register(addr, SLEW_RATE_CONTROL_MODE2_REG, MSKDRIVING_SINKING_CHHANNEL_SLEWRATE_ENABLE);
|
||||||
// Setting Iref
|
// Setting Iref
|
||||||
CKLED2001_write_register(addr, SOFTWARE_SLEEP_REG, MSKSLEEP_DISABLE);
|
ckled2001_write_register(addr, SOFTWARE_SLEEP_REG, MSKSLEEP_DISABLE);
|
||||||
// Set LED CONTROL PAGE (Page 0)
|
// Set LED CONTROL PAGE (Page 0)
|
||||||
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE);
|
ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE);
|
||||||
for (int i = 0; i < LED_CONTROL_ON_OFF_LENGTH; i++) {
|
for (int i = 0; i < LED_CONTROL_ON_OFF_LENGTH; i++) {
|
||||||
CKLED2001_write_register(addr, i, 0x00);
|
ckled2001_write_register(addr, i, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set PWM PAGE (Page 1)
|
// Set PWM PAGE (Page 1)
|
||||||
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_PWM_PAGE);
|
ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_PWM_PAGE);
|
||||||
for (int i = 0; i < LED_CURRENT_TUNE_LENGTH; i++) {
|
for (int i = 0; i < LED_CURRENT_TUNE_LENGTH; i++) {
|
||||||
CKLED2001_write_register(addr, i, 0x00);
|
ckled2001_write_register(addr, i, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set CURRENT PAGE (Page 4)
|
// Set CURRENT PAGE (Page 4)
|
||||||
uint8_t current_tuen_reg_list[LED_CURRENT_TUNE_LENGTH] = CKLED2001_CURRENT_TUNE;
|
uint8_t current_tuen_reg_list[LED_CURRENT_TUNE_LENGTH] = CKLED2001_CURRENT_TUNE;
|
||||||
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, CURRENT_TUNE_PAGE);
|
ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, CURRENT_TUNE_PAGE);
|
||||||
for (int i = 0; i < LED_CURRENT_TUNE_LENGTH; i++) {
|
for (int i = 0; i < LED_CURRENT_TUNE_LENGTH; i++) {
|
||||||
CKLED2001_write_register(addr, i, current_tuen_reg_list[i]);
|
ckled2001_write_register(addr, i, current_tuen_reg_list[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable LEDs ON/OFF
|
// Enable LEDs ON/OFF
|
||||||
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE);
|
ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE);
|
||||||
for (int i = 0; i < LED_CONTROL_ON_OFF_LENGTH; i++) {
|
for (int i = 0; i < LED_CONTROL_ON_OFF_LENGTH; i++) {
|
||||||
CKLED2001_write_register(addr, i, 0xFF);
|
ckled2001_write_register(addr, i, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select to function page
|
// Select to function page
|
||||||
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
|
ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
|
||||||
// Setting LED driver to normal mode
|
// Setting LED driver to normal mode
|
||||||
CKLED2001_write_register(addr, CONFIGURATION_REG, MSKSW_NORMAL_MODE);
|
ckled2001_write_register(addr, CONFIGURATION_REG, MSKSW_NORMAL_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKLED2001_set_value(int index, uint8_t value) {
|
void ckled2001_set_value(int index, uint8_t value) {
|
||||||
ckled2001_led led;
|
ckled2001_led led;
|
||||||
if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
|
if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
|
||||||
memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led));
|
memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led));
|
||||||
@ -159,13 +159,13 @@ void CKLED2001_set_value(int index, uint8_t value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKLED2001_set_value_all(uint8_t value) {
|
void ckled2001_set_value_all(uint8_t value) {
|
||||||
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
|
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
|
||||||
CKLED2001_set_value(i, value);
|
ckled2001_set_value(i, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKLED2001_set_led_control_register(uint8_t index, bool value) {
|
void ckled2001_set_led_control_register(uint8_t index, bool value) {
|
||||||
ckled2001_led led;
|
ckled2001_led led;
|
||||||
memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led));
|
memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led));
|
||||||
|
|
||||||
@ -181,41 +181,41 @@ void CKLED2001_set_led_control_register(uint8_t index, bool value) {
|
|||||||
g_led_control_registers_update_required[led.driver] = true;
|
g_led_control_registers_update_required[led.driver] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKLED2001_update_pwm_buffers(uint8_t addr, uint8_t index) {
|
void ckled2001_update_pwm_buffers(uint8_t addr, uint8_t index) {
|
||||||
if (g_pwm_buffer_update_required[index]) {
|
if (g_pwm_buffer_update_required[index]) {
|
||||||
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_PWM_PAGE);
|
ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_PWM_PAGE);
|
||||||
|
|
||||||
// If any of the transactions fail we risk writing dirty PG0,
|
// If any of the transactions fail we risk writing dirty PG0,
|
||||||
// refresh page 0 just in case.
|
// refresh page 0 just in case.
|
||||||
if (!CKLED2001_write_pwm_buffer(addr, g_pwm_buffer[index])) {
|
if (!ckled2001_write_pwm_buffer(addr, g_pwm_buffer[index])) {
|
||||||
g_led_control_registers_update_required[index] = true;
|
g_led_control_registers_update_required[index] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_pwm_buffer_update_required[index] = false;
|
g_pwm_buffer_update_required[index] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKLED2001_update_led_control_registers(uint8_t addr, uint8_t index) {
|
void ckled2001_update_led_control_registers(uint8_t addr, uint8_t index) {
|
||||||
if (g_led_control_registers_update_required[index]) {
|
if (g_led_control_registers_update_required[index]) {
|
||||||
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE);
|
ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, LED_CONTROL_PAGE);
|
||||||
for (int i = 0; i < 24; i++) {
|
for (int i = 0; i < 24; i++) {
|
||||||
CKLED2001_write_register(addr, i, g_led_control_registers[index][i]);
|
ckled2001_write_register(addr, i, g_led_control_registers[index][i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_led_control_registers_update_required[index] = false;
|
g_led_control_registers_update_required[index] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKLED2001_sw_return_normal(uint8_t addr) {
|
void ckled2001_sw_return_normal(uint8_t addr) {
|
||||||
// Select to function page
|
// Select to function page
|
||||||
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
|
ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
|
||||||
// Setting LED driver to normal mode
|
// Setting LED driver to normal mode
|
||||||
CKLED2001_write_register(addr, CONFIGURATION_REG, MSKSW_NORMAL_MODE);
|
ckled2001_write_register(addr, CONFIGURATION_REG, MSKSW_NORMAL_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKLED2001_sw_shutdown(uint8_t addr) {
|
void ckled2001_sw_shutdown(uint8_t addr) {
|
||||||
// Select to function page
|
// Select to function page
|
||||||
CKLED2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
|
ckled2001_write_register(addr, CONFIGURE_CMD_PAGE, FUNCTION_PAGE);
|
||||||
// Setting LED driver to shutdown mode
|
// Setting LED driver to shutdown mode
|
||||||
CKLED2001_write_register(addr, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE);
|
ckled2001_write_register(addr, CONFIGURATION_REG, MSKSW_SHUT_DOWN_MODE);
|
||||||
// Write SW Sleep Register
|
// Write SW Sleep Register
|
||||||
CKLED2001_write_register(addr, SOFTWARE_SLEEP_REG, MSKSLEEP_ENABLE);
|
ckled2001_write_register(addr, SOFTWARE_SLEEP_REG, MSKSLEEP_ENABLE);
|
||||||
}
|
}
|
||||||
|
@ -27,24 +27,24 @@ typedef struct ckled2001_led {
|
|||||||
|
|
||||||
extern const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT];
|
extern const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT];
|
||||||
|
|
||||||
void CKLED2001_init(uint8_t addr);
|
void ckled2001_init(uint8_t addr);
|
||||||
bool CKLED2001_write_register(uint8_t addr, uint8_t reg, uint8_t data);
|
bool ckled2001_write_register(uint8_t addr, uint8_t reg, uint8_t data);
|
||||||
bool CKLED2001_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
|
bool ckled2001_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
|
||||||
|
|
||||||
void CKLED2001_set_value(int index, uint8_t value);
|
void ckled2001_set_value(int index, uint8_t value);
|
||||||
void CKLED2001_set_value_all(uint8_t value);
|
void ckled2001_set_value_all(uint8_t value);
|
||||||
|
|
||||||
void CKLED2001_set_led_control_register(uint8_t index, bool value);
|
void ckled2001_set_led_control_register(uint8_t index, bool value);
|
||||||
|
|
||||||
// This should not be called from an interrupt
|
// This should not be called from an interrupt
|
||||||
// (eg. from a timer interrupt).
|
// (eg. from a timer interrupt).
|
||||||
// Call this while idle (in between matrix scans).
|
// Call this while idle (in between matrix scans).
|
||||||
// If the buffer is dirty, it will update the driver with the buffer.
|
// If the buffer is dirty, it will update the driver with the buffer.
|
||||||
void CKLED2001_update_pwm_buffers(uint8_t addr, uint8_t index);
|
void ckled2001_update_pwm_buffers(uint8_t addr, uint8_t index);
|
||||||
void CKLED2001_update_led_control_registers(uint8_t addr, uint8_t index);
|
void ckled2001_update_led_control_registers(uint8_t addr, uint8_t index);
|
||||||
|
|
||||||
void CKLED2001_sw_return_normal(uint8_t addr);
|
void ckled2001_sw_return_normal(uint8_t addr);
|
||||||
void CKLED2001_sw_shutdown(uint8_t addr);
|
void ckled2001_sw_shutdown(uint8_t addr);
|
||||||
|
|
||||||
// Registers Page Define
|
// Registers Page Define
|
||||||
#define CONFIGURE_CMD_PAGE 0xFD
|
#define CONFIGURE_CMD_PAGE 0xFD
|
||||||
|
@ -64,7 +64,7 @@ uint8_t g_twi_transfer_buffer[20];
|
|||||||
// These buffers match the IS31FL3731 PWM registers 0x24-0xB3.
|
// These buffers match the IS31FL3731 PWM registers 0x24-0xB3.
|
||||||
// Storing them like this is optimal for I2C transfers to the registers.
|
// Storing them like this is optimal for I2C transfers to the registers.
|
||||||
// We could optimize this and take out the unused registers from these
|
// We could optimize this and take out the unused registers from these
|
||||||
// buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's
|
// buffers and the transfers in is31fl3731_write_pwm_buffer() but it's
|
||||||
// probably not worth the extra complexity.
|
// probably not worth the extra complexity.
|
||||||
uint8_t g_pwm_buffer[LED_DRIVER_COUNT][144];
|
uint8_t g_pwm_buffer[LED_DRIVER_COUNT][144];
|
||||||
bool g_pwm_buffer_update_required[LED_DRIVER_COUNT] = {false};
|
bool g_pwm_buffer_update_required[LED_DRIVER_COUNT] = {false};
|
||||||
@ -95,7 +95,7 @@ bool g_led_control_registers_update_required[LED_DRIVER_COUNT] = {false};
|
|||||||
// 0x0E - R17,G15,G14,G13,G12,G11,G10,G09
|
// 0x0E - R17,G15,G14,G13,G12,G11,G10,G09
|
||||||
// 0x10 - R16,R15,R14,R13,R12,R11,R10,R09
|
// 0x10 - R16,R15,R14,R13,R12,R11,R10,R09
|
||||||
|
|
||||||
void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||||
g_twi_transfer_buffer[0] = reg;
|
g_twi_transfer_buffer[0] = reg;
|
||||||
g_twi_transfer_buffer[1] = data;
|
g_twi_transfer_buffer[1] = data;
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||||
// assumes bank is already selected
|
// assumes bank is already selected
|
||||||
|
|
||||||
// transmit PWM registers in 9 transfers of 16 bytes
|
// transmit PWM registers in 9 transfers of 16 bytes
|
||||||
@ -135,62 +135,62 @@ void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3731_init(uint8_t addr) {
|
void is31fl3731_init(uint8_t addr) {
|
||||||
// In order to avoid the LEDs being driven with garbage data
|
// In order to avoid the LEDs being driven with garbage data
|
||||||
// in the LED driver's PWM registers, first enable software shutdown,
|
// in the LED driver's PWM registers, first enable software shutdown,
|
||||||
// then set up the mode and other settings, clear the PWM registers,
|
// then set up the mode and other settings, clear the PWM registers,
|
||||||
// then disable software shutdown.
|
// then disable software shutdown.
|
||||||
|
|
||||||
// select "function register" bank
|
// select "function register" bank
|
||||||
IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
|
is31fl3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
|
||||||
|
|
||||||
// enable software shutdown
|
// enable software shutdown
|
||||||
IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
|
is31fl3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
|
||||||
#ifdef ISSI_3731_DEGHOST // set to enable de-ghosting of the array
|
#ifdef ISSI_3731_DEGHOST // set to enable de-ghosting of the array
|
||||||
IS31FL3731_write_register(addr, ISSI_REG_GHOST_IMAGE_PREVENTION, 0x10);
|
is31fl3731_write_register(addr, ISSI_REG_GHOST_IMAGE_PREVENTION, 0x10);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// this delay was copied from other drivers, might not be needed
|
// this delay was copied from other drivers, might not be needed
|
||||||
wait_ms(10);
|
wait_ms(10);
|
||||||
|
|
||||||
// picture mode
|
// picture mode
|
||||||
IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE);
|
is31fl3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE);
|
||||||
// display frame 0
|
// display frame 0
|
||||||
IS31FL3731_write_register(addr, ISSI_REG_PICTUREFRAME, 0x00);
|
is31fl3731_write_register(addr, ISSI_REG_PICTUREFRAME, 0x00);
|
||||||
// audio sync off
|
// audio sync off
|
||||||
IS31FL3731_write_register(addr, ISSI_REG_AUDIOSYNC, 0x00);
|
is31fl3731_write_register(addr, ISSI_REG_AUDIOSYNC, 0x00);
|
||||||
|
|
||||||
// select bank 0
|
// select bank 0
|
||||||
IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
|
is31fl3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
|
||||||
|
|
||||||
// turn off all LEDs in the LED control register
|
// turn off all LEDs in the LED control register
|
||||||
for (int i = 0x00; i <= 0x11; i++) {
|
for (int i = 0x00; i <= 0x11; i++) {
|
||||||
IS31FL3731_write_register(addr, i, 0x00);
|
is31fl3731_write_register(addr, i, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn off all LEDs in the blink control register (not really needed)
|
// turn off all LEDs in the blink control register (not really needed)
|
||||||
for (int i = 0x12; i <= 0x23; i++) {
|
for (int i = 0x12; i <= 0x23; i++) {
|
||||||
IS31FL3731_write_register(addr, i, 0x00);
|
is31fl3731_write_register(addr, i, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set PWM on all LEDs to 0
|
// set PWM on all LEDs to 0
|
||||||
for (int i = 0x24; i <= 0xB3; i++) {
|
for (int i = 0x24; i <= 0xB3; i++) {
|
||||||
IS31FL3731_write_register(addr, i, 0x00);
|
is31fl3731_write_register(addr, i, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
// select "function register" bank
|
// select "function register" bank
|
||||||
IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
|
is31fl3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
|
||||||
|
|
||||||
// disable software shutdown
|
// disable software shutdown
|
||||||
IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x01);
|
is31fl3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x01);
|
||||||
|
|
||||||
// select bank 0 and leave it selected.
|
// select bank 0 and leave it selected.
|
||||||
// most usage after initialization is just writing PWM buffers in bank 0
|
// most usage after initialization is just writing PWM buffers in bank 0
|
||||||
// as there's not much point in double-buffering
|
// as there's not much point in double-buffering
|
||||||
IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
|
is31fl3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3731_set_value(int index, uint8_t value) {
|
void is31fl3731_set_value(int index, uint8_t value) {
|
||||||
is31_led led;
|
is31_led led;
|
||||||
if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
|
if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
|
||||||
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
||||||
@ -205,13 +205,13 @@ void IS31FL3731_set_value(int index, uint8_t value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3731_set_value_all(uint8_t value) {
|
void is31fl3731_set_value_all(uint8_t value) {
|
||||||
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
|
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
|
||||||
IS31FL3731_set_value(i, value);
|
is31fl3731_set_value(i, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3731_set_led_control_register(uint8_t index, bool value) {
|
void is31fl3731_set_led_control_register(uint8_t index, bool value) {
|
||||||
is31_led led;
|
is31_led led;
|
||||||
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
||||||
|
|
||||||
@ -227,17 +227,17 @@ void IS31FL3731_set_led_control_register(uint8_t index, bool value) {
|
|||||||
g_led_control_registers_update_required[led.driver] = true;
|
g_led_control_registers_update_required[led.driver] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index) {
|
void is31fl3731_update_pwm_buffers(uint8_t addr, uint8_t index) {
|
||||||
if (g_pwm_buffer_update_required[index]) {
|
if (g_pwm_buffer_update_required[index]) {
|
||||||
IS31FL3731_write_pwm_buffer(addr, g_pwm_buffer[index]);
|
is31fl3731_write_pwm_buffer(addr, g_pwm_buffer[index]);
|
||||||
g_pwm_buffer_update_required[index] = false;
|
g_pwm_buffer_update_required[index] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index) {
|
void is31fl3731_update_led_control_registers(uint8_t addr, uint8_t index) {
|
||||||
if (g_led_control_registers_update_required[index]) {
|
if (g_led_control_registers_update_required[index]) {
|
||||||
for (int i = 0; i < 18; i++) {
|
for (int i = 0; i < 18; i++) {
|
||||||
IS31FL3731_write_register(addr, i, g_led_control_registers[index][i]);
|
is31fl3731_write_register(addr, i, g_led_control_registers[index][i]);
|
||||||
}
|
}
|
||||||
g_led_control_registers_update_required[index] = false;
|
g_led_control_registers_update_required[index] = false;
|
||||||
}
|
}
|
||||||
|
@ -30,21 +30,21 @@ typedef struct is31_led {
|
|||||||
|
|
||||||
extern const is31_led PROGMEM g_is31_leds[LED_MATRIX_LED_COUNT];
|
extern const is31_led PROGMEM g_is31_leds[LED_MATRIX_LED_COUNT];
|
||||||
|
|
||||||
void IS31FL3731_init(uint8_t addr);
|
void is31fl3731_init(uint8_t addr);
|
||||||
void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data);
|
void is31fl3731_write_register(uint8_t addr, uint8_t reg, uint8_t data);
|
||||||
void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
|
void is31fl3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
|
||||||
|
|
||||||
void IS31FL3731_set_value(int index, uint8_t value);
|
void is31fl3731_set_value(int index, uint8_t value);
|
||||||
void IS31FL3731_set_value_all(uint8_t value);
|
void is31fl3731_set_value_all(uint8_t value);
|
||||||
|
|
||||||
void IS31FL3731_set_led_control_register(uint8_t index, bool value);
|
void is31fl3731_set_led_control_register(uint8_t index, bool value);
|
||||||
|
|
||||||
// This should not be called from an interrupt
|
// This should not be called from an interrupt
|
||||||
// (eg. from a timer interrupt).
|
// (eg. from a timer interrupt).
|
||||||
// Call this while idle (in between matrix scans).
|
// Call this while idle (in between matrix scans).
|
||||||
// If the buffer is dirty, it will update the driver with the buffer.
|
// If the buffer is dirty, it will update the driver with the buffer.
|
||||||
void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index);
|
void is31fl3731_update_pwm_buffers(uint8_t addr, uint8_t index);
|
||||||
void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
|
void is31fl3731_update_led_control_registers(uint8_t addr, uint8_t index);
|
||||||
|
|
||||||
#define C1_1 0x24
|
#define C1_1 0x24
|
||||||
#define C1_2 0x25
|
#define C1_2 0x25
|
||||||
|
@ -81,7 +81,7 @@ uint8_t g_twi_transfer_buffer[20];
|
|||||||
// The control buffers match the PG0 LED On/Off registers.
|
// The control buffers match the PG0 LED On/Off registers.
|
||||||
// Storing them like this is optimal for I2C transfers to the registers.
|
// Storing them like this is optimal for I2C transfers to the registers.
|
||||||
// We could optimize this and take out the unused registers from these
|
// We could optimize this and take out the unused registers from these
|
||||||
// buffers and the transfers in IS31FL3733_write_pwm_buffer() but it's
|
// buffers and the transfers in is31fl3733_write_pwm_buffer() but it's
|
||||||
// probably not worth the extra complexity.
|
// probably not worth the extra complexity.
|
||||||
uint8_t g_pwm_buffer[LED_DRIVER_COUNT][192];
|
uint8_t g_pwm_buffer[LED_DRIVER_COUNT][192];
|
||||||
bool g_pwm_buffer_update_required[LED_DRIVER_COUNT] = {false};
|
bool g_pwm_buffer_update_required[LED_DRIVER_COUNT] = {false};
|
||||||
@ -98,7 +98,7 @@ uint8_t g_led_control_registers[LED_DRIVER_COUNT][24] = {{0}, {0}, {0}, {0}};
|
|||||||
#endif
|
#endif
|
||||||
bool g_led_control_registers_update_required[LED_DRIVER_COUNT] = {false};
|
bool g_led_control_registers_update_required[LED_DRIVER_COUNT] = {false};
|
||||||
|
|
||||||
bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||||
// If the transaction fails function returns false.
|
// If the transaction fails function returns false.
|
||||||
g_twi_transfer_buffer[0] = reg;
|
g_twi_transfer_buffer[0] = reg;
|
||||||
g_twi_transfer_buffer[1] = data;
|
g_twi_transfer_buffer[1] = data;
|
||||||
@ -117,7 +117,7 @@ bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||||
// Assumes PG1 is already selected.
|
// Assumes PG1 is already selected.
|
||||||
// If any of the transactions fails function returns false.
|
// If any of the transactions fails function returns false.
|
||||||
// Transmit PWM registers in 12 transfers of 16 bytes.
|
// Transmit PWM registers in 12 transfers of 16 bytes.
|
||||||
@ -146,7 +146,7 @@ bool IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3733_init(uint8_t addr, uint8_t sync) {
|
void is31fl3733_init(uint8_t addr, uint8_t sync) {
|
||||||
// In order to avoid the LEDs being driven with garbage data
|
// In order to avoid the LEDs being driven with garbage data
|
||||||
// in the LED driver's PWM registers, shutdown is enabled last.
|
// in the LED driver's PWM registers, shutdown is enabled last.
|
||||||
// Set up the mode and other settings, clear the PWM registers,
|
// Set up the mode and other settings, clear the PWM registers,
|
||||||
@ -154,45 +154,45 @@ void IS31FL3733_init(uint8_t addr, uint8_t sync) {
|
|||||||
// Sync is passed so set it according to the datasheet.
|
// Sync is passed so set it according to the datasheet.
|
||||||
|
|
||||||
// Unlock the command register.
|
// Unlock the command register.
|
||||||
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
is31fl3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
||||||
|
|
||||||
// Select PG0
|
// Select PG0
|
||||||
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
|
is31fl3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
|
||||||
// Turn off all LEDs.
|
// Turn off all LEDs.
|
||||||
for (int i = 0x00; i <= 0x17; i++) {
|
for (int i = 0x00; i <= 0x17; i++) {
|
||||||
IS31FL3733_write_register(addr, i, 0x00);
|
is31fl3733_write_register(addr, i, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unlock the command register.
|
// Unlock the command register.
|
||||||
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
is31fl3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
||||||
|
|
||||||
// Select PG1
|
// Select PG1
|
||||||
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
|
is31fl3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
|
||||||
// Set PWM on all LEDs to 0
|
// Set PWM on all LEDs to 0
|
||||||
// No need to setup Breath registers to PWM as that is the default.
|
// No need to setup Breath registers to PWM as that is the default.
|
||||||
for (int i = 0x00; i <= 0xBF; i++) {
|
for (int i = 0x00; i <= 0xBF; i++) {
|
||||||
IS31FL3733_write_register(addr, i, 0x00);
|
is31fl3733_write_register(addr, i, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unlock the command register.
|
// Unlock the command register.
|
||||||
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
is31fl3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
||||||
|
|
||||||
// Select PG3
|
// Select PG3
|
||||||
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
|
is31fl3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
|
||||||
// Set de-ghost pull-up resistors (SWx)
|
// Set de-ghost pull-up resistors (SWx)
|
||||||
IS31FL3733_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP);
|
is31fl3733_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP);
|
||||||
// Set de-ghost pull-down resistors (CSx)
|
// Set de-ghost pull-down resistors (CSx)
|
||||||
IS31FL3733_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP);
|
is31fl3733_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP);
|
||||||
// Set global current to maximum.
|
// Set global current to maximum.
|
||||||
IS31FL3733_write_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT);
|
is31fl3733_write_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT);
|
||||||
// Disable software shutdown.
|
// Disable software shutdown.
|
||||||
IS31FL3733_write_register(addr, ISSI_REG_CONFIGURATION, ((sync & 0b11) << 6) | ((ISSI_PWM_FREQUENCY & 0b111) << 3) | 0x01);
|
is31fl3733_write_register(addr, ISSI_REG_CONFIGURATION, ((sync & 0b11) << 6) | ((ISSI_PWM_FREQUENCY & 0b111) << 3) | 0x01);
|
||||||
|
|
||||||
// Wait 10ms to ensure the device has woken up.
|
// Wait 10ms to ensure the device has woken up.
|
||||||
wait_ms(10);
|
wait_ms(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3733_set_value(int index, uint8_t value) {
|
void is31fl3733_set_value(int index, uint8_t value) {
|
||||||
is31_led led;
|
is31_led led;
|
||||||
if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
|
if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
|
||||||
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
||||||
@ -205,13 +205,13 @@ void IS31FL3733_set_value(int index, uint8_t value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3733_set_value_all(uint8_t value) {
|
void is31fl3733_set_value_all(uint8_t value) {
|
||||||
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
|
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
|
||||||
IS31FL3733_set_value(i, value);
|
is31fl3733_set_value(i, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3733_set_led_control_register(uint8_t index, bool value) {
|
void is31fl3733_set_led_control_register(uint8_t index, bool value) {
|
||||||
is31_led led;
|
is31_led led;
|
||||||
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
||||||
|
|
||||||
@ -227,28 +227,28 @@ void IS31FL3733_set_led_control_register(uint8_t index, bool value) {
|
|||||||
g_led_control_registers_update_required[led.driver] = true;
|
g_led_control_registers_update_required[led.driver] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index) {
|
void is31fl3733_update_pwm_buffers(uint8_t addr, uint8_t index) {
|
||||||
if (g_pwm_buffer_update_required[index]) {
|
if (g_pwm_buffer_update_required[index]) {
|
||||||
// Firstly we need to unlock the command register and select PG1.
|
// Firstly we need to unlock the command register and select PG1.
|
||||||
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
is31fl3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
||||||
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
|
is31fl3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
|
||||||
|
|
||||||
// If any of the transactions fail we risk writing dirty PG0,
|
// If any of the transactions fail we risk writing dirty PG0,
|
||||||
// refresh page 0 just in case.
|
// refresh page 0 just in case.
|
||||||
if (!IS31FL3733_write_pwm_buffer(addr, g_pwm_buffer[index])) {
|
if (!is31fl3733_write_pwm_buffer(addr, g_pwm_buffer[index])) {
|
||||||
g_led_control_registers_update_required[index] = true;
|
g_led_control_registers_update_required[index] = true;
|
||||||
}
|
}
|
||||||
g_pwm_buffer_update_required[index] = false;
|
g_pwm_buffer_update_required[index] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index) {
|
void is31fl3733_update_led_control_registers(uint8_t addr, uint8_t index) {
|
||||||
if (g_led_control_registers_update_required[index]) {
|
if (g_led_control_registers_update_required[index]) {
|
||||||
// Firstly we need to unlock the command register and select PG0
|
// Firstly we need to unlock the command register and select PG0
|
||||||
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
is31fl3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
||||||
IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
|
is31fl3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
|
||||||
for (int i = 0; i < 24; i++) {
|
for (int i = 0; i < 24; i++) {
|
||||||
IS31FL3733_write_register(addr, i, g_led_control_registers[index][i]);
|
is31fl3733_write_register(addr, i, g_led_control_registers[index][i]);
|
||||||
}
|
}
|
||||||
g_led_control_registers_update_required[index] = false;
|
g_led_control_registers_update_required[index] = false;
|
||||||
}
|
}
|
||||||
|
@ -32,21 +32,21 @@ typedef struct is31_led {
|
|||||||
|
|
||||||
extern const is31_led PROGMEM g_is31_leds[LED_MATRIX_LED_COUNT];
|
extern const is31_led PROGMEM g_is31_leds[LED_MATRIX_LED_COUNT];
|
||||||
|
|
||||||
void IS31FL3733_init(uint8_t addr, uint8_t sync);
|
void is31fl3733_init(uint8_t addr, uint8_t sync);
|
||||||
bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
|
bool is31fl3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
|
||||||
bool IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
|
bool is31fl3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
|
||||||
|
|
||||||
void IS31FL3733_set_value(int index, uint8_t value);
|
void is31fl3733_set_value(int index, uint8_t value);
|
||||||
void IS31FL3733_set_value_all(uint8_t value);
|
void is31fl3733_set_value_all(uint8_t value);
|
||||||
|
|
||||||
void IS31FL3733_set_led_control_register(uint8_t index, bool value);
|
void is31fl3733_set_led_control_register(uint8_t index, bool value);
|
||||||
|
|
||||||
// This should not be called from an interrupt
|
// This should not be called from an interrupt
|
||||||
// (eg. from a timer interrupt).
|
// (eg. from a timer interrupt).
|
||||||
// Call this while idle (in between matrix scans).
|
// Call this while idle (in between matrix scans).
|
||||||
// If the buffer is dirty, it will update the driver with the buffer.
|
// If the buffer is dirty, it will update the driver with the buffer.
|
||||||
void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index);
|
void is31fl3733_update_pwm_buffers(uint8_t addr, uint8_t index);
|
||||||
void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index);
|
void is31fl3733_update_led_control_registers(uint8_t addr, uint8_t index);
|
||||||
|
|
||||||
#define PUR_0R 0x00 // No PUR resistor
|
#define PUR_0R 0x00 // No PUR resistor
|
||||||
#define PUR_05KR 0x02 // 0.5k Ohm resistor in t_NOL
|
#define PUR_05KR 0x02 // 0.5k Ohm resistor in t_NOL
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"nkro": true
|
"nkro": true
|
||||||
},
|
},
|
||||||
"led_matrix": {
|
"led_matrix": {
|
||||||
"driver": "IS31FL3731"
|
"driver": "is31fl3731"
|
||||||
},
|
},
|
||||||
"matrix_pins": {
|
"matrix_pins": {
|
||||||
"cols": ["B10", "B2", "B1", "B0", "A7", "B4", "B3", "B7"],
|
"cols": ["B10", "B2", "B1", "B0", "A7", "B4", "B3", "B7"],
|
||||||
|
@ -23,20 +23,20 @@
|
|||||||
*/
|
*/
|
||||||
void init_fallacy_leds(void) {
|
void init_fallacy_leds(void) {
|
||||||
i2c_init();
|
i2c_init();
|
||||||
IS31FL3731_init(LED_DRIVER_ADDR_1);
|
is31fl3731_init(LED_DRIVER_ADDR_1);
|
||||||
|
|
||||||
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
|
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
|
||||||
IS31FL3731_set_led_control_register(i, true);
|
is31fl3731_set_led_control_register(i, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
|
is31fl3731_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* update the buffer
|
/* update the buffer
|
||||||
*/
|
*/
|
||||||
void update_fallacy_leds(void) {
|
void update_fallacy_leds(void) {
|
||||||
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_1, 0);
|
is31fl3731_update_pwm_buffers(LED_DRIVER_ADDR_1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -44,10 +44,10 @@ void update_fallacy_leds(void) {
|
|||||||
*/
|
*/
|
||||||
void set_fallacy_led(int index, bool state) {
|
void set_fallacy_led(int index, bool state) {
|
||||||
if (state) {
|
if (state) {
|
||||||
IS31FL3731_set_value(index, 128);
|
is31fl3731_set_value(index, 128);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
IS31FL3731_set_value(index, 0);
|
is31fl3731_set_value(index, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"device_version": "0.0.1"
|
"device_version": "0.0.1"
|
||||||
},
|
},
|
||||||
"led_matrix": {
|
"led_matrix": {
|
||||||
"driver": "IS31FL3731"
|
"driver": "is31fl3731"
|
||||||
},
|
},
|
||||||
"matrix_pins": {
|
"matrix_pins": {
|
||||||
"cols": ["D1", "D4", "D5", "D6", "D7"],
|
"cols": ["D1", "D4", "D5", "D6", "D7"],
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"device_version": "0.0.1"
|
"device_version": "0.0.1"
|
||||||
},
|
},
|
||||||
"led_matrix": {
|
"led_matrix": {
|
||||||
"driver": "IS31FL3731"
|
"driver": "is31fl3731"
|
||||||
},
|
},
|
||||||
"matrix_pins": {
|
"matrix_pins": {
|
||||||
"cols": ["B2", "B3", "B18", "B19", "C0", "C8", "C9", "C10", "C11"],
|
"cols": ["B2", "B3", "B18", "B19", "C0", "C8", "C9", "C10", "C11"],
|
||||||
|
@ -105,7 +105,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"led_matrix": {
|
"led_matrix": {
|
||||||
"driver": "CKLED2001",
|
"driver": "ckled2001",
|
||||||
"animations": {
|
"animations": {
|
||||||
"none": true,
|
"none": true,
|
||||||
"solid": true,
|
"solid": true,
|
||||||
|
@ -122,7 +122,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"led_matrix": {
|
"led_matrix": {
|
||||||
"driver": "CKLED2001",
|
"driver": "ckled2001",
|
||||||
"animations": {
|
"animations": {
|
||||||
"none": true,
|
"none": true,
|
||||||
"solid": true,
|
"solid": true,
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"device_version": "1.0.0"
|
"device_version": "1.0.0"
|
||||||
},
|
},
|
||||||
"led_matrix": {
|
"led_matrix": {
|
||||||
"driver": "CKLED2001"
|
"driver": "ckled2001"
|
||||||
},
|
},
|
||||||
"matrix_pins": {
|
"matrix_pins": {
|
||||||
"cols": ["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", "A2", "A1", "A0", "C15", "C14"],
|
"cols": ["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", "A2", "A1", "A0", "C15", "C14"],
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"pin": "A7"
|
"pin": "A7"
|
||||||
},
|
},
|
||||||
"led_matrix": {
|
"led_matrix": {
|
||||||
"driver": "IS31FL3731"
|
"driver": "is31fl3731"
|
||||||
},
|
},
|
||||||
"matrix_pins": {
|
"matrix_pins": {
|
||||||
"cols": ["A10", "A9", "A8", "B15", "B14", "B13", "B2", "B1", "A15", "B3", "B9", "B8", "B7", "B6", "B5", "B4"],
|
"cols": ["A10", "A9", "A8", "B15", "B14", "B13", "B2", "B1", "A15", "B3", "B9", "B8", "B7", "B6", "B5", "B4"],
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
"pin": "A7"
|
"pin": "A7"
|
||||||
},
|
},
|
||||||
"led_matrix": {
|
"led_matrix": {
|
||||||
"driver": "IS31FL3731"
|
"driver": "is31fl3731"
|
||||||
},
|
},
|
||||||
"matrix_pins": {
|
"matrix_pins": {
|
||||||
"cols": ["A10", "A9", "A8", "B15", "B14", "B13", "B2", "B1", "A15", "B3", "B9", "B8", "B7", "B6", "B5", "B4"],
|
"cols": ["A10", "A9", "A8", "B15", "B14", "B13", "B2", "B1", "A15", "B3", "B9", "B8", "B7", "B6", "B5", "B4"],
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"led_matrix": {
|
"led_matrix": {
|
||||||
"driver": "IS31FL3731"
|
"driver": "is31fl3731"
|
||||||
},
|
},
|
||||||
"processor": "atmega32u4",
|
"processor": "atmega32u4",
|
||||||
"bootloader": "atmel-dfu",
|
"bootloader": "atmel-dfu",
|
||||||
|
@ -32,13 +32,13 @@ static void init(void) {
|
|||||||
i2c_init();
|
i2c_init();
|
||||||
|
|
||||||
# if defined(IS31FL3731)
|
# if defined(IS31FL3731)
|
||||||
IS31FL3731_init(LED_DRIVER_ADDR_1);
|
is31fl3731_init(LED_DRIVER_ADDR_1);
|
||||||
# if defined(LED_DRIVER_ADDR_2)
|
# if defined(LED_DRIVER_ADDR_2)
|
||||||
IS31FL3731_init(LED_DRIVER_ADDR_2);
|
is31fl3731_init(LED_DRIVER_ADDR_2);
|
||||||
# if defined(LED_DRIVER_ADDR_3)
|
# if defined(LED_DRIVER_ADDR_3)
|
||||||
IS31FL3731_init(LED_DRIVER_ADDR_3);
|
is31fl3731_init(LED_DRIVER_ADDR_3);
|
||||||
# if defined(LED_DRIVER_ADDR_4)
|
# if defined(LED_DRIVER_ADDR_4)
|
||||||
IS31FL3731_init(LED_DRIVER_ADDR_4);
|
is31fl3731_init(LED_DRIVER_ADDR_4);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -47,22 +47,22 @@ static void init(void) {
|
|||||||
# if !defined(LED_DRIVER_SYNC_1)
|
# if !defined(LED_DRIVER_SYNC_1)
|
||||||
# define LED_DRIVER_SYNC_1 0
|
# define LED_DRIVER_SYNC_1 0
|
||||||
# endif
|
# endif
|
||||||
IS31FL3733_init(LED_DRIVER_ADDR_1, LED_DRIVER_SYNC_1);
|
is31fl3733_init(LED_DRIVER_ADDR_1, LED_DRIVER_SYNC_1);
|
||||||
# if defined(LED_DRIVER_ADDR_2)
|
# if defined(LED_DRIVER_ADDR_2)
|
||||||
# if !defined(LED_DRIVER_SYNC_2)
|
# if !defined(LED_DRIVER_SYNC_2)
|
||||||
# define LED_DRIVER_SYNC_2 0
|
# define LED_DRIVER_SYNC_2 0
|
||||||
# endif
|
# endif
|
||||||
IS31FL3733_init(LED_DRIVER_ADDR_2, LED_DRIVER_SYNC_2);
|
is31fl3733_init(LED_DRIVER_ADDR_2, LED_DRIVER_SYNC_2);
|
||||||
# if defined(LED_DRIVER_ADDR_3)
|
# if defined(LED_DRIVER_ADDR_3)
|
||||||
# if !defined(LED_DRIVER_SYNC_3)
|
# if !defined(LED_DRIVER_SYNC_3)
|
||||||
# define LED_DRIVER_SYNC_3 0
|
# define LED_DRIVER_SYNC_3 0
|
||||||
# endif
|
# endif
|
||||||
IS31FL3733_init(LED_DRIVER_ADDR_3, LED_DRIVER_SYNC_3);
|
is31fl3733_init(LED_DRIVER_ADDR_3, LED_DRIVER_SYNC_3);
|
||||||
# if defined(LED_DRIVER_ADDR_4)
|
# if defined(LED_DRIVER_ADDR_4)
|
||||||
# if !defined(LED_DRIVER_SYNC_4)
|
# if !defined(LED_DRIVER_SYNC_4)
|
||||||
# define LED_DRIVER_SYNC_4 0
|
# define LED_DRIVER_SYNC_4 0
|
||||||
# endif
|
# endif
|
||||||
IS31FL3733_init(LED_DRIVER_ADDR_4, LED_DRIVER_SYNC_4);
|
is31fl3733_init(LED_DRIVER_ADDR_4, LED_DRIVER_SYNC_4);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -84,13 +84,13 @@ static void init(void) {
|
|||||||
writePinHigh(LED_DRIVER_SHUTDOWN_PIN);
|
writePinHigh(LED_DRIVER_SHUTDOWN_PIN);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
CKLED2001_init(DRIVER_ADDR_1);
|
ckled2001_init(DRIVER_ADDR_1);
|
||||||
# if defined(DRIVER_ADDR_2)
|
# if defined(DRIVER_ADDR_2)
|
||||||
CKLED2001_init(DRIVER_ADDR_2);
|
ckled2001_init(DRIVER_ADDR_2);
|
||||||
# if defined(DRIVER_ADDR_3)
|
# if defined(DRIVER_ADDR_3)
|
||||||
CKLED2001_init(DRIVER_ADDR_3);
|
ckled2001_init(DRIVER_ADDR_3);
|
||||||
# if defined(DRIVER_ADDR_4)
|
# if defined(DRIVER_ADDR_4)
|
||||||
CKLED2001_init(DRIVER_ADDR_4);
|
ckled2001_init(DRIVER_ADDR_4);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -98,37 +98,37 @@ static void init(void) {
|
|||||||
|
|
||||||
for (int index = 0; index < LED_MATRIX_LED_COUNT; index++) {
|
for (int index = 0; index < LED_MATRIX_LED_COUNT; index++) {
|
||||||
# if defined(IS31FL3731)
|
# if defined(IS31FL3731)
|
||||||
IS31FL3731_set_led_control_register(index, true);
|
is31fl3731_set_led_control_register(index, true);
|
||||||
# elif defined(IS31FL3733)
|
# elif defined(IS31FL3733)
|
||||||
IS31FL3733_set_led_control_register(index, true);
|
is31fl3733_set_led_control_register(index, true);
|
||||||
# elif defined(IS31FLCOMMON)
|
# elif defined(IS31FLCOMMON)
|
||||||
IS31FL_simple_set_scaling_buffer(index, true);
|
IS31FL_simple_set_scaling_buffer(index, true);
|
||||||
# elif defined(CKLED2001)
|
# elif defined(CKLED2001)
|
||||||
CKLED2001_set_led_control_register(index, true);
|
ckled2001_set_led_control_register(index, true);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// This actually updates the LED drivers
|
// This actually updates the LED drivers
|
||||||
# if defined(IS31FL3731)
|
# if defined(IS31FL3731)
|
||||||
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
|
is31fl3731_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
|
||||||
# if defined(LED_DRIVER_ADDR_2)
|
# if defined(LED_DRIVER_ADDR_2)
|
||||||
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_2, 1);
|
is31fl3731_update_led_control_registers(LED_DRIVER_ADDR_2, 1);
|
||||||
# if defined(LED_DRIVER_ADDR_3)
|
# if defined(LED_DRIVER_ADDR_3)
|
||||||
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_3, 2);
|
is31fl3731_update_led_control_registers(LED_DRIVER_ADDR_3, 2);
|
||||||
# if defined(LED_DRIVER_ADDR_4)
|
# if defined(LED_DRIVER_ADDR_4)
|
||||||
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_4, 3);
|
is31fl3731_update_led_control_registers(LED_DRIVER_ADDR_4, 3);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# elif defined(IS31FL3733)
|
# elif defined(IS31FL3733)
|
||||||
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
|
is31fl3733_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
|
||||||
# if defined(LED_DRIVER_ADDR_2)
|
# if defined(LED_DRIVER_ADDR_2)
|
||||||
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_2, 1);
|
is31fl3733_update_led_control_registers(LED_DRIVER_ADDR_2, 1);
|
||||||
# if defined(LED_DRIVER_ADDR_3)
|
# if defined(LED_DRIVER_ADDR_3)
|
||||||
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_3, 2);
|
is31fl3733_update_led_control_registers(LED_DRIVER_ADDR_3, 2);
|
||||||
# if defined(LED_DRIVER_ADDR_4)
|
# if defined(LED_DRIVER_ADDR_4)
|
||||||
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_4, 3);
|
is31fl3733_update_led_control_registers(LED_DRIVER_ADDR_4, 3);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -148,13 +148,13 @@ static void init(void) {
|
|||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# elif defined(CKLED2001)
|
# elif defined(CKLED2001)
|
||||||
CKLED2001_update_led_control_registers(DRIVER_ADDR_1, 0);
|
ckled2001_update_led_control_registers(DRIVER_ADDR_1, 0);
|
||||||
# if defined(DRIVER_ADDR_2)
|
# if defined(DRIVER_ADDR_2)
|
||||||
CKLED2001_update_led_control_registers(DRIVER_ADDR_2, 1);
|
ckled2001_update_led_control_registers(DRIVER_ADDR_2, 1);
|
||||||
# if defined(DRIVER_ADDR_3)
|
# if defined(DRIVER_ADDR_3)
|
||||||
CKLED2001_update_led_control_registers(DRIVER_ADDR_3, 2);
|
ckled2001_update_led_control_registers(DRIVER_ADDR_3, 2);
|
||||||
# if defined(DRIVER_ADDR_4)
|
# if defined(DRIVER_ADDR_4)
|
||||||
CKLED2001_update_led_control_registers(DRIVER_ADDR_4, 3);
|
ckled2001_update_led_control_registers(DRIVER_ADDR_4, 3);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -163,13 +163,13 @@ static void init(void) {
|
|||||||
|
|
||||||
# if defined(IS31FL3731)
|
# if defined(IS31FL3731)
|
||||||
static void flush(void) {
|
static void flush(void) {
|
||||||
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_1, 0);
|
is31fl3731_update_pwm_buffers(LED_DRIVER_ADDR_1, 0);
|
||||||
# if defined(LED_DRIVER_ADDR_2)
|
# if defined(LED_DRIVER_ADDR_2)
|
||||||
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_2, 1);
|
is31fl3731_update_pwm_buffers(LED_DRIVER_ADDR_2, 1);
|
||||||
# if defined(LED_DRIVER_ADDR_3)
|
# if defined(LED_DRIVER_ADDR_3)
|
||||||
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_3, 2);
|
is31fl3731_update_pwm_buffers(LED_DRIVER_ADDR_3, 2);
|
||||||
# if defined(LED_DRIVER_ADDR_4)
|
# if defined(LED_DRIVER_ADDR_4)
|
||||||
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_4, 3);
|
is31fl3731_update_pwm_buffers(LED_DRIVER_ADDR_4, 3);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -178,19 +178,19 @@ static void flush(void) {
|
|||||||
const led_matrix_driver_t led_matrix_driver = {
|
const led_matrix_driver_t led_matrix_driver = {
|
||||||
.init = init,
|
.init = init,
|
||||||
.flush = flush,
|
.flush = flush,
|
||||||
.set_value = IS31FL3731_set_value,
|
.set_value = is31fl3731_set_value,
|
||||||
.set_value_all = IS31FL3731_set_value_all,
|
.set_value_all = is31fl3731_set_value_all,
|
||||||
};
|
};
|
||||||
|
|
||||||
# elif defined(IS31FL3733)
|
# elif defined(IS31FL3733)
|
||||||
static void flush(void) {
|
static void flush(void) {
|
||||||
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_1, 0);
|
is31fl3733_update_pwm_buffers(LED_DRIVER_ADDR_1, 0);
|
||||||
# if defined(LED_DRIVER_ADDR_2)
|
# if defined(LED_DRIVER_ADDR_2)
|
||||||
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_2, 1);
|
is31fl3733_update_pwm_buffers(LED_DRIVER_ADDR_2, 1);
|
||||||
# if defined(LED_DRIVER_ADDR_3)
|
# if defined(LED_DRIVER_ADDR_3)
|
||||||
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_3, 2);
|
is31fl3733_update_pwm_buffers(LED_DRIVER_ADDR_3, 2);
|
||||||
# if defined(LED_DRIVER_ADDR_4)
|
# if defined(LED_DRIVER_ADDR_4)
|
||||||
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_4, 3);
|
is31fl3733_update_pwm_buffers(LED_DRIVER_ADDR_4, 3);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -199,8 +199,8 @@ static void flush(void) {
|
|||||||
const led_matrix_driver_t led_matrix_driver = {
|
const led_matrix_driver_t led_matrix_driver = {
|
||||||
.init = init,
|
.init = init,
|
||||||
.flush = flush,
|
.flush = flush,
|
||||||
.set_value = IS31FL3733_set_value,
|
.set_value = is31fl3733_set_value,
|
||||||
.set_value_all = IS31FL3733_set_value_all,
|
.set_value_all = is31fl3733_set_value_all,
|
||||||
};
|
};
|
||||||
|
|
||||||
# elif defined(IS31FLCOMMON)
|
# elif defined(IS31FLCOMMON)
|
||||||
@ -225,13 +225,13 @@ const led_matrix_driver_t led_matrix_driver = {
|
|||||||
};
|
};
|
||||||
# elif defined(CKLED2001)
|
# elif defined(CKLED2001)
|
||||||
static void flush(void) {
|
static void flush(void) {
|
||||||
CKLED2001_update_pwm_buffers(DRIVER_ADDR_1, 0);
|
ckled2001_update_pwm_buffers(DRIVER_ADDR_1, 0);
|
||||||
# if defined(DRIVER_ADDR_2)
|
# if defined(DRIVER_ADDR_2)
|
||||||
CKLED2001_update_pwm_buffers(DRIVER_ADDR_2, 1);
|
ckled2001_update_pwm_buffers(DRIVER_ADDR_2, 1);
|
||||||
# if defined(DRIVER_ADDR_3)
|
# if defined(DRIVER_ADDR_3)
|
||||||
CKLED2001_update_pwm_buffers(DRIVER_ADDR_3, 2);
|
ckled2001_update_pwm_buffers(DRIVER_ADDR_3, 2);
|
||||||
# if defined(DRIVER_ADDR_4)
|
# if defined(DRIVER_ADDR_4)
|
||||||
CKLED2001_update_pwm_buffers(DRIVER_ADDR_4, 3);
|
ckled2001_update_pwm_buffers(DRIVER_ADDR_4, 3);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@ -240,8 +240,8 @@ static void flush(void) {
|
|||||||
const led_matrix_driver_t led_matrix_driver = {
|
const led_matrix_driver_t led_matrix_driver = {
|
||||||
.init = init,
|
.init = init,
|
||||||
.flush = flush,
|
.flush = flush,
|
||||||
.set_value = CKLED2001_set_value,
|
.set_value = ckled2001_set_value,
|
||||||
.set_value_all = CKLED2001_set_value_all,
|
.set_value_all = ckled2001_set_value_all,
|
||||||
};
|
};
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user