FastLED 3.9.15
Loading...
Searching...
No Matches

◆ micros()

fl::u32 fl::micros ( )

Universal microsecond timer - returns microseconds since system startup.

This function provides consistent high-resolution timing across all FastLED platforms:

  • Arduino/AVR: Hardware timer-based micros()
  • ESP32/ESP8266: ESP-IDF timing functions
  • ARM: Platform-specific ARM timers
  • WASM: JavaScript-based timing with microsecond precision
  • Native/Testing: std::chrono implementation
  • Stub: Fake timer for testing
Returns
Number of microseconds since the system started
Note
Wraps around approximately every 71.6 minutes (2^32 microseconds)
This function is designed to be zero-overhead - it compiles to a direct platform call in optimized builds

Behavior

  • Consistent: All platforms return microseconds since startup/initialization
  • Monotonic: Time always increases (except on wraparound)
  • Resolution: 1 microsecond resolution on all platforms (platform-dependent precision)
  • Wraparound: Consistent wraparound behavior at 2^32 microseconds

Examples

// Precise timing measurement
fl::u32 start = fl::micros();
fast_operation();
fl::u32 elapsed = fl::micros() - start;
// High-precision delay
fl::u32 target = fl::micros() + 100; // 100 microseconds
while (fl::micros() < target) {
// Busy wait
}
fl::u32 micros()
Universal microsecond timer - returns microseconds since system startup.

Definition at line 80 of file chrono.cpp.hpp.

80 {
81 // Note: micros() does not support time injection
82 return fl::platforms::micros();
83}

References micros().

Referenced by autoresearch::simd_check::benchFloat4(), autoresearch::simd_check::benchS16x16_4(), autoresearch::simd_check::benchS8x8_4(), autoresearch::simd_check::benchSimd4(), autoresearch::simd_check::benchU16x16_4(), fl::Yves::draw(), fl::Yves_FP::draw(), get_ready(), logFrame(), logOutput(), CMinWait< WAIT >::mark(), micros(), fl::chrono::steady_clock::now(), fl::chrono::system_clock::now(), fl::task::run(), CFastLED::show(), CFastLED::showColor(), CMinWait< WAIT >::wait(), fl::ChannelManager::waitForCondition(), and fl::IChannelDriver::waitForCondition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: