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.
Macros | |
#define | delay_init(fcpu_hz) |
Initialize the delay driver. More... | |
#define | delay_ms(delay) ((delay) ? cpu_delay_ms(delay, F_CPU) : cpu_delay_us(1, F_CPU)) |
Delay in milliseconds. More... | |
#define | delay_s(delay) ((delay) ? cpu_delay_ms(1000 * delay, F_CPU) : cpu_delay_us(1, F_CPU)) |
Delay in seconds. More... | |
#define | delay_us(delay) ((delay) ? cpu_delay_us(delay, F_CPU) : cpu_delay_us(1, F_CPU)) |
Delay in microseconds. More... | |
#define | F_CPU <value> |
MCU Clock Frequency (Hertz) More... | |
#define delay_init | ( | fcpu_hz | ) |
Initialize the delay driver.
fcpu_hz | CPU frequency in Hz |
The functions in this module call sysclk_get_cpu_hz() function to obtain the system clock frequency.
#define delay_ms | ( | delay | ) | ((delay) ? cpu_delay_ms(delay, F_CPU) : cpu_delay_us(1, F_CPU)) |
Delay in milliseconds.
delay | Delay in milliseconds |
#define delay_s | ( | delay | ) | ((delay) ? cpu_delay_ms(1000 * delay, F_CPU) : cpu_delay_us(1, F_CPU)) |
Delay in seconds.
delay | Delay in seconds |
#define delay_us | ( | delay | ) | ((delay) ? cpu_delay_us(delay, F_CPU) : cpu_delay_us(1, F_CPU)) |
Delay in microseconds.
delay | Delay in microseconds |
Referenced by st7565r_hard_reset(), and vbat_init().
#define F_CPU <value> |
MCU Clock Frequency (Hertz)
The system frequency.
This is the expected frequency (Hz) of the CPU. This value has to be defined at the compiler level and it is only used to compute the TC count reference, i.e., not to set the system clock. Therefore, this value should be consistent with the system clock settings in the main application. However, this constant could be used to test the self-diagnostic routine, i.e., a wrong value could be set to check whether the failure is detected.