From 0efd817f42ba131debdbc193e16b609391d48c75 Mon Sep 17 00:00:00 2001 From: Serge Baranov Date: Sat, 16 May 2026 16:14:52 -0700 Subject: [PATCH] fix(ws2812-pwm): allow WS2812_PWM_TICK_FREQUENCY override (#26186) Wrap the define in #ifndef so a keyboard's config.h can set it. The default (CPU_CLOCK / 2) works for a fixed SYSCLK, but boards that change SYSCLK at runtime (meletrix/zoom_tkl drops to 16 MHz on battery) need a tick frequency that divides into both the high and low TMRCLKs. Every other knob in the file is already #ifndef-guarded; this one was the only flat #define. --- platforms/chibios/drivers/ws2812_pwm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platforms/chibios/drivers/ws2812_pwm.c b/platforms/chibios/drivers/ws2812_pwm.c index 0fc20b3f27..144f6e1388 100644 --- a/platforms/chibios/drivers/ws2812_pwm.c +++ b/platforms/chibios/drivers/ws2812_pwm.c @@ -89,7 +89,9 @@ /* --- PRIVATE CONSTANTS ---------------------------------------------------- */ -#define WS2812_PWM_TICK_FREQUENCY (CPU_CLOCK / 2) /**< Clock frequency of PWM ticks, must be valid with respect to system clock! */ +#ifndef WS2812_PWM_TICK_FREQUENCY +# define WS2812_PWM_TICK_FREQUENCY (CPU_CLOCK / 2) /**< Clock frequency of PWM ticks, must be valid with respect to system clock! */ +#endif #define WS2812_PWM_PERIOD (WS2812_PWM_TICK_FREQUENCY / WS2812_PWM_FREQUENCY) /**< Clock period in PWM ticks. */ /**