# MIOS32_DELAY

## Defines
#define | RIT_PERIPHERAL_FRQ (MIOS32_SYS_CPU_FREQUENCY/4)
#define | MIOS32_DELAY_TIMER TIM1
#define | MIOS32_DELAY_TIMER_RCC RCC_APB2Periph_TIM1
#define | TIM_PERIPHERAL_FRQ MIOS32_SYS_CPU_FREQUENCY
## Functions
s32 | MIOS32_DELAY_Init (u32 mode)
s32 | MIOS32_DELAY_Wait_uS (u16 uS)

## Detailed Description

Delay functions for MIOS32

## Define Documentation

#define MIOS32_DELAY_TIMER TIM1

#define MIOS32_DELAY_TIMER_RCC RCC_APB2Periph_TIM1

#define RIT_PERIPHERAL_FRQ (MIOS32_SYS_CPU_FREQUENCY/4)

#define TIM_PERIPHERAL_FRQ MIOS32_SYS_CPU_FREQUENCY

## Function Documentation

s32 MIOS32_DELAY_Init | ( | u32 | mode | ) |

Initializes the Timer used by MIOS32_DELAY functions
This function has to be executed before wait functions are used (already done in main.c of the programming model)

Currently the freerunning timer (RIT) is allocated by MIOS32_DELAY functions

Parameters:

  `[in]` | mode | currently only mode 0 supported

Returns:
  < 0 if initialisation failed

Initializes the Timer used by MIOS32_DELAY functions
This function has to be executed before wait functions are used (already done in main.c of the programming model)

Currently TIM1 is allocated by MIOS32_DELAY functions - if this clashes with your application, just switch to another timer by overriding MIOS32_DELAY_TIMER and MIOS32_DELAY_TIMER_RCC in your mios32_config.h file

Parameters:

  `[in]` | mode | currently only mode 0 supported

Returns:
  < 0 if initialisation failed

s32 MIOS32_DELAY_Wait_uS | ( | u16 | uS | ) |

Waits for a specific number of uS
Example:

       // wait for 500 uS
       MIOS32_DELAY_Wait_uS(500);

Parameters:

  `[in]` | uS | delay (1..65535 microseconds)

Returns:
  < 0 on errors