Microchip® Advanced Software Framework

systick_counter.h File Reference

ARM functions for busy-wait delay loops.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <clock.h>

Convenience functions for busy-wait delay loops

#define cpu_delay_us(delay)   delay_cycles_us(delay)
 Delay program execution for at least the specified number of microseconds. More...
 
#define cpu_delay_ms(delay)   delay_cycles_ms(delay)
 Delay program execution for at least the specified number of milliseconds. More...
 
#define cpu_delay_s(delay)   delay_cycles_ms(1000 * delay)
 Delay program execution for at least the specified number of seconds. More...
 
static void delay_cycles (const uint32_t n)
 Delay loop to delay n number of cycles Delay program execution for at least the specified number of CPU cycles. More...
 
void delay_cycles_us (uint32_t n)
 Delay loop to delay at least n number of microseconds. More...
 
void delay_cycles_ms (uint32_t n)
 Delay loop to delay at least n number of milliseconds. More...
 

#define cpu_delay_ms (   delay)    delay_cycles_ms(delay)

Delay program execution for at least the specified number of milliseconds.

Parameters
delaynumber of milliseconds to wait
#define cpu_delay_s (   delay)    delay_cycles_ms(1000 * delay)

Delay program execution for at least the specified number of seconds.

Parameters
delaynumber of seconds to wait
#define cpu_delay_us (   delay)    delay_cycles_us(delay)

Delay program execution for at least the specified number of microseconds.

Parameters
delaynumber of microseconds to wait

static void delay_cycles ( const uint32_t  n)
inlinestatic

Delay loop to delay n number of cycles Delay program execution for at least the specified number of CPU cycles.

Parameters
nNumber of cycles to delay

Referenced by delay_cycles_ms(), delay_cycles_us(), and main().

void delay_cycles_ms ( uint32_t  n)

Delay loop to delay at least n number of milliseconds.

Parameters
nNumber of milliseconds to wait

References cycles_per_ms, and delay_cycles().

void delay_cycles_us ( uint32_t  n)

Delay loop to delay at least n number of microseconds.

Parameters
nNumber of microseconds to wait

References cycles_per_us, and delay_cycles().