[bsp][stm32f1xx-hal]修复当开启优化时m3_m4_delay_us延时失效问题

This commit is contained in:
ZYH 2018-10-11 11:38:04 +08:00
parent 6e5751d49b
commit 0893e54293
1 changed files with 5 additions and 4 deletions

View File

@ -115,11 +115,12 @@ void SystemClock_Config(void)
static void m3_m4_delay_us(rt_uint32_t us)
{
int i = (HAL_RCC_GetHCLKFreq() / 4000000 * us);
while (i)
__IO uint32_t Delay = us * (SystemCoreClock / 8U / 1000000U);
do
{
i--;
}
__NOP();
}
while (Delay --);
}
void HAL_Delay(__IO uint32_t Delay)