Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Busy-Wait Delay Routines

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

Common for API ver. 2.

Modules

 

Macros

#define delay_ms(delay)   ((delay) ? cpu_delay_ms(delay) : cpu_delay_us(1))
 Delay in at least specified number of milliseconds. More...
 
#define delay_s(delay)   ((delay) ? cpu_delay_s(delay) : cpu_delay_us(1))
 Delay in at least specified number of seconds. More...
 
#define delay_us(delay)   ((delay) ? cpu_delay_us(delay) : cpu_delay_us(1))
 Delay in at least specified number of microseconds. More...
 

Functions

void delay_init (void)
 Initialize the delay driver. More...
 

#define delay_s (   delay)    ((delay) ? cpu_delay_s(delay) : cpu_delay_us(1))

Delay in at least specified number of seconds.

Parameters
delayDelay in seconds

Referenced by main(), run_rtc_calendar_interrupt_test(), and run_rtc_calendar_test().

#define delay_us (   delay)    ((delay) ? cpu_delay_us(delay) : cpu_delay_us(1))

Delay in at least specified number of microseconds.

Parameters
delayDelay in microseconds

Referenced by app_alert(), demo_start(), get_batmon_voltage(), PHY_RandomReq(), PhyReset(), rf233_channel_clear(), rf_generate_random_seed(), sal_aes_wrrd(), TCC0_Handler(), trx_aes_wrrd(), and trx_sram_read().

void delay_init ( void  )

Initialize the delay driver.

This must be called during start up to initialize the delay routine with the current used main clock. It must run any time the main CPU clock is changed.

Not used in cycle mode.

References cycles_per_ms, cycles_per_us, and system_gclk_gen_get_hz().

Referenced by configure_tcc_ramp2c_mode(), ksz8851snl_init(), main(), nm_bsp_init(), and ssd1306_init().