diff options
| -rw-r--r-- | docs/feature_rgb_matrix.md | 36 | ||||
| -rw-r--r-- | drivers/led/issi/is31fl3737.c | 117 | ||||
| -rw-r--r-- | drivers/led/issi/is31fl3737.h | 50 | ||||
| -rw-r--r-- | keyboards/dztech/tofu/ii/v1/config.h | 2 | ||||
| -rw-r--r-- | keyboards/dztech/tofu/jr/v1/config.h | 2 | ||||
| -rw-r--r-- | keyboards/frooastboard/walnut/config.h | 8 | ||||
| -rw-r--r-- | keyboards/mt/mt84/config.h | 2 | ||||
| -rw-r--r-- | keyboards/planck/ez/config.h | 2 |
8 files changed, 124 insertions, 95 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 5cc498a9ed..76c5c4f90b 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md | |||
| @@ -246,31 +246,31 @@ Configure the hardware via your `config.h`: | |||
| 246 | 246 | ||
| 247 | | Variable | Description | Default | | 247 | | Variable | Description | Default | |
| 248 | |----------|-------------|---------| | 248 | |----------|-------------|---------| |
| 249 | | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | | 249 | | `IS31FL3737_I2C_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 | |
| 250 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | | 250 | | `IS31FL3737_I2C_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | |
| 251 | | `ISSI_PWM_FREQUENCY` | (Optional) PWM Frequency Setting - IS31FL3737B only | 0 | | 251 | | `IS31FL3737_PWM_FREQUENCY` | (Optional) PWM Frequency Setting - IS31FL3737B only | 0 | |
| 252 | | `ISSI_GLOBALCURRENT` | (Optional) Configuration for the Global Current Register | 0xFF | | 252 | | `IS31FL3737_GLOBALCURRENT` | (Optional) Configuration for the Global Current Register | 0xFF | |
| 253 | | `ISSI_SWPULLUP` | (Optional) Set the value of the SWx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | | 253 | | `IS31FL3737_SWPULLUP` | (Optional) Set the value of the SWx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | |
| 254 | | `ISSI_CSPULLUP` | (Optional) Set the value of the CSx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | | 254 | | `IS31FL3737_CSPULLUP` | (Optional) Set the value of the CSx lines on-chip de-ghosting resistors | PUR_0R (Disabled) | |
| 255 | | `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | | 255 | | `IS31FL3737_DRIVER_COUNT` | (Required) How many RGB driver IC's are present | | |
| 256 | | `RGB_MATRIX_LED_COUNT` | (Required) How many RGB lights are present across all drivers | | | 256 | | `RGB_MATRIX_LED_COUNT` | (Required) How many RGB lights are present across all drivers | | |
| 257 | | `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | | 257 | | `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | | |
| 258 | | `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | | | 258 | | `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | | |
| 259 | | `DRIVER_ADDR_3` | (Optional) Address for the third RGB driver | | | 259 | | `DRIVER_ADDR_3` | (Optional) Address for the third RGB driver | | |
| 260 | | `DRIVER_ADDR_4` | (Optional) Address for the fourth RGB driver | | | 260 | | `DRIVER_ADDR_4` | (Optional) Address for the fourth RGB driver | | |
| 261 | 261 | ||
| 262 | The IS31FL3737 IC's have on-chip resistors that can be enabled to allow for de-ghosting of the RGB matrix. By default these resistors are not enabled (`ISSI_SWPULLUP`/`ISSI_CSPULLUP` are given the value of`PUR_0R`), the values that can be set to enable de-ghosting are as follows: | 262 | The IS31FL3737 IC's have on-chip resistors that can be enabled to allow for de-ghosting of the RGB matrix. By default these resistors are not enabled (`IS31FL3737_SWPULLUP`/`IS31FL3737_CSPULLUP` are given the value of `IS31FL3737_PUR_0R`), the values that can be set to enable de-ghosting are as follows: |
| 263 | 263 | ||
| 264 | | `ISSI_SWPULLUP/ISSI_CSPULLUP` | Description | | 264 | | `IS31FL3737_SWPULLUP/IS31FL3737_CSPULLUP` | Description | |
| 265 | |----------------------|-------------| | 265 | |----------------------|-------------| |
| 266 | | `PUR_0R` | (default) Do not use the on-chip resistors/enable de-ghosting | | 266 | | `IS31FL3737_PUR_0R` | (default) Do not use the on-chip resistors/enable de-ghosting | |
| 267 | | `PUR_05KR` | The 0.5k Ohm resistor used during blanking period (t_NOL) | | 267 | | `IS31FL3737_PUR_05KR` | The 0.5k Ohm resistor used during blanking period (t_NOL) | |
| 268 | | `PUR_1KR` | The 1k Ohm resistor used during blanking period (t_NOL) | | 268 | | `IS31FL3737_PUR_1KR` | The 1k Ohm resistor used during blanking period (t_NOL) | |
| 269 | | `PUR_2KR` | The 2k Ohm resistor used during blanking period (t_NOL) | | 269 | | `IS31FL3737_PUR_2KR` | The 2k Ohm resistor used during blanking period (t_NOL) | |
| 270 | | `PUR_4KR` | The 4k Ohm resistor used during blanking period (t_NOL) | | 270 | | `IS31FL3737_PUR_4KR` | The 4k Ohm resistor used during blanking period (t_NOL) | |
| 271 | | `PUR_8KR` | The 8k Ohm resistor during blanking period (t_NOL) | | 271 | | `IS31FL3737_PUR_8KR` | The 8k Ohm resistor during blanking period (t_NOL) | |
| 272 | | `PUR_16KR` | The 16k Ohm resistor during blanking period (t_NOL) | | 272 | | `IS31FL3737_PUR_16KR` | The 16k Ohm resistor during blanking period (t_NOL) | |
| 273 | | `PUR_32KR` | The 32k Ohm resistor used during blanking period (t_NOL) | | 273 | | `IS31FL3737_PUR_32KR` | The 32k Ohm resistor used during blanking period (t_NOL) | |
| 274 | 274 | ||
| 275 | Here is an example using 2 drivers. | 275 | Here is an example using 2 drivers. |
| 276 | 276 | ||
| @@ -287,7 +287,7 @@ Here is an example using 2 drivers. | |||
| 287 | #define DRIVER_ADDR_1 0b1010000 | 287 | #define DRIVER_ADDR_1 0b1010000 |
| 288 | #define DRIVER_ADDR_2 0b1010001 | 288 | #define DRIVER_ADDR_2 0b1010001 |
| 289 | 289 | ||
| 290 | #define DRIVER_COUNT 2 | 290 | #define IS31FL3737_DRIVER_COUNT 2 |
| 291 | #define DRIVER_1_LED_TOTAL 30 | 291 | #define DRIVER_1_LED_TOTAL 30 |
| 292 | #define DRIVER_2_LED_TOTAL 36 | 292 | #define DRIVER_2_LED_TOTAL 36 |
| 293 | #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | 293 | #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) |
diff --git a/drivers/led/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c index 947c0a1d1a..94bd755dea 100644 --- a/drivers/led/issi/is31fl3737.c +++ b/drivers/led/issi/is31fl3737.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #include "is31fl3737.h" | 20 | #include "is31fl3737.h" |
| 21 | #include <string.h> | ||
| 21 | #include "i2c_master.h" | 22 | #include "i2c_master.h" |
| 22 | #include "wait.h" | 23 | #include "wait.h" |
| 23 | 24 | ||
| @@ -31,46 +32,46 @@ | |||
| 31 | // ADDR1 represents A1:A0 of the 7-bit address. | 32 | // ADDR1 represents A1:A0 of the 7-bit address. |
| 32 | // ADDR2 represents A3:A2 of the 7-bit address. | 33 | // ADDR2 represents A3:A2 of the 7-bit address. |
| 33 | // The result is: 0b101(ADDR2)(ADDR1) | 34 | // The result is: 0b101(ADDR2)(ADDR1) |
| 34 | #define ISSI_ADDR_DEFAULT 0x50 | 35 | #define IS31FL3737_I2C_ADDRESS_DEFAULT 0x50 |
| 35 | 36 | ||
| 36 | #define ISSI_COMMANDREGISTER 0xFD | 37 | #define IS31FL3737_COMMANDREGISTER 0xFD |
| 37 | #define ISSI_COMMANDREGISTER_WRITELOCK 0xFE | 38 | #define IS31FL3737_COMMANDREGISTER_WRITELOCK 0xFE |
| 38 | #define ISSI_INTERRUPTMASKREGISTER 0xF0 | 39 | #define IS31FL3737_INTERRUPTMASKREGISTER 0xF0 |
| 39 | #define ISSI_INTERRUPTSTATUSREGISTER 0xF1 | 40 | #define IS31FL3737_INTERRUPTSTATUSREGISTER 0xF1 |
| 40 | 41 | ||
| 41 | #define ISSI_PAGE_LEDCONTROL 0x00 // PG0 | 42 | #define IS31FL3737_PAGE_LEDCONTROL 0x00 // PG0 |
| 42 | #define ISSI_PAGE_PWM 0x01 // PG1 | 43 | #define IS31FL3737_PAGE_PWM 0x01 // PG1 |
| 43 | #define ISSI_PAGE_AUTOBREATH 0x02 // PG2 | 44 | #define IS31FL3737_PAGE_AUTOBREATH 0x02 // PG2 |
| 44 | #define ISSI_PAGE_FUNCTION 0x03 // PG3 | 45 | #define IS31FL3737_PAGE_FUNCTION 0x03 // PG3 |
| 45 | 46 | ||
| 46 | #define ISSI_REG_CONFIGURATION 0x00 // PG3 | 47 | #define IS31FL3737_REG_CONFIGURATION 0x00 // PG3 |
| 47 | #define ISSI_REG_GLOBALCURRENT 0x01 // PG3 | 48 | #define IS31FL3737_REG_GLOBALCURRENT 0x01 // PG3 |
| 48 | #define ISSI_REG_RESET 0x11 // PG3 | 49 | #define IS31FL3737_REG_RESET 0x11 // PG3 |
| 49 | #define ISSI_REG_SWPULLUP 0x0F // PG3 | 50 | #define IS31FL3737_REG_SWPULLUP 0x0F // PG3 |
| 50 | #define ISSI_REG_CSPULLUP 0x10 // PG3 | 51 | #define IS31FL3737_REG_CSPULLUP 0x10 // PG3 |
| 51 | 52 | ||
| 52 | #ifndef ISSI_TIMEOUT | 53 | #ifndef IS31FL3737_I2C_TIMEOUT |
| 53 | # define ISSI_TIMEOUT 100 | 54 | # define IS31FL3737_I2C_TIMEOUT 100 |
| 54 | #endif | 55 | #endif |
| 55 | 56 | ||
| 56 | #ifndef ISSI_PERSISTENCE | 57 | #ifndef IS31FL3737_I2C_PERSISTENCE |
| 57 | # define ISSI_PERSISTENCE 0 | 58 | # define IS31FL3737_I2C_PERSISTENCE 0 |
| 58 | #endif | 59 | #endif |
| 59 | 60 | ||
| 60 | #ifndef ISSI_PWM_FREQUENCY | 61 | #ifndef IS31FL3737_PWM_FREQUENCY |
| 61 | # define ISSI_PWM_FREQUENCY 0b000 // PFS - IS31FL3737B only | 62 | # define IS31FL3737_PWM_FREQUENCY 0b000 // PFS - IS31FL3737B only |
| 62 | #endif | 63 | #endif |
| 63 | 64 | ||
| 64 | #ifndef ISSI_SWPULLUP | 65 | #ifndef IS31FL3737_SWPULLUP |
| 65 | # define ISSI_SWPULLUP PUR_0R | 66 | # define IS31FL3737_SWPULLUP IS31FL3737_PUR_0R |
| 66 | #endif | 67 | #endif |
| 67 | 68 | ||
| 68 | #ifndef ISSI_CSPULLUP | 69 | #ifndef IS31FL3737_CSPULLUP |
| 69 | # define ISSI_CSPULLUP PUR_0R | 70 | # define IS31FL3737_CSPULLUP IS31FL3737_PUR_0R |
| 70 | #endif | 71 | #endif |
| 71 | 72 | ||
| 72 | #ifndef ISSI_GLOBALCURRENT | 73 | #ifndef IS31FL3737_GLOBALCURRENT |
| 73 | # define ISSI_GLOBALCURRENT 0xFF | 74 | # define IS31FL3737_GLOBALCURRENT 0xFF |
| 74 | #endif | 75 | #endif |
| 75 | 76 | ||
| 76 | // Transfer buffer for TWITransmitData() | 77 | // Transfer buffer for TWITransmitData() |
| @@ -83,22 +84,22 @@ uint8_t g_twi_transfer_buffer[20]; | |||
| 83 | // buffers and the transfers in is31fl3737_write_pwm_buffer() but it's | 84 | // buffers and the transfers in is31fl3737_write_pwm_buffer() but it's |
| 84 | // probably not worth the extra complexity. | 85 | // probably not worth the extra complexity. |
| 85 | 86 | ||
| 86 | uint8_t g_pwm_buffer[DRIVER_COUNT][192]; | 87 | uint8_t g_pwm_buffer[IS31FL3737_DRIVER_COUNT][192]; |
| 87 | bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; | 88 | bool g_pwm_buffer_update_required[IS31FL3737_DRIVER_COUNT] = {false}; |
| 88 | 89 | ||
| 89 | uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0}; | 90 | uint8_t g_led_control_registers[IS31FL3737_DRIVER_COUNT][24] = {0}; |
| 90 | bool g_led_control_registers_update_required[DRIVER_COUNT] = {false}; | 91 | bool g_led_control_registers_update_required[IS31FL3737_DRIVER_COUNT] = {false}; |
| 91 | 92 | ||
| 92 | void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) { | 93 | void is31fl3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) { |
| 93 | g_twi_transfer_buffer[0] = reg; | 94 | g_twi_transfer_buffer[0] = reg; |
| 94 | g_twi_transfer_buffer[1] = data; | 95 | g_twi_transfer_buffer[1] = data; |
| 95 | 96 | ||
| 96 | #if ISSI_PERSISTENCE > 0 | 97 | #if IS31FL3737_I2C_PERSISTENCE > 0 |
| 97 | for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { | 98 | for (uint8_t i = 0; i < IS31FL3737_I2C_PERSISTENCE; i++) { |
| 98 | if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break; | 99 | if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3737_I2C_TIMEOUT) == 0) break; |
| 99 | } | 100 | } |
| 100 | #else | 101 | #else |
| 101 | i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT); | 102 | i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, IS31FL3737_I2C_TIMEOUT); |
| 102 | #endif | 103 | #endif |
| 103 | } | 104 | } |
| 104 | 105 | ||
| @@ -116,12 +117,12 @@ void is31fl3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) { | |||
| 116 | // thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer | 117 | // thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer |
| 117 | memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 16); | 118 | memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 16); |
| 118 | 119 | ||
| 119 | #if ISSI_PERSISTENCE > 0 | 120 | #if IS31FL3737_I2C_PERSISTENCE > 0 |
| 120 | for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { | 121 | for (uint8_t i = 0; i < IS31FL3737_I2C_PERSISTENCE; i++) { |
| 121 | if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break; | 122 | if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3737_I2C_TIMEOUT) == 0) break; |
| 122 | } | 123 | } |
| 123 | #else | 124 | #else |
| 124 | i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT); | 125 | i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, IS31FL3737_I2C_TIMEOUT); |
| 125 | #endif | 126 | #endif |
| 126 | } | 127 | } |
| 127 | } | 128 | } |
| @@ -133,20 +134,20 @@ void is31fl3737_init(uint8_t addr) { | |||
| 133 | // then disable software shutdown. | 134 | // then disable software shutdown. |
| 134 | 135 | ||
| 135 | // Unlock the command register. | 136 | // Unlock the command register. |
| 136 | is31fl3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); | 137 | is31fl3737_write_register(addr, IS31FL3737_COMMANDREGISTER_WRITELOCK, 0xC5); |
| 137 | 138 | ||
| 138 | // Select PG0 | 139 | // Select PG0 |
| 139 | is31fl3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); | 140 | is31fl3737_write_register(addr, IS31FL3737_COMMANDREGISTER, IS31FL3737_PAGE_LEDCONTROL); |
| 140 | // Turn off all LEDs. | 141 | // Turn off all LEDs. |
| 141 | for (int i = 0x00; i <= 0x17; i++) { | 142 | for (int i = 0x00; i <= 0x17; i++) { |
| 142 | is31fl3737_write_register(addr, i, 0x00); | 143 | is31fl3737_write_register(addr, i, 0x00); |
| 143 | } | 144 | } |
| 144 | 145 | ||
| 145 | // Unlock the command register. | 146 | // Unlock the command register. |
| 146 | is31fl3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); | 147 | is31fl3737_write_register(addr, IS31FL3737_COMMANDREGISTER_WRITELOCK, 0xC5); |
| 147 | 148 | ||
| 148 | // Select PG1 | 149 | // Select PG1 |
| 149 | is31fl3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); | 150 | is31fl3737_write_register(addr, IS31FL3737_COMMANDREGISTER, IS31FL3737_PAGE_PWM); |
| 150 | // Set PWM on all LEDs to 0 | 151 | // Set PWM on all LEDs to 0 |
| 151 | // No need to setup Breath registers to PWM as that is the default. | 152 | // No need to setup Breath registers to PWM as that is the default. |
| 152 | for (int i = 0x00; i <= 0xBF; i++) { | 153 | for (int i = 0x00; i <= 0xBF; i++) { |
| @@ -154,18 +155,18 @@ void is31fl3737_init(uint8_t addr) { | |||
| 154 | } | 155 | } |
| 155 | 156 | ||
| 156 | // Unlock the command register. | 157 | // Unlock the command register. |
| 157 | is31fl3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); | 158 | is31fl3737_write_register(addr, IS31FL3737_COMMANDREGISTER_WRITELOCK, 0xC5); |
| 158 | 159 | ||
| 159 | // Select PG3 | 160 | // Select PG3 |
| 160 | is31fl3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION); | 161 | is31fl3737_write_register(addr, IS31FL3737_COMMANDREGISTER, IS31FL3737_PAGE_FUNCTION); |
| 161 | // Set de-ghost pull-up resistors (SWx) | 162 | // Set de-ghost pull-up resistors (SWx) |
| 162 | is31fl3737_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP); | 163 | is31fl3737_write_register(addr, IS31FL3737_REG_SWPULLUP, IS31FL3737_SWPULLUP); |
| 163 | // Set de-ghost pull-down resistors (CSx) | 164 | // Set de-ghost pull-down resistors (CSx) |
| 164 | is31fl3737_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP); | 165 | is31fl3737_write_register(addr, IS31FL3737_REG_CSPULLUP, IS31FL3737_CSPULLUP); |
| 165 | // Set global current to maximum. | 166 | // Set global current to maximum. |
| 166 | is31fl3737_write_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT); | 167 | is31fl3737_write_register(addr, IS31FL3737_REG_GLOBALCURRENT, IS31FL3737_GLOBALCURRENT); |
| 167 | // Disable software shutdown. | 168 | // Disable software shutdown. |
| 168 | is31fl3737_write_register(addr, ISSI_REG_CONFIGURATION, ((ISSI_PWM_FREQUENCY & 0b111) << 3) | 0x01); | 169 | is31fl3737_write_register(addr, IS31FL3737_REG_CONFIGURATION, ((IS31FL3737_PWM_FREQUENCY & 0b111) << 3) | 0x01); |
| 169 | 170 | ||
| 170 | // Wait 10ms to ensure the device has woken up. | 171 | // Wait 10ms to ensure the device has woken up. |
| 171 | wait_ms(10); | 172 | wait_ms(10); |
| @@ -225,22 +226,22 @@ void is31fl3737_set_led_control_register(uint8_t index, bool red, bool green, bo | |||
| 225 | void is31fl3737_update_pwm_buffers(uint8_t addr, uint8_t index) { | 226 | void is31fl3737_update_pwm_buffers(uint8_t addr, uint8_t index) { |
| 226 | if (g_pwm_buffer_update_required[index]) { | 227 | if (g_pwm_buffer_update_required[index]) { |
| 227 | // Firstly we need to unlock the command register and select PG1 | 228 | // Firstly we need to unlock the command register and select PG1 |
| 228 | is31fl3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); | 229 | is31fl3737_write_register(addr, IS31FL3737_COMMANDREGISTER_WRITELOCK, 0xC5); |
| 229 | is31fl3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); | 230 | is31fl3737_write_register(addr, IS31FL3737_COMMANDREGISTER, IS31FL3737_PAGE_PWM); |
| 230 | 231 | ||
| 231 | is31fl3737_write_pwm_buffer(addr, g_pwm_buffer[index]); | 232 | is31fl3737_write_pwm_buffer(addr, g_pwm_buffer[index]); |
| 233 | g_pwm_buffer_update_required[index] = false; | ||
| 232 | } | 234 | } |
| 233 | g_pwm_buffer_update_required[index] = false; | ||
| 234 | } | 235 | } |
| 235 | 236 | ||
| 236 | void is31fl3737_update_led_control_registers(uint8_t addr, uint8_t index) { | 237 | void is31fl3737_update_led_control_registers(uint8_t addr, uint8_t index) { |
| 237 | if (g_led_control_registers_update_required[index]) { | 238 | if (g_led_control_registers_update_required[index]) { |
| 238 | // Firstly we need to unlock the command register and select PG0 | 239 | // Firstly we need to unlock the command register and select PG0 |
| 239 | is31fl3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); | 240 | is31fl3737_write_register(addr, IS31FL3737_COMMANDREGISTER_WRITELOCK, 0xC5); |
| 240 | is31fl3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); | 241 | is31fl3737_write_register(addr, IS31FL3737_COMMANDREGISTER, IS31FL3737_PAGE_LEDCONTROL); |
| 241 | for (int i = 0; i < 24; i++) { | 242 | for (int i = 0; i < 24; i++) { |
| 242 | is31fl3737_write_register(addr, i, g_led_control_registers[index][i]); | 243 | is31fl3737_write_register(addr, i, g_led_control_registers[index][i]); |
| 243 | } | 244 | } |
| 245 | g_led_control_registers_update_required[index] = false; | ||
| 244 | } | 246 | } |
| 245 | g_led_control_registers_update_required[index] = false; | ||
| 246 | } | 247 | } |
diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h index e7fc97872c..a6a9a3a059 100644 --- a/drivers/led/issi/is31fl3737.h +++ b/drivers/led/issi/is31fl3737.h | |||
| @@ -19,9 +19,41 @@ | |||
| 19 | 19 | ||
| 20 | #pragma once | 20 | #pragma once |
| 21 | 21 | ||
| 22 | // ======== DEPRECATED DEFINES - DO NOT USE ======== | ||
| 23 | #ifdef DRIVER_COUNT | ||
| 24 | # define IS31FL3737_DRIVER_COUNT DRIVER_COUNT | ||
| 25 | #endif | ||
| 26 | #ifdef ISSI_TIMEOUT | ||
| 27 | # define IS31FL3737_I2C_TIMEOUT ISSI_TIMEOUT | ||
| 28 | #endif | ||
| 29 | #ifdef ISSI_PERSISTENCE | ||
| 30 | # define IS31FL3737_I2C_PERSISTENCE ISSI_PERSISTENCE | ||
| 31 | #endif | ||
| 32 | #ifdef ISSI_PWM_FREQUENCY | ||
| 33 | # define IS31FL3737_PWM_FREQUENCY ISSI_PWM_FREQUENCY | ||
| 34 | #endif | ||
| 35 | #ifdef ISSI_SWPULLUP | ||
| 36 | # define IS31FL3737_SWPULLUP ISSI_SWPULLUP | ||
| 37 | #endif | ||
| 38 | #ifdef ISSI_CSPULLUP | ||
| 39 | # define IS31FL3737_CSPULLUP ISSI_CSPULLUP | ||
| 40 | #endif | ||
| 41 | #ifdef ISSI_GLOBALCURRENT | ||
| 42 | # define IS31FL3737_GLOBALCURRENT ISSI_GLOBALCURRENT | ||
| 43 | #endif | ||
| 44 | |||
| 45 | #define PUR_0R IS31FL3737_PUR_0R | ||
| 46 | #define PUR_05KR IS31FL3737_PUR_05KR | ||
| 47 | #define PUR_1KR IS31FL3737_PUR_1KR | ||
| 48 | #define PUR_2KR IS31FL3737_PUR_2KR | ||
| 49 | #define PUR_4KR IS31FL3737_PUR_4KR | ||
| 50 | #define PUR_8KR IS31FL3737_PUR_8KR | ||
| 51 | #define PUR_16KR IS31FL3737_PUR_16KR | ||
| 52 | #define PUR_32KR IS31FL3737_PUR_32KR | ||
| 53 | // ======== | ||
| 54 | |||
| 22 | #include <stdint.h> | 55 | #include <stdint.h> |
| 23 | #include <stdbool.h> | 56 | #include <stdbool.h> |
| 24 | #include <string.h> | ||
| 25 | #include "progmem.h" | 57 | #include "progmem.h" |
| 26 | 58 | ||
| 27 | typedef struct is31_led { | 59 | typedef struct is31_led { |
| @@ -49,14 +81,14 @@ void is31fl3737_set_led_control_register(uint8_t index, bool red, bool green, bo | |||
| 49 | void is31fl3737_update_pwm_buffers(uint8_t addr, uint8_t index); | 81 | void is31fl3737_update_pwm_buffers(uint8_t addr, uint8_t index); |
| 50 | void is31fl3737_update_led_control_registers(uint8_t addr, uint8_t index); | 82 | void is31fl3737_update_led_control_registers(uint8_t addr, uint8_t index); |
| 51 | 83 | ||
| 52 | #define PUR_0R 0x00 // No PUR resistor | 84 | #define IS31FL3737_PUR_0R 0x00 // No PUR resistor |
| 53 | #define PUR_05KR 0x01 // 0.5k Ohm resistor in t_NOL | 85 | #define IS31FL3737_PUR_05KR 0x01 // 0.5k Ohm resistor in t_NOL |
| 54 | #define PUR_1KR 0x02 // 1.0k Ohm resistor in t_NOL | 86 | #define IS31FL3737_PUR_1KR 0x02 // 1.0k Ohm resistor in t_NOL |
| 55 | #define PUR_2KR 0x03 // 2.0k Ohm resistor in t_NOL | 87 | #define IS31FL3737_PUR_2KR 0x03 // 2.0k Ohm resistor in t_NOL |
| 56 | #define PUR_4KR 0x04 // 4.0k Ohm resistor in t_NOL | 88 | #define IS31FL3737_PUR_4KR 0x04 // 4.0k Ohm resistor in t_NOL |
| 57 | #define PUR_8KR 0x05 // 8.0k Ohm resistor in t_NOL | 89 | #define IS31FL3737_PUR_8KR 0x05 // 8.0k Ohm resistor in t_NOL |
| 58 | #define PUR_16KR 0x06 // 16k Ohm resistor in t_NOL | 90 | #define IS31FL3737_PUR_16KR 0x06 // 16k Ohm resistor in t_NOL |
| 59 | #define PUR_32KR 0x07 // 32k Ohm resistor in t_NOL | 91 | #define IS31FL3737_PUR_32KR 0x07 // 32k Ohm resistor in t_NOL |
| 60 | 92 | ||
| 61 | #define A_1 0x00 | 93 | #define A_1 0x00 |
| 62 | #define A_2 0x01 | 94 | #define A_2 0x01 |
diff --git a/keyboards/dztech/tofu/ii/v1/config.h b/keyboards/dztech/tofu/ii/v1/config.h index 67a4c757af..b709c8d2ba 100644 --- a/keyboards/dztech/tofu/ii/v1/config.h +++ b/keyboards/dztech/tofu/ii/v1/config.h | |||
| @@ -81,7 +81,7 @@ | |||
| 81 | # define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_ALL | 81 | # define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_ALL |
| 82 | # define DRIVER_ADDR_1 0b1010000 | 82 | # define DRIVER_ADDR_1 0b1010000 |
| 83 | # define DRIVER_ADDR_2 0b1011111 | 83 | # define DRIVER_ADDR_2 0b1011111 |
| 84 | # define DRIVER_COUNT 2 | 84 | # define IS31FL3737_DRIVER_COUNT 2 |
| 85 | # define DRIVER_1_LED_TOTAL 46 | 85 | # define DRIVER_1_LED_TOTAL 46 |
| 86 | # define DRIVER_2_LED_TOTAL 20 | 86 | # define DRIVER_2_LED_TOTAL 20 |
| 87 | # define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | 87 | # define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) |
diff --git a/keyboards/dztech/tofu/jr/v1/config.h b/keyboards/dztech/tofu/jr/v1/config.h index a05cdacf79..a9ab620c58 100644 --- a/keyboards/dztech/tofu/jr/v1/config.h +++ b/keyboards/dztech/tofu/jr/v1/config.h | |||
| @@ -81,7 +81,7 @@ | |||
| 81 | # define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_ALL | 81 | # define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_ALL |
| 82 | # define DRIVER_ADDR_1 0b1010000 | 82 | # define DRIVER_ADDR_1 0b1010000 |
| 83 | # define DRIVER_ADDR_2 0b1011111 | 83 | # define DRIVER_ADDR_2 0b1011111 |
| 84 | # define DRIVER_COUNT 2 | 84 | # define IS31FL3737_DRIVER_COUNT 2 |
| 85 | # define DRIVER_1_LED_TOTAL 48 | 85 | # define DRIVER_1_LED_TOTAL 48 |
| 86 | # define DRIVER_2_LED_TOTAL 20 | 86 | # define DRIVER_2_LED_TOTAL 20 |
| 87 | # define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | 87 | # define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) |
diff --git a/keyboards/frooastboard/walnut/config.h b/keyboards/frooastboard/walnut/config.h index 2703ec1e37..2f11b88377 100644 --- a/keyboards/frooastboard/walnut/config.h +++ b/keyboards/frooastboard/walnut/config.h | |||
| @@ -3,12 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #define ISSI_TIMEOUT 100 | 6 | #define IS31FL3737_PWM_FREQUENCY 0b010 |
| 7 | #define ISSI_PERSISTENCE 0 | 7 | #define IS31FL3737_DRIVER_COUNT 1 |
| 8 | #define ISSI_PWM_FREQUENCY 0b010 | ||
| 9 | #define ISSI_SWPULLUP PUR_0R | ||
| 10 | #define ISSI_CSPULLUP PUR_0R | ||
| 11 | #define DRIVER_COUNT 1 | ||
| 12 | #define RGB_MATRIX_LED_COUNT 48 | 8 | #define RGB_MATRIX_LED_COUNT 48 |
| 13 | #define DRIVER_ADDR_1 0b1010000 | 9 | #define DRIVER_ADDR_1 0b1010000 |
| 14 | 10 | ||
diff --git a/keyboards/mt/mt84/config.h b/keyboards/mt/mt84/config.h index 67aae9a1fd..aba0632179 100644 --- a/keyboards/mt/mt84/config.h +++ b/keyboards/mt/mt84/config.h | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | #define DRIVER_COUNT 2 | 30 | #define IS31FL3737_DRIVER_COUNT 2 |
| 31 | #define DRIVER_1_LED_TOTAL 44 | 31 | #define DRIVER_1_LED_TOTAL 44 |
| 32 | #define DRIVER_2_LED_TOTAL 40 | 32 | #define DRIVER_2_LED_TOTAL 40 |
| 33 | #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | 33 | #define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) |
diff --git a/keyboards/planck/ez/config.h b/keyboards/planck/ez/config.h index 7cfc65d509..ca57e4e772 100644 --- a/keyboards/planck/ez/config.h +++ b/keyboards/planck/ez/config.h | |||
| @@ -52,7 +52,7 @@ | |||
| 52 | 52 | ||
| 53 | #define DRIVER_ADDR_1 0b1010000 | 53 | #define DRIVER_ADDR_1 0b1010000 |
| 54 | 54 | ||
| 55 | #define DRIVER_COUNT 1 | 55 | #define IS31FL3737_DRIVER_COUNT 1 |
| 56 | #define RGB_MATRIX_LED_COUNT 47 | 56 | #define RGB_MATRIX_LED_COUNT 47 |
| 57 | 57 | ||
| 58 | #define RGB_MATRIX_KEYPRESSES | 58 | #define RGB_MATRIX_KEYPRESSES |
