验证中...
Languages: C/C++
Categories: 常用工具包
Latest update 2018-12-09 10:09
HAL_Delayus(uint32_t t)
Raw Copy
void HAL_DelayUs(uint32_t us)
{
uint32_t start = SysTick->VAL;
uint32_t current;
uint32_t overflow;
uint32_t reload = SysTick->LOAD;
uint32_t t = us * ((reload + 1) / 1000);
while (1)
{
current = SysTick->VAL;
if (current != start)
{
if (current < start)
{
overflow += start - current;
start = current;
}
else
{
overflow += reload - current + start;
start = current;
}
if (overflow >= t)
{
break;
}
}
}
}

Comment list( 0 )

Sign in for post a comment

Help Search