From 5b2f8104c7106a2126949dcb0502dff5491023b2 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 28 Apr 2025 19:53:00 -0400 Subject: [PATCH] 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 --- src/neopixel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neopixel.c b/src/neopixel.c index 4e171658..fe3f724f 100644 --- a/src/neopixel.c +++ b/src/neopixel.c @@ -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