void delay10us(uint32_t u32Cnt)
{
uint32_t Cur = SysTick->VAL;
uint32_t Mod = SysTick->LOAD;
uint32_t Cnt = (u32Cnt * SystemCoreClock) / 100000;
boolean_t Dec = FALSE;
while (Cnt > Mod)
{
if (SysTick->VAL >= Cur)
{
if (Dec == FALSE)
{
Cnt -= Mod;
Dec = TRUE;
}
}
else
Dec = FALSE;
}
if (Cnt > Cur)
{
while (SysTick->VAL < Cur){};
while (SysTick->VAL > Mod + Cur - Cnt){};
}
else
while (SysTick->VAL > Cnt - Cur){};
}
重写ddl.c中的延时函数。