提交 ffdd7f98 编写于 作者: lymzzyh's avatar lymzzyh

[Bsp][stm32f4xx-hal]修复I2C在开启优化时出现延时异常的问题

上级 d7b70ee9
......@@ -78,11 +78,12 @@ static rt_int32_t drv_get_scl(void *data)
static void drv_udelay(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 --);
}
static const struct rt_i2c_bit_ops drv_bit_ops =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册