ARM functions for busy-wait delay loops.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <compiler.h>
Convenience functions for busy-wait delay loops | |
#define | cpu_ms_2_cy(ms, f_cpu) (((uint64_t)(ms) * (f_cpu) + (uint64_t)(14e3 - 1ul)) / (uint64_t)14e3) |
Convert milli-seconds into CPU cycles. More... | |
#define | cpu_us_2_cy(us, f_cpu) (((uint64_t)(us) * (f_cpu) + (uint64_t)(14e6 - 1ul)) / (uint64_t)14e6) |
Convert micro-seconds into CPU cycles. More... | |
#define | delay_cycles portable_delay_cycles |
Delay program execution for a specified number of CPU cycles. More... | |
#define | cpu_delay_ms(delay, f_cpu) delay_cycles(cpu_ms_2_cy(delay, f_cpu)) |
Delay program execution for a specified number of milliseconds. More... | |
#define | cpu_delay_us(delay, f_cpu) delay_cycles(cpu_us_2_cy(delay, f_cpu)) |
Delay program execution for a specified number of microseconds. More... | |
void | portable_delay_cycles (unsigned long n) |
Delay loop to delay n number of cycles. More... | |
#define cpu_delay_ms | ( | delay, | |
f_cpu | |||
) | delay_cycles(cpu_ms_2_cy(delay, f_cpu)) |
Delay program execution for a specified number of milliseconds.
delay | number of milliseconds to wait |
f_cpu | CPU frequency in Hertz |
#define cpu_delay_us | ( | delay, | |
f_cpu | |||
) | delay_cycles(cpu_us_2_cy(delay, f_cpu)) |
Delay program execution for a specified number of microseconds.
delay | number of microseconds to wait |
f_cpu | CPU frequency in Hertz |
#define cpu_ms_2_cy | ( | ms, | |
f_cpu | |||
) | (((uint64_t)(ms) * (f_cpu) + (uint64_t)(14e3 - 1ul)) / (uint64_t)14e3) |
Convert milli-seconds into CPU cycles.
ms | number of milliseconds |
f_cpu | CPU frequency in Hertz |
#define cpu_us_2_cy | ( | us, | |
f_cpu | |||
) | (((uint64_t)(us) * (f_cpu) + (uint64_t)(14e6 - 1ul)) / (uint64_t)14e6) |
Convert micro-seconds into CPU cycles.
ms | number of microseconds |
f_cpu | CPU frequency in Hertz |
#define delay_cycles portable_delay_cycles |
Delay program execution for a specified number of CPU cycles.
n | number of CPU cycles to wait |
void portable_delay_cycles | ( | unsigned long | n | ) |
Delay loop to delay n number of cycles.
n | Number of cycles |
References UNUSED.