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

This commit is contained in:
Ryan 2023-09-14 17:02:40 +10:00 committed by GitHub
parent f9ed1e3ebc
commit 76daf29ef0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 58 additions and 12 deletions

View File

@ -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

View File

@ -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 0b000
#define IS31FL3733_PWM_FREQUENCY_4K2_HZ 0b001
#define IS31FL3733_PWM_FREQUENCY_26K7_HZ 0b010
#define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011
#define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100
#define A_1 0x00
#define A_2 0x01
#define A_3 0x02

View File

@ -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

View File

@ -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 0b000
#define IS31FL3733_PWM_FREQUENCY_4K2_HZ 0b001
#define IS31FL3733_PWM_FREQUENCY_26K7_HZ 0b010
#define IS31FL3733_PWM_FREQUENCY_2K1_HZ 0b011
#define IS31FL3733_PWM_FREQUENCY_1K05_HZ 0b100
#define A_1 0x00
#define A_2 0x01
#define A_3 0x02

View File

@ -48,7 +48,7 @@
#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
@ -56,6 +56,10 @@
# 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
@ -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);

View File

@ -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 0b000
#define IS31FL3736_PWM_FREQUENCY_4K2_HZ 0b001
#define IS31FL3736_PWM_FREQUENCY_26K7_HZ 0b010
#define IS31FL3736_PWM_FREQUENCY_2K1_HZ 0b011
#define IS31FL3736_PWM_FREQUENCY_1K05_HZ 0b100
#define A_1 0x00
#define A_2 0x02
#define A_3 0x04

View File

@ -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

View File

@ -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 0b000
#define IS31FL3737_PWM_FREQUENCY_4K2_HZ 0b001
#define IS31FL3737_PWM_FREQUENCY_26K7_HZ 0b010
#define IS31FL3737_PWM_FREQUENCY_2K1_HZ 0b011
#define IS31FL3737_PWM_FREQUENCY_1K05_HZ 0b100
#define A_1 0x00
#define A_2 0x01
#define A_3 0x02

View File

@ -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
@ -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
@ -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);

View File

@ -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 0b0000
#define IS31FL3741_PWM_FREQUENCY_3K6_HZ 0b0011
#define IS31FL3741_PWM_FREQUENCY_1K8_HZ 0b0111
#define IS31FL3741_PWM_FREQUENCY_900_HZ 0b1011
#define CS1_SW1 0x00
#define CS2_SW1 0x01
#define CS3_SW1 0x02

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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