fx2delay.h
The fx2delay.h header contains delay routines for the Cypress FX2 series. When using this header, the fx2 library must be linked in.
Reference
Defines
-
SYNCDELAYLEN
Synchronization delay length.
This value defaults to 3, and should be overridden using a compiler flag
-DSYNCDELAYLEN=nif running with non-default IFCLK or CLKOUT clock frequency. Delay length can be calculated using the following Python code:See TRM 15.15 for details.import math math.ceil(1.5 * ((ifclk_period / clkout_period) + 1))
Functions
-
void delay_ms(uint16_t count_ms)
Spin for the given number of milliseconds.
-
void delay_us_overhead(uint16_t count_us, uint8_t overh_c)
Spin for the given number of microseconds, minus
overh_cprocessor cycles.count_usmust be no greater than 21845, andoverh_cmust be no greater than 128.This function is cycle-accurate at any CPU clock frequency provided that the delay is not less than the intrinsic overhead of up to 100 processor cycles (9..33 microseconds).
-
void delay_us(uint16_t count_us)
Equivalent to
delay_us_overhead(count_us, 3)where 3 is the number of cycles of overhead whendelay_usis called with a constant argument.
-
void delay_4c(uint16_t count_4c)
Spin for
count * 4processor cycles, orcount * 16clock cycles. Takes exactly 24 processor cycles (2..8 microseconds) ifcountis less than6.