You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. /*********************************************************
  2. *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd.
  3. *: systick.c
  4. * : AE Team
  5. * : V1.00
  6. * : 2021/05/13
  7. * :
  8. * : 使
  9. **********************************************************/
  10. #include "systick.h"
  11. __IO uint32_t TimingDelay;
  12. /*********************************************************
  13. : void User_SysTickInit(void)
  14. : 100us
  15. :
  16. :
  17. :
  18. 1ms(48000)
  19. **********************************************************/
  20. void User_SysTickInit(void)
  21. {
  22. SYSTICK_InitStruType x;
  23. // x.SysTick_Value = SystemCoreClock / 10000;//重装载值4800(SystemCoreClock=48M)
  24. // x.SysTick_ClkSource = SysTick_ClkS_Cpu;//时钟48M
  25. // x.SysTick_ITEnable = Enable;
  26. // SysTick_Init(&x);//现在滴答定时器时钟用的48M,重装载值4800 t=1s/f(f=48M/4800)
  27. x.SysTick_Value = SystemCoreClock / 1000;
  28. x.SysTick_ClkSource = SysTick_ClkS_Cpu;//时钟48M
  29. x.SysTick_ITEnable = Enable;
  30. SysTick_Init(&x);//现在滴答定时器时钟用的48M,重装载值4800 t=1s/f(f=48M/48000)
  31. SysTick_Disable();
  32. }
  33. /*********************************************************
  34. : void Delay_100us(__IO uint32_t nTime)
  35. : 100us定时
  36. : 100us个数
  37. :
  38. :
  39. **********************************************************/
  40. void Delay_100us(__IO uint32_t nTime)
  41. {
  42. TimingDelay = nTime;
  43. SysTick_Enable();
  44. while (TimingDelay != 0);
  45. SysTick_Disable();
  46. }
  47. /*********************************************************
  48. : void TimingDelay_Decrement(void)
  49. :
  50. :
  51. :
  52. :
  53. **********************************************************/
  54. void TimingDelay_Decrement(void)
  55. {
  56. if (TimingDelay != 0)
  57. TimingDelay --;
  58. }