Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and use PWM frequency defines for ISSI LED drivers #22009

Merged
merged 5 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/led/issi/is31fl3733-simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#endif

#ifndef IS31FL3733_PWM_FREQUENCY
# define IS31FL3733_PWM_FREQUENCY 0b000 // PFS - IS31FL3733B only
# define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_8K4_HZ // PFS - IS31FL3733B only
#endif

#ifndef IS31FL3733_SWPULLUP
Expand Down
6 changes: 6 additions & 0 deletions drivers/led/issi/is31fl3733-simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ void is31fl3733_update_led_control_registers(uint8_t addr, uint8_t index);
#define IS31FL3733_PUR_16KR 0x06 // 16k Ohm resistor on all the time
#define IS31FL3733_PUR_32KR 0x07 // 32k Ohm resistor in t_NOL

#define IS31FL3733_PWM_FREQUENCY_8K4_HZ 0x00
#define IS31FL3733_PWM_FREQUENCY_4K2_HZ 0x01
#define IS31FL3733_PWM_FREQUENCY_26K7_HZ 0x02
#define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0x03
#define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0x04

#define A_1 0x00
#define A_2 0x01
#define A_3 0x02
Expand Down
2 changes: 1 addition & 1 deletion drivers/led/issi/is31fl3733.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#endif

#ifndef IS31FL3733_PWM_FREQUENCY
# define IS31FL3733_PWM_FREQUENCY 0b000 // PFS - IS31FL3733B only
# define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_8K4_HZ // PFS - IS31FL3733B only
#endif

#ifndef IS31FL3733_SWPULLUP
Expand Down
6 changes: 6 additions & 0 deletions drivers/led/issi/is31fl3733.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ void is31fl3733_update_led_control_registers(uint8_t addr, uint8_t index);
#define IS31FL3733_PUR_16KR 0x06 // 16k Ohm resistor on all the time
#define IS31FL3733_PUR_32KR 0x07 // 32k Ohm resistor in t_NOL

#define IS31FL3733_PWM_FREQUENCY_8K4_HZ 0x00
#define IS31FL3733_PWM_FREQUENCY_4K2_HZ 0x01
#define IS31FL3733_PWM_FREQUENCY_26K7_HZ 0x02
#define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0x03
#define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0x04

#define A_1 0x00
#define A_2 0x01
#define A_3 0x02
Expand Down
8 changes: 6 additions & 2 deletions drivers/led/issi/is31fl3736.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@
#define IS31FL3736_REG_SWPULLUP 0x0F // PG3
#define IS31FL3736_REG_CSPULLUP 0x10 // PG3

#ifndef IS31FL3736_TIMEOUT
#ifndef IS31FL3736_I2C_TIMEOUT
# define IS31FL3736_I2C_TIMEOUT 100
#endif

#ifndef IS31FL3736_I2C_PERSISTENCE
# define IS31FL3736_I2C_PERSISTENCE 0
#endif

#ifndef IS31FL3736_PWM_FREQUENCY
# define IS31FL3736_PWM_FREQUENCY IS31FL3736_PWM_FREQUENCY_8K4_HZ // PFS - IS31FL3736B only
#endif

#ifndef IS31FL3736_SWPULLUP
# define IS31FL3736_SWPULLUP IS31FL3736_PUR_0R
#endif
Expand Down Expand Up @@ -159,7 +163,7 @@ void is31fl3736_init(uint8_t addr) {
// Set global current to maximum.
is31fl3736_write_register(addr, IS31FL3736_REG_GLOBALCURRENT, IS31FL3736_GLOBALCURRENT);
// Disable software shutdown.
is31fl3736_write_register(addr, IS31FL3736_REG_CONFIGURATION, 0x01);
is31fl3736_write_register(addr, IS31FL3736_REG_CONFIGURATION, ((IS31FL3736_PWM_FREQUENCY & 0b111) << 3) | 0x01);

// Wait 10ms to ensure the device has woken up.
wait_ms(10);
Expand Down
6 changes: 6 additions & 0 deletions drivers/led/issi/is31fl3736.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ void is31fl3736_update_led_control_registers(uint8_t addr, uint8_t index);
#define IS31FL3736_PUR_16KR 0x06 // 16k Ohm resistor
#define IS31FL3736_PUR_32KR 0x07 // 32k Ohm resistor

#define IS31FL3736_PWM_FREQUENCY_8K4_HZ 0x00
#define IS31FL3736_PWM_FREQUENCY_4K2_HZ 0x01
#define IS31FL3736_PWM_FREQUENCY_26K7_HZ 0x02
#define IS31FL3736_PWM_FREQUENCY_2K1_HZ 0x03
#define IS31FL3736_PWM_FREQUENCY_1K05_HZ 0x04

#define A_1 0x00
#define A_2 0x02
#define A_3 0x04
Expand Down
2 changes: 1 addition & 1 deletion drivers/led/issi/is31fl3737.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#endif

#ifndef IS31FL3737_PWM_FREQUENCY
# define IS31FL3737_PWM_FREQUENCY 0b000 // PFS - IS31FL3737B only
# define IS31FL3737_PWM_FREQUENCY IS31FL3737_PWM_FREQUENCY_8K4_HZ // PFS - IS31FL3737B only
#endif

#ifndef IS31FL3737_SWPULLUP
Expand Down
6 changes: 6 additions & 0 deletions drivers/led/issi/is31fl3737.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ void is31fl3737_update_led_control_registers(uint8_t addr, uint8_t index);
#define IS31FL3737_PUR_16KR 0x06 // 16k Ohm resistor in t_NOL
#define IS31FL3737_PUR_32KR 0x07 // 32k Ohm resistor in t_NOL

#define IS31FL3737_PWM_FREQUENCY_8K4_HZ 0x00
#define IS31FL3737_PWM_FREQUENCY_4K2_HZ 0x01
#define IS31FL3737_PWM_FREQUENCY_26K7_HZ 0x02
#define IS31FL3737_PWM_FREQUENCY_2K1_HZ 0x03
#define IS31FL3737_PWM_FREQUENCY_1K05_HZ 0x04

#define A_1 0x00
#define A_2 0x01
#define A_3 0x02
Expand Down
7 changes: 7 additions & 0 deletions drivers/led/issi/is31fl3741.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#define IS31FL3741_REG_CONFIGURATION 0x00 // PG4
#define IS31FL3741_REG_GLOBALCURRENT 0x01 // PG4
#define IS31FL3741_REG_PULLDOWNUP 0x02 // PG4
#define IS31FL3741_REG_PWM_FREQUENCY 0x36 // PG4
#define IS31FL3741_REG_RESET 0x3F // PG4

#ifndef IS31FL3741_I2C_TIMEOUT
Expand All @@ -63,6 +64,10 @@
# define IS31FL3741_CONFIGURATION 0x01
#endif

#ifndef IS31FL3741_PWM_FREQUENCY
# define IS31FL3741_PWM_FREQUENCY IS31FL3741_PWM_FREQUENCY_29K_HZ
#endif

#ifndef IS31FL3741_SWPULLUP
# define IS31FL3741_SWPULLUP IS31FL3741_PUR_32KR
#endif
Expand Down Expand Up @@ -170,6 +175,8 @@ void is31fl3741_init(uint8_t addr) {
is31fl3741_write_register(addr, IS31FL3741_REG_GLOBALCURRENT, IS31FL3741_GLOBALCURRENT);
// Set Pull up & Down for SWx CSy
is31fl3741_write_register(addr, IS31FL3741_REG_PULLDOWNUP, ((IS31FL3741_CSPULLUP << 4) | IS31FL3741_SWPULLUP));
// Set PWM frequency
is31fl3741_write_register(addr, IS31FL3741_REG_PWM_FREQUENCY, (IS31FL3741_PWM_FREQUENCY & 0b1111));

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

Expand Down
5 changes: 5 additions & 0 deletions drivers/led/issi/is31fl3741.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ void is31fl3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green,
#define IS31FL3741_PUR_16KR 0x06 // 16k Ohm resistor
#define IS31FL3741_PUR_32KR 0x07 // 32k Ohm resistor

#define IS31FL3741_PWM_FREQUENCY_29K_HZ 0x00
#define IS31FL3741_PWM_FREQUENCY_3K6_HZ 0x03
#define IS31FL3741_PWM_FREQUENCY_1K8_HZ 0x07
#define IS31FL3741_PWM_FREQUENCY_900_HZ 0x0B

#define CS1_SW1 0x00
#define CS2_SW1 0x01
#define CS3_SW1 0x02
Expand Down
2 changes: 1 addition & 1 deletion keyboards/4pplet/perk60_iso/rev_a/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DRIVER_ADDR_1 0b1010000
#define IS31FL3733_DRIVER_COUNT 1
#define RGB_MATRIX_LED_COUNT 62
#define IS31FL3733_PWM_FREQUENCY 0b010
#define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_26K7_HZ

#define RGB_MATRIX_DEFAULT_VAL 80
#define RGB_MATRIX_KEYPRESSES
Expand Down
2 changes: 1 addition & 1 deletion keyboards/drop/alt/v2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define DRIVER_ADDR_2 0b1011111
#define IS31FL3733_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 111
#define IS31FL3733_PWM_FREQUENCY 0b010 // 26k
#define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_26K7_HZ

#define RGB_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_DEFAULT_VAL 100
Expand Down
2 changes: 1 addition & 1 deletion keyboards/drop/ctrl/v2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define DRIVER_ADDR_2 0b1011111
#define IS31FL3733_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 119
#define IS31FL3733_PWM_FREQUENCY 0b010 // 26k
#define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_26K7_HZ

#define RGB_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_DEFAULT_VAL 100
Expand Down
2 changes: 1 addition & 1 deletion keyboards/drop/sense75/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define DRIVER_ADDR_2 0b1011111
#define IS31FL3733_DRIVER_COUNT 2
#define RGB_MATRIX_LED_COUNT 111
#define IS31FL3733_PWM_FREQUENCY 0b010 // 26k
#define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_26K7_HZ

#define RGB_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_KEYPRESSES
Expand Down
2 changes: 1 addition & 1 deletion keyboards/drop/shift/v2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define DRIVER_ADDR_3 0b1010000
#define IS31FL3733_DRIVER_COUNT 3
#define RGB_MATRIX_LED_COUNT 166
#define IS31FL3733_PWM_FREQUENCY 0b010 // 26k
#define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_26K7_HZ

#define RGB_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_DEFAULT_VAL 100
Expand Down
2 changes: 1 addition & 1 deletion keyboards/frooastboard/walnut/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

#define IS31FL3737_PWM_FREQUENCY 0b010
#define IS31FL3737_PWM_FREQUENCY IS31FL3737_PWM_FREQUENCY_26K7_HZ
#define IS31FL3737_DRIVER_COUNT 1
#define RGB_MATRIX_LED_COUNT 48
#define DRIVER_ADDR_1 0b1010000
Expand Down
2 changes: 1 addition & 1 deletion keyboards/input_club/k_type/is31fl3733-dual.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#endif

#ifndef IS31FL3733_PWM_FREQUENCY
# define IS31FL3733_PWM_FREQUENCY 0b000 // PFS - IS31FL3733B only
# define IS31FL3733_PWM_FREQUENCY IS31FL3733_PWM_FREQUENCY_8K4_HZ // PFS - IS31FL3733B only
#endif

#ifndef IS31FL3733_SWPULLUP
Expand Down
6 changes: 6 additions & 0 deletions keyboards/input_club/k_type/is31fl3733-dual.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ void is31fl3733_update_led_control_registers(uint8_t addr, uint8_t index);
#define IS31FL3733_PUR_16KR 0x06 // 16k Ohm resistor on all the time
#define IS31FL3733_PUR_32KR 0x07 // 32k Ohm resistor in t_NOL

#define IS31FL3733_PWM_FREQUENCY_8K4_HZ 0x00
#define IS31FL3733_PWM_FREQUENCY_4K2_HZ 0x01
#define IS31FL3733_PWM_FREQUENCY_26K7_HZ 0x02
#define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0x03
#define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0x04

#define A_1 0x00
#define A_2 0x01
#define A_3 0x02
Expand Down