Skip to content

Commit b0a6c3a

Browse files
fauxparkzgagnon
authored andcommitted
Add and use PWM frequency defines for ISSI LED drivers (qmk#22009)
1 parent 9b43397 commit b0a6c3a

File tree

18 files changed

+58
-12
lines changed

18 files changed

+58
-12
lines changed

drivers/led/issi/is31fl3733-simple.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#endif
6161

6262
#ifndef IS31FL3733_PWM_FREQUENCY
63-
# define IS31FL3733_PWM_FREQUENCY 0b000 // PFS - IS31FL3733B only
63+
# define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_8K4_HZ // PFS - IS31FL3733B only
6464
#endif
6565

6666
#ifndef IS31FL3733_SWPULLUP

drivers/led/issi/is31fl3733-simple.h

+6
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ void is31fl3733_update_led_control_registers(uint8_t addr, uint8_t index);
8787
#define IS31FL3733_PUR_16KR 0x06 // 16k Ohm resistor on all the time
8888
#define IS31FL3733_PUR_32KR 0x07 // 32k Ohm resistor in t_NOL
8989

90+
#define IS31FL3733_PWM_FREQUENCY_8K4_HZ 0b000
91+
#define IS31FL3733_PWM_FREQUENCY_4K2_HZ 0b001
92+
#define IS31FL3733_PWM_FREQUENCY_26K7_HZ 0b010
93+
#define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011
94+
#define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100
95+
9096
#define A_1 0x00
9197
#define A_2 0x01
9298
#define A_3 0x02

drivers/led/issi/is31fl3733.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#endif
6060

6161
#ifndef IS31FL3733_PWM_FREQUENCY
62-
# define IS31FL3733_PWM_FREQUENCY 0b000 // PFS - IS31FL3733B only
62+
# define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_8K4_HZ // PFS - IS31FL3733B only
6363
#endif
6464

6565
#ifndef IS31FL3733_SWPULLUP

drivers/led/issi/is31fl3733.h

+6
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ void is31fl3733_update_led_control_registers(uint8_t addr, uint8_t index);
8888
#define IS31FL3733_PUR_16KR 0x06 // 16k Ohm resistor on all the time
8989
#define IS31FL3733_PUR_32KR 0x07 // 32k Ohm resistor in t_NOL
9090

91+
#define IS31FL3733_PWM_FREQUENCY_8K4_HZ 0b000
92+
#define IS31FL3733_PWM_FREQUENCY_4K2_HZ 0b001
93+
#define IS31FL3733_PWM_FREQUENCY_26K7_HZ 0b010
94+
#define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011
95+
#define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100
96+
9197
#define A_1 0x00
9298
#define A_2 0x01
9399
#define A_3 0x02

drivers/led/issi/is31fl3736.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,18 @@
4848
#define IS31FL3736_REG_SWPULLUP 0x0F // PG3
4949
#define IS31FL3736_REG_CSPULLUP 0x10 // PG3
5050

51-
#ifndef IS31FL3736_TIMEOUT
51+
#ifndef IS31FL3736_I2C_TIMEOUT
5252
# define IS31FL3736_I2C_TIMEOUT 100
5353
#endif
5454

5555
#ifndef IS31FL3736_I2C_PERSISTENCE
5656
# define IS31FL3736_I2C_PERSISTENCE 0
5757
#endif
5858

59+
#ifndef IS31FL3736_PWM_FREQUENCY
60+
# define IS31FL3736_PWM_FREQUENCY IS31FL3736_PWM_FREQUENCY_8K4_HZ // PFS - IS31FL3736B only
61+
#endif
62+
5963
#ifndef IS31FL3736_SWPULLUP
6064
# define IS31FL3736_SWPULLUP IS31FL3736_PUR_0R
6165
#endif
@@ -159,7 +163,7 @@ void is31fl3736_init(uint8_t addr) {
159163
// Set global current to maximum.
160164
is31fl3736_write_register(addr, IS31FL3736_REG_GLOBALCURRENT, IS31FL3736_GLOBALCURRENT);
161165
// Disable software shutdown.
162-
is31fl3736_write_register(addr, IS31FL3736_REG_CONFIGURATION, 0x01);
166+
is31fl3736_write_register(addr, IS31FL3736_REG_CONFIGURATION, ((IS31FL3736_PWM_FREQUENCY & 0b111) << 3) | 0x01);
163167

164168
// Wait 10ms to ensure the device has woken up.
165169
wait_ms(10);

drivers/led/issi/is31fl3736.h

+6
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ void is31fl3736_update_led_control_registers(uint8_t addr, uint8_t index);
8989
#define IS31FL3736_PUR_16KR 0x06 // 16k Ohm resistor
9090
#define IS31FL3736_PUR_32KR 0x07 // 32k Ohm resistor
9191

92+
#define IS31FL3736_PWM_FREQUENCY_8K4_HZ 0b000
93+
#define IS31FL3736_PWM_FREQUENCY_4K2_HZ 0b001
94+
#define IS31FL3736_PWM_FREQUENCY_26K7_HZ 0b010
95+
#define IS31FL3736_PWM_FREQUENCY_2K1_HZ 0b011
96+
#define IS31FL3736_PWM_FREQUENCY_1K05_HZ 0b100
97+
9298
#define A_1 0x00
9399
#define A_2 0x02
94100
#define A_3 0x04

drivers/led/issi/is31fl3737.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#endif
6060

6161
#ifndef IS31FL3737_PWM_FREQUENCY
62-
# define IS31FL3737_PWM_FREQUENCY 0b000 // PFS - IS31FL3737B only
62+
# define IS31FL3737_PWM_FREQUENCY IS31FL3737_PWM_FREQUENCY_8K4_HZ // PFS - IS31FL3737B only
6363
#endif
6464

6565
#ifndef IS31FL3737_SWPULLUP

drivers/led/issi/is31fl3737.h

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ void is31fl3737_update_led_control_registers(uint8_t addr, uint8_t index);
9090
#define IS31FL3737_PUR_16KR 0x06 // 16k Ohm resistor in t_NOL
9191
#define IS31FL3737_PUR_32KR 0x07 // 32k Ohm resistor in t_NOL
9292

93+
#define IS31FL3737_PWM_FREQUENCY_8K4_HZ 0b000
94+
#define IS31FL3737_PWM_FREQUENCY_4K2_HZ 0b001
95+
#define IS31FL3737_PWM_FREQUENCY_26K7_HZ 0b010
96+
#define IS31FL3737_PWM_FREQUENCY_2K1_HZ 0b011
97+
#define IS31FL3737_PWM_FREQUENCY_1K05_HZ 0b100
98+
9399
#define A_1 0x00
94100
#define A_2 0x01
95101
#define A_3 0x02

drivers/led/issi/is31fl3741.c

+7
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#define IS31FL3741_REG_CONFIGURATION 0x00 // PG4
5050
#define IS31FL3741_REG_GLOBALCURRENT 0x01 // PG4
5151
#define IS31FL3741_REG_PULLDOWNUP 0x02 // PG4
52+
#define IS31FL3741_REG_PWM_FREQUENCY 0x36 // PG4
5253
#define IS31FL3741_REG_RESET 0x3F // PG4
5354

5455
#ifndef IS31FL3741_I2C_TIMEOUT
@@ -63,6 +64,10 @@
6364
# define IS31FL3741_CONFIGURATION 0x01
6465
#endif
6566

67+
#ifndef IS31FL3741_PWM_FREQUENCY
68+
# define IS31FL3741_PWM_FREQUENCY IS31FL3741_PWM_FREQUENCY_29K_HZ
69+
#endif
70+
6671
#ifndef IS31FL3741_SWPULLUP
6772
# define IS31FL3741_SWPULLUP IS31FL3741_PUR_32KR
6873
#endif
@@ -170,6 +175,8 @@ void is31fl3741_init(uint8_t addr) {
170175
is31fl3741_write_register(addr, IS31FL3741_REG_GLOBALCURRENT, IS31FL3741_GLOBALCURRENT);
171176
// Set Pull up & Down for SWx CSy
172177
is31fl3741_write_register(addr, IS31FL3741_REG_PULLDOWNUP, ((IS31FL3741_CSPULLUP << 4) | IS31FL3741_SWPULLUP));
178+
// Set PWM frequency
179+
is31fl3741_write_register(addr, IS31FL3741_REG_PWM_FREQUENCY, (IS31FL3741_PWM_FREQUENCY & 0b1111));
173180

174181
// is31fl3741_update_led_scaling_registers(addr, 0xFF, 0xFF, 0xFF);
175182

drivers/led/issi/is31fl3741.h

+5
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ void is31fl3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green,
9393
#define IS31FL3741_PUR_16KR 0x06 // 16k Ohm resistor
9494
#define IS31FL3741_PUR_32KR 0x07 // 32k Ohm resistor
9595

96+
#define IS31FL3741_PWM_FREQUENCY_29K_HZ 0b0000
97+
#define IS31FL3741_PWM_FREQUENCY_3K6_HZ 0b0011
98+
#define IS31FL3741_PWM_FREQUENCY_1K8_HZ 0b0111
99+
#define IS31FL3741_PWM_FREQUENCY_900_HZ 0b1011
100+
96101
#define CS1_SW1 0x00
97102
#define CS2_SW1 0x01
98103
#define CS3_SW1 0x02

keyboards/4pplet/perk60_iso/rev_a/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2424
#define DRIVER_ADDR_1 0b1010000
2525
#define IS31FL3733_DRIVER_COUNT 1
2626
#define RGB_MATRIX_LED_COUNT 62
27-
#define IS31FL3733_PWM_FREQUENCY 0b010
27+
#define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_26K7_HZ
2828

2929
#define RGB_MATRIX_DEFAULT_VAL 80
3030
#define RGB_MATRIX_KEYPRESSES

keyboards/drop/alt/v2/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define DRIVER_ADDR_2 0b1011111
1919
#define IS31FL3733_DRIVER_COUNT 2
2020
#define RGB_MATRIX_LED_COUNT 111
21-
#define IS31FL3733_PWM_FREQUENCY 0b010 // 26k
21+
#define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_26K7_HZ
2222

2323
#define RGB_DISABLE_WHEN_USB_SUSPENDED
2424
#define RGB_MATRIX_DEFAULT_VAL 100

keyboards/drop/ctrl/v2/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define DRIVER_ADDR_2 0b1011111
1919
#define IS31FL3733_DRIVER_COUNT 2
2020
#define RGB_MATRIX_LED_COUNT 119
21-
#define IS31FL3733_PWM_FREQUENCY 0b010 // 26k
21+
#define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_26K7_HZ
2222

2323
#define RGB_DISABLE_WHEN_USB_SUSPENDED
2424
#define RGB_MATRIX_DEFAULT_VAL 100

keyboards/drop/sense75/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#define DRIVER_ADDR_2 0b1011111
1414
#define IS31FL3733_DRIVER_COUNT 2
1515
#define RGB_MATRIX_LED_COUNT 111
16-
#define IS31FL3733_PWM_FREQUENCY 0b010 // 26k
16+
#define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_26K7_HZ
1717

1818
#define RGB_DISABLE_WHEN_USB_SUSPENDED
1919
#define RGB_MATRIX_KEYPRESSES

keyboards/drop/shift/v2/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define DRIVER_ADDR_3 0b1010000
2020
#define IS31FL3733_DRIVER_COUNT 3
2121
#define RGB_MATRIX_LED_COUNT 166
22-
#define IS31FL3733_PWM_FREQUENCY 0b010 // 26k
22+
#define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_26K7_HZ
2323

2424
#define RGB_DISABLE_WHEN_USB_SUSPENDED
2525
#define RGB_MATRIX_DEFAULT_VAL 100

keyboards/frooastboard/walnut/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#pragma once
55

6-
#define IS31FL3737_PWM_FREQUENCY 0b010
6+
#define IS31FL3737_PWM_FREQUENCY IS31FL3737_PWM_FREQUENCY_26K7_HZ
77
#define IS31FL3737_DRIVER_COUNT 1
88
#define RGB_MATRIX_LED_COUNT 48
99
#define DRIVER_ADDR_1 0b1010000

keyboards/input_club/k_type/is31fl3733-dual.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
#endif
5858

5959
#ifndef IS31FL3733_PWM_FREQUENCY
60-
# define IS31FL3733_PWM_FREQUENCY 0b000 // PFS - IS31FL3733B only
60+
# define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_8K4_HZ // PFS - IS31FL3733B only
6161
#endif
6262

6363
#ifndef IS31FL3733_SWPULLUP

keyboards/input_club/k_type/is31fl3733-dual.h

+6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ void is31fl3733_update_led_control_registers(uint8_t addr, uint8_t index);
5555
#define IS31FL3733_PUR_16KR 0x06 // 16k Ohm resistor on all the time
5656
#define IS31FL3733_PUR_32KR 0x07 // 32k Ohm resistor in t_NOL
5757

58+
#define IS31FL3733_PWM_FREQUENCY_8K4_HZ 0x00
59+
#define IS31FL3733_PWM_FREQUENCY_4K2_HZ 0x01
60+
#define IS31FL3733_PWM_FREQUENCY_26K7_HZ 0x02
61+
#define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0x03
62+
#define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0x04
63+
5864
#define A_1 0x00
5965
#define A_2 0x01
6066
#define A_3 0x02

0 commit comments

Comments
 (0)