Browse Source

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.
Serge Baranov 2 months ago
parent
commit
0efd817f42
1 changed files with 3 additions and 1 deletions
  1. 3 1
      platforms/chibios/drivers/ws2812_pwm.c

+ 3 - 1
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. */
 
 /**