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=n
if running with non-default IFCLK or CLKOUT clock frequency. Delay length can be calculated using the following Python code:import math math.ceil(1.5 * ((ifclk_period / clkout_period) + 1))
See TRM 15.15 for details.
-
SYNCDELAY¶
Synchronization delay for access to certain registers.
See TRM 15.15 for details.
This macro produces very compact code, using only 2 or 3 bytes per instance.
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_c
processor cycles.count_us
must be no greater than 21845, andoverh_c
must 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_us
is called with a constant argument.
-
void delay_4c(uint16_t count_4c)¶
Spin for
count * 4
processor cycles, orcount * 16
clock cycles. Takes exactly 24 processor cycles (2..8 microseconds) ifcount
is less than6
.