systick.c 778 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "systick.h"
  2. #include "includes.h"
  3. void SysTick_init(void)
  4. {
  5. /* setup systick timer for 1000Hz interrupts */
  6. if (SysTick_Config(SystemCoreClock / 1000U)){
  7. /* capture error */
  8. while(1){
  9. }
  10. }
  11. /* configure the systick handler priority */
  12. NVIC_SetPriority(SysTick_IRQn, 0x00U);
  13. }
  14. /**
  15. * @brief This function handles SysTick Handler.
  16. * @param None
  17. * @retval None
  18. */
  19. volatile uint32_t TickCounter;
  20. volatile uint64_t TickCounter_u64;
  21. uint32_t systick_count=0;
  22. void SysTick_Handler(void)
  23. {
  24. systick_count++;
  25. if((systick_count%499)==0)
  26. {
  27. LED_RUN_OFF();
  28. LED_STATE_OFF();
  29. }
  30. else if((systick_count%999)==0)
  31. {
  32. LED_RUN_ON();
  33. LED_STATE_ON();
  34. }
  35. TickCounter++;
  36. TickCounter_u64++;
  37. // USART_ReceiveOvertimeProcess();
  38. }