yc_systick.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. File Name : yc_systick.h
  3. Author : Yichip
  4. Version : V1.0
  5. Date : 2018/03/27
  6. Description : systick encapsulation.
  7. */
  8. #ifndef __YC_SYSTICK_H__
  9. #define __YC_SYSTICK_H__
  10. #include "..\core\yc3121.h"
  11. #define SYSTICK_SYSCLOCK 1
  12. #define SYSTICK_HALF_SYSCLOCK 0
  13. #define IS_RELOAD_VALUE(x) (x>0&&x<=0xffffff)
  14. typedef int32_t tick;
  15. #define TICK_MAX_VALUE (int32_t)0x7FFFFFFF
  16. void Systick_Dealy_Ms(uint32_t MS);
  17. /**
  18. * @brief Initialize systick and start systick
  19. *
  20. * @param ReloadValue : the systick reload value
  21. *
  22. * @retval 0:succeed 1:error
  23. */
  24. uint32_t SysTick_Config(uint32_t ReloadValue);
  25. /**
  26. * @brief get the current value of SystickCount(SystickCount plus one for every overflow interrupt)
  27. *
  28. * @param none
  29. *
  30. * @retval current value of SystickCount
  31. */
  32. tick SysTick_GetTick(void);
  33. /**
  34. * @brief Determine whether the timeout that millisecond.
  35. *
  36. * @param start_tick:start tick
  37. *
  38. * @param interval:time interval(ms)
  39. *
  40. * @retval TRUE is timeout ,FALSE is not timeout
  41. */
  42. Boolean SysTick_IsTimeOut(tick start_tick,int interval);
  43. /**
  44. * @brief get relative time .
  45. *
  46. * @param start_tick:start tick(start time)
  47. *
  48. * @retval the relative time(millisecond)
  49. */
  50. uint32_t SysTick_GetRelativeTime(tick start_tick);
  51. #endif /* __YC_SYSTICK_H__ */