MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
Delay Utility Functions

Asynchronous delay routines based on the SysTick Timer. More...

Macros

#define MXC_DELAY_SEC(s)   (((unsigned long)s) * 1000000UL)
 Macro used to specify a microsecond timing parameter in seconds. More...
 
#define MXC_DELAY_MSEC(ms)   (ms * 1000UL)
 Macro used to specify a microsecond timing parameter in milliseconds. More...
 
#define MXC_DELAY_USEC(us)   (us)
 Macro used to specify a microsecond timing parameter. More...
 

Functions

int mxc_delay (unsigned long us)
 Blocks and delays for the specified number of microseconds. More...
 
int mxc_delay_start (unsigned long us)
 Starts a non-blocking delay for the specified number of microseconds. More...
 
int mxc_delay_check (void)
 Returns the status of a non-blocking delay request. More...
 
void mxc_delay_stop (void)
 Stops an asynchronous delay previously started. More...
 
void mxc_delay_handler (void)
 Processes the delay interrupt. More...
 

Detailed Description

Macro Definition Documentation

◆ MXC_DELAY_SEC

#define MXC_DELAY_SEC (   s)    (((unsigned long)s) * 1000000UL)
x = SEC(3) // 3 seconds -> x = 3,000,000

◆ MXC_DELAY_MSEC

#define MXC_DELAY_MSEC (   ms)    (ms * 1000UL)
x = MSEC(3) // 3ms -> x = 3,000

◆ MXC_DELAY_USEC

#define MXC_DELAY_USEC (   us)    (us)
x = USEC(3) // 3us -> x = 3

Function Documentation

◆ mxc_delay()

int mxc_delay ( unsigned long  us)

Uses the SysTick to create the requested delay. If the SysTick is running, the current settings will be used. If the SysTick is not running, it will be started.

Parameters
usmicroseconds to delay
Returns
E_NO_ERROR if no errors, error if unsuccessful.

◆ mxc_delay_start()

int mxc_delay_start ( unsigned long  us)

Uses the SysTick to time the requested delay. If the SysTick is running, the current settings will be used. If the SysTick is not running, it will be started.

Note
mxc_delay_handler() must be called from the SysTick interrupt service routine or at a rate greater than the SysTick overflow rate.
Parameters
usmicroseconds to delay
Returns
E_NO_ERROR if no errors, E_BUSY if currently servicing another delay request.

◆ mxc_delay_check()

int mxc_delay_check ( void  )
Precondition
Start the asynchronous delay by calling mxc_delay_start().
Returns
E_BUSY until the requested delay time has expired.

◆ mxc_delay_stop()

void mxc_delay_stop ( void  )
Precondition
Start the asynchronous delay by calling mxc_delay_start().

◆ mxc_delay_handler()

void mxc_delay_handler ( void  )

This function must be called from the SysTick IRQ or polled at a rate greater than the SysTick overflow rate.