timer.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. ******************************** STM32F10x *********************************
  3. * @文件名 : timer.h
  4. * @作者 : sun
  5. * @库版本 : V3.5.0
  6. * @文件版本 : V1.0.0
  7. * @日期 : 2016年05月09日
  8. * @摘要 : 定时器头文件
  9. ******************************************************************************/
  10. /* 定义防止递归包含 ----------------------------------------------------------*/
  11. #ifndef _TIMER_H
  12. #define _TIMER_H
  13. /* 包含的头文件 --------------------------------------------------------------*/
  14. #include "stm32f10x.h"
  15. /*********************************************************************/
  16. void Tim3_init(int Period, int Prescaler);
  17. /*********************************************************************/
  18. /* 宏定义 --------------------------------------------------------------------*/
  19. #define TIM4_COUNTER_CLOCK 1000000 //计数时钟(1M次/秒)
  20. //预分频值
  21. #define TIM4_PRESCALER_VALUE (SystemCoreClock/TIM4_COUNTER_CLOCK - 1)
  22. #define TIM4_PERIOD_TIMING (10 - 1) //定时周期(相对于计数时钟:1周期 = 1计数时钟)
  23. /* 函数申明 ------------------------------------------------------------------*/
  24. void TIMER_Initializes(void);
  25. void TIMDelay_N10us(uint16_t Times);
  26. void TIMDelay_Nms(uint16_t Times);
  27. #endif /* _TIMER_H */
  28. /**** Copyright (C)2016 sun. All Rights Reserved **** END OF FILE ****/