summaryrefslogtreecommitdiff
path: root/drivers/led
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/led')
-rw-r--r--drivers/led/apa102.c4
-rw-r--r--drivers/led/issi/is31fl3733.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/drivers/led/apa102.c b/drivers/led/apa102.c
index 7396dc3c55..00e7eb4505 100644
--- a/drivers/led/apa102.c
+++ b/drivers/led/apa102.c
@@ -24,8 +24,8 @@
# elif defined(PROTOCOL_CHIBIOS)
# include "hal.h"
-# if defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX)
-# define APA102_NOPS (100 / (1000000000L / (STM32_SYSCLK / 4))) // This calculates how many loops of 4 nops to run to delay 100 ns
+# if defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) || defined(GD32VF103)
+# define APA102_NOPS (100 / (1000000000L / (CPU_CLOCK / 4))) // This calculates how many loops of 4 nops to run to delay 100 ns
# else
# error("APA102_NOPS configuration required")
# define APA102_NOPS 0 // this just pleases the compile so the above error is easier to spot
diff --git a/drivers/led/issi/is31fl3733.c b/drivers/led/issi/is31fl3733.c
index d99e5339c9..4ddd827caf 100644
--- a/drivers/led/issi/is31fl3733.c
+++ b/drivers/led/issi/is31fl3733.c
@@ -56,6 +56,10 @@
# define ISSI_PERSISTENCE 0
#endif
+#ifndef ISSI_PWM_FREQUENCY
+# define ISSI_PWM_FREQUENCY 0b000 // PFS - IS31FL3733B only
+#endif
+
// Transfer buffer for TWITransmitData()
uint8_t g_twi_transfer_buffer[20];
@@ -157,7 +161,7 @@ void IS31FL3733_init(uint8_t addr, uint8_t sync) {
// Set global current to maximum.
IS31FL3733_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
// Disable software shutdown.
- IS31FL3733_write_register(addr, ISSI_REG_CONFIGURATION, (sync << 6) | 0x01);
+ IS31FL3733_write_register(addr, ISSI_REG_CONFIGURATION, ((sync & 0b11) << 6) | ((ISSI_PWM_FREQUENCY & 0b111) << 3) | 0x01);
// Wait 10ms to ensure the device has woken up.
wait_ms(10);