使用核内部timer定时器实现延时函数,为什么系统时钟要除以4?
void delay_1ms(uint32_t count)
{
uint64_t start_mtime, delta_mtime;
uint64_t tmp = get_timer_value();
do{
start_mtime = get_timer_value();
}while(start_mtime == tmp);
do{
delta_mtime = get_timer_value() - start_mtime;
}while(delta_mtime <(SystemCoreClock/4000 * count));
|