Skip to content

These module docs are in beta and may be incomplete.

modm:architecture:delay: Blocking Delays

These functions allow you to spin for a short time using only the CPU.

You should always prefer Software Timers (see modm:processing:timer) over these blocking delay functions. However, when modm::Clock is not set up yet, or when you need very small delays (for example to bit-bang a protocol), you need to use these delay functions.

The only guarantee given to you is to delay for at least the specified time. Note that invocation of interrupts during spinning may add delay too.

Warning

You must not rely on delay functions for ANY time-keeping!

Delay functions work at any CPU clock speed, even if changed dynamically and are available very early in the startup process at hardware-init time.

Warning

Correct behavior is not guaranteed for delays over 1000ns, us or ms! Make sure to use the largest time unit possible.

Content

// Function
void modm::delayMicroseconds(uint16_t us);
void modm::delayMilliseconds(uint16_t ms);
void modm::delayNanoseconds(uint16_t ns);

Dependencies

modm:architecture:delay modm_architecture_delay modm: architecture: delay modm_architecture modm: architecture modm_architecture_delay->modm_architecture modm_architecture_i2c modm: architecture: i2c modm_architecture_i2c->modm_architecture_delay modm_driver_ad7280a modm: driver: ad7280a modm_driver_ad7280a->modm_architecture_delay modm_driver_ad7928 modm: driver: ad7928 modm_driver_ad7928->modm_architecture_delay modm_driver_adns9800 modm: driver: adns9800 modm_driver_adns9800->modm_architecture_delay modm_driver_ads7843 modm: driver: ads7843 modm_driver_ads7843->modm_architecture_delay modm_driver_ds1302 modm: driver: ds1302 modm_driver_ds1302->modm_architecture_delay modm_driver_ea_dog modm: driver: ea_dog modm_driver_ea_dog->modm_architecture_delay modm_driver_hd44780 modm: driver: hd44780 modm_driver_hd44780->modm_architecture_delay modm_driver_max6966 modm: driver: max6966 modm_driver_max6966->modm_architecture_delay modm_driver_mcp2515 modm: driver: mcp2515 modm_driver_mcp2515->modm_architecture_delay modm_driver_memory_bus modm: driver: memory_bus modm_driver_memory_bus->modm_architecture_delay modm_driver_nrf24 modm: driver: nrf24 modm_driver_nrf24->modm_architecture_delay modm_driver_parallel_tft_display modm: driver: parallel_tft_display modm_driver_parallel_tft_display->modm_architecture_delay modm_driver_pat9125el modm: driver: pat9125el modm_driver_pat9125el->modm_architecture_delay modm_driver_siemens_s65 modm: driver: siemens_s65 modm_driver_siemens_s65->modm_architecture_delay modm_driver_siemens_s75 modm: driver: siemens_s75 modm_driver_siemens_s75->modm_architecture_delay modm_platform_1_wire_bitbang modm: platform: 1-wire.bitbang modm_platform_1_wire_bitbang->modm_architecture_delay modm_platform_can modm: platform: can modm_platform_can->modm_architecture_delay modm_platform_clock_cortex modm: platform: clock.cortex modm_platform_clock_cortex->modm_architecture_delay modm_platform_core modm: platform: core modm_platform_core->modm_architecture_delay modm_platform_i2c_bitbang modm: platform: i2c.bitbang modm_platform_i2c_bitbang->modm_architecture_delay modm_platform_spi_bitbang modm: platform: spi.bitbang modm_platform_spi_bitbang->modm_architecture_delay