neopixel: Round up in nsecs_to_ticks()

The rp2040 operates at a fast internal clock with a relatively slow
external timer and dividing down could result in a too small delay.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2025-04-28 19:53:00 -04:00
parent cf3bedfbdc
commit 5b2f8104c7

View file

@ -34,7 +34,7 @@ typedef unsigned int neopixel_time_t;
static __always_inline neopixel_time_t
nsecs_to_ticks(uint32_t ns)
{
return timer_from_us(ns * 1000) / 1000000;
return DIV_ROUND_UP(timer_from_us(ns * 1000), 1000000);
}
static inline int