+#define PWM_STEP_SHIFT 2 /* sub-LSB precision */
+#define PWM_TOP (((PWM_MAX) + (4 << (PWM_STEP_SHIFT))) >> (PWM_STEP_SHIFT))
+#if PWM_TOP > 0x3FF
+#error PWM_TOP too high
+#endif
+
+static uint16_t pwm[N_PWMLEDS];
+static volatile unsigned char step;
+static unsigned char channels_running, pll_enabled;
+
+static void enable_pll()