aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2025-04-28 19:53:00 -0400
committerKevin O'Connor <kevin@koconnor.net>2025-04-28 19:55:30 -0400
commit5b2f8104c7106a2126949dcb0502dff5491023b2 (patch)
treebc0e2d1eab2497f64251518b90e8b6a166fa9b96
parentcf3bedfbdc744325e0039e35f37a8e12c0c63bc0 (diff)
downloadkutter-5b2f8104c7106a2126949dcb0502dff5491023b2.tar.gz
kutter-5b2f8104c7106a2126949dcb0502dff5491023b2.tar.xz
kutter-5b2f8104c7106a2126949dcb0502dff5491023b2.zip
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>
-rw-r--r--src/neopixel.c2
1 files changed, 1 insertions, 1 deletions
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