#include "bsp_tim.h"

// tick_1ms_cnt在SysTick_Handler()中1ms +1
volatile uint32_t tick_1ms_cnt = 0;

/**
 * @description: 以SysTick（1ms）为基础
 * @return {uint32_t}
 */
uint32_t BSP_Get_Tick(void)
{
    /* Platform implementation */
    return tick_1ms_cnt;
}

// SysTick中断函数
__INTERRUPT
__HIGH_CODE
void SysTick_Handler()
{
    static uint8_t cnt_ms = 0;

    SysTick->SR = 0; // 清除中断标志
    tick_1ms_cnt++;

    cnt_ms++;
}
