SAM4SD32 (SAM4S-EK2)
Loading...
Searching...
No Matches
Busy-Wait Delay Routines

This module provides simple loop-based delay routines for those applications requiring a brief wait during execution. More...

Macros

#define delay_init(fcpu_hz)
 Initialize the delay driver.
#define delay_ms(delay)
 Delay in milliseconds.
#define delay_s(delay)
 Delay in seconds.
#define delay_us(delay)
 Delay in microseconds.
#define F_CPU   sysclk_get_cpu_hz()
 MCU Clock Frequency (Hertz).

Detailed Description

This module provides simple loop-based delay routines for those applications requiring a brief wait during execution.

Common API for UC3, XMEGA, and AVR MEGA.

Macro Definition Documentation

◆ delay_init

#define delay_init ( fcpu_hz)

Initialize the delay driver.

Parameters
fcpu_hzCPU frequency in Hz
Deprecated
This function is provided for compatibility with ASF applications that may not have been updated to configure the system clock via the common clock service; e.g. sysclk_init() and a configuration header file are used to configure clocks.

The functions in this module call sysclk_get_cpu_hz() to obtain the system clock frequency.

Definition at line 98 of file delay.h.

◆ delay_ms

#define delay_ms ( delay)
Value:
((delay) ? cpu_delay_ms(delay, F_CPU) : cpu_delay_us(1, F_CPU))
#define cpu_delay_us(delay, f_cpu)
Delay program execution for a specified number of microseconds.
#define cpu_delay_ms(delay, f_cpu)
Delay program execution for a specified number of milliseconds.
#define F_CPU
MCU Clock Frequency (Hertz).
Definition delay.h:80

Delay in milliseconds.

Parameters
delayDelay in milliseconds

Definition at line 112 of file delay.h.

◆ delay_s

#define delay_s ( delay)
Value:
((delay) ? cpu_delay_ms(1000 * delay, F_CPU) : cpu_delay_us(1, F_CPU))

Delay in seconds.

Parameters
delayDelay in seconds

Definition at line 105 of file delay.h.

◆ delay_us

#define delay_us ( delay)
Value:
((delay) ? cpu_delay_us(delay, F_CPU) : cpu_delay_us(1, F_CPU))

Delay in microseconds.

Parameters
delayDelay in microseconds

Definition at line 119 of file delay.h.

◆ F_CPU

#define F_CPU   sysclk_get_cpu_hz()

MCU Clock Frequency (Hertz).

Deprecated
The F_CPU configuration constant is used for compatibility with the Busy-Wait Delay Routines routines. The common loop-based delay routines are designed to use the Legacy clock management group alias modules while anticipating support for legacy applications assuming a statically defined clock frequency. Applications using a statically configured MCU clock frequency can define F_CPU (Hertz), in which case the common delay routines will use this value rather than calling sysclk_get_cpu_hz() to get the current MCU clock frequency.

Definition at line 80 of file delay.h.