39 lines
828 B
C
39 lines
828 B
C
/*
|
||
* @Author : stark1898y 1658608470@qq.com
|
||
* @Date : 2024-12-15 15:01:15
|
||
* @LastEditors : stark1898y 1658608470@qq.com
|
||
* @LastEditTime : 2024-12-15 16:24:32
|
||
* @FilePath : \BLE_TYQ_CH592F - 副本\BSP\src\bsp_tim.c
|
||
* @Description :
|
||
*
|
||
* Copyright (c) 2024 by yzy, All Rights Reserved.
|
||
*/
|
||
#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 */
|
||
// current system clock (in 0.625ms)
|
||
return (uint32_t)((double)TMOS_GetSystemClock() / 1.6);
|
||
}
|
||
|
||
// SysTick中断函数
|
||
__INTERRUPT
|
||
__HIGH_CODE
|
||
void SysTick_Handler()
|
||
{
|
||
static uint8_t cnt_ms = 0;
|
||
|
||
SysTick->SR = 0; // 清除中断标志
|
||
tick_1ms_cnt++;
|
||
|
||
cnt_ms++;
|
||
}
|