MCPcopy Create free account
hub / github.com/FastLED/FastLED / NS_TO_CYCLES

Function NS_TO_CYCLES

src/platforms/esp/32/clockless_block_esp32.h:59–61  ·  view source on GitHub ↗

Convert nanoseconds to CPU cycles (compile-time) Formula: cycles = (ns * (F_CPU / 1MHz) + 500) / 1000 +500 for rounding to nearest cycle

Source from the content-addressed store, hash-verified

57 // Formula: cycles = (ns * (F_CPU / 1MHz) + 500) / 1000
58 // +500 for rounding to nearest cycle
59 static constexpr u32 NS_TO_CYCLES(u32 ns) {
60 return (ns * (F_CPU / 1000000UL) + 500) / 1000;
61 }
62
63 enum : u32 {
64 T1 = NS_TO_CYCLES(TIMING::T1), // Convert nanoseconds → CPU cycles

Callers 2

u32Enum · 0.85
ClocklessControllerClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected