summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2023-09-14 17:02:40 +1000
committerGitHub <noreply@github.com>2023-09-14 08:02:40 +0100
commit76daf29ef0820438902eb64027c403cc3e37b892 (patch)
tree3b67a3c9ba6632c84958f30f49678fc87eeaa070 /drivers
parentf9ed1e3ebc66b568a20848ae0f07052fbef5e4a8 (diff)
Add and use PWM frequency defines for ISSI LED drivers (#22009)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/led/issi/is31fl3733-simple.c2
-rw-r--r--drivers/led/issi/is31fl3733-simple.h6
-rw-r--r--drivers/led/issi/is31fl3733.c2
-rw-r--r--drivers/led/issi/is31fl3733.h6
-rw-r--r--drivers/led/issi/is31fl3736.c8
-rw-r--r--drivers/led/issi/is31fl3736.h6
-rw-r--r--drivers/led/issi/is31fl3737.c2
-rw-r--r--drivers/led/issi/is31fl3737.h6
-rw-r--r--drivers/led/issi/is31fl3741.c7
-rw-r--r--drivers/led/issi/is31fl3741.h5
10 files changed, 45 insertions, 5 deletions
diff --git a/drivers/led/issi/is31fl3733-simple.c b/drivers/led/issi/is31fl3733-simple.c
index fde492509f..c52e1ff9f1 100644
--- a/drivers/led/issi/is31fl3733-simple.c
+++ b/drivers/led/issi/is31fl3733-simple.c
@@ -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
diff --git a/drivers/led/issi/is31fl3733-simple.h b/drivers/led/issi/is31fl3733-simple.h
index a557cabd7e..7e06e2af02 100644
--- a/drivers/led/issi/is31fl3733-simple.h
+++ b/drivers/led/issi/is31fl3733-simple.h
@@ -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
diff --git a/drivers/led/issi/is31fl3733.c b/drivers/led/issi/is31fl3733.c
index ecb721196d..3ee9b14c81 100644
--- a/drivers/led/issi/is31fl3733.c
+++ b/drivers/led/issi/is31fl3733.c
@@ -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
diff --git a/drivers/led/issi/is31fl3733.h b/drivers/led/issi/is31fl3733.h
index 633ed71ee6..3c17723f92 100644
--- a/drivers/led/issi/is31fl3733.h
+++ b/drivers/led/issi/is31fl3733.h
@@ -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
diff --git a/drivers/led/issi/is31fl3736.c b/drivers/led/issi/is31fl3736.c
index a070836b38..c8c035854f 100644
--- a/drivers/led/issi/is31fl3736.c
+++ b/drivers/led/issi/is31fl3736.c
@@ -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);
diff --git a/drivers/led/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h
index 90e59da8b0..5cc1262633 100644
--- a/drivers/led/issi/is31fl3736.h
+++ b/drivers/led/issi/is31fl3736.h
@@ -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
diff --git a/drivers/led/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c
index 94bd755dea..550d26da8d 100644
--- a/drivers/led/issi/is31fl3737.c
+++ b/drivers/led/issi/is31fl3737.c
@@ -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
diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h
index a6a9a3a059..e382602e9a 100644
--- a/drivers/led/issi/is31fl3737.h
+++ b/drivers/led/issi/is31fl3737.h
@@ -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
diff --git a/drivers/led/issi/is31fl3741.c b/drivers/led/issi/is31fl3741.c
index 2459677df0..2db1f021b1 100644
--- a/drivers/led/issi/is31fl3741.c
+++ b/drivers/led/issi/is31fl3741.c
@@ -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);
diff --git a/drivers/led/issi/is31fl3741.h b/drivers/led/issi/is31fl3741.h
index ffa4be9250..b7317bdab6 100644
--- a/drivers/led/issi/is31fl3741.h
+++ b/drivers/led/issi/is31fl3741.h
@@ -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