#ifndef __DELAY_H_
#define __DELAY_H_

#include <stm32f10x.h>

#if 1
void Dly1us(unsigned int DelayVal);
void Dly10us(unsigned int DelayVal);
void Dly100us(unsigned int DelayVal);

extern unsigned int SystemClockFreq;
#define DLY_PARA_COMST	(SystemClockFreq/8500000)	//延时参数
#define DLY_CALL_COMST	(6)							//调用耗时，自定义

#define delayUs(x) { unsigned int _dcnt; \
      _dcnt=(x*DLY_PARA_COMST-DLY_CALL_COMST); \
      while(_dcnt-- > 0) \
      { continue; }\
     }

#define  delay_us(us)   delayUs(us)
#define  delay_ms(ms)   delay_us(ms*1000)
#else

void delay_init(u8 SYSCLK);
void delay_ms(u16 nms);
void delay_us(u32 nus);
void Delay(vu32 nCount);

#endif



#endif

