systick.c 630 B

12345678910111213141516171819202122232425262728
  1. #include "systick.h"
  2. #include "includes.h"
  3. void SysTick_init(void)
  4. {
  5. RCC_ClocksTypeDef RCC_Clocks;
  6. RCC_GetClocksFreq(&RCC_Clocks);
  7. SysTick_Config(RCC_Clocks.SYSCLK_Frequency / OS_CFG_TICK_RATE_HZ);
  8. //SystemCoreClock
  9. // SysTick->CTRL |= SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk | SysTick_CTRL_ENABLE_Msk;
  10. // NVIC_EnableIRQ(SysTick_IRQn);
  11. }
  12. /**
  13. * @brief This function handles SysTick Handler.
  14. * @param None
  15. * @retval None
  16. */
  17. volatile uint32_t TickCounter;
  18. volatile uint64_t TickCounter_u64;
  19. void SysTick_Handler(void)
  20. {
  21. OSIntEnter();
  22. OSTimeTick();
  23. OSIntExit();
  24. TickCounter++;
  25. TickCounter_u64++;
  26. }