From f420b4dce7cfcefb54774bc9cad420f4a8d467f1 Mon Sep 17 00:00:00 2001 From: flyingfish89 <2914061332@qq.com> Date: Mon, 21 Nov 2022 16:03:22 +0800 Subject: [PATCH] esp32c3:fix i2c bug of timout Signed-off-by: flyingfish89 <2914061332@qq.com> --- arch/risc-v/src/esp32c3/esp32c3_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/risc-v/src/esp32c3/esp32c3_i2c.c b/arch/risc-v/src/esp32c3/esp32c3_i2c.c index afc5a9046e..49b73b606b 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_i2c.c +++ b/arch/risc-v/src/esp32c3/esp32c3_i2c.c @@ -844,7 +844,7 @@ static int esp32c3_i2c_polling_waitdone(struct esp32c3_i2c_priv_s *priv) * and an error didn't occur within the timeout */ - while ((current < timeout) && (priv->error == 0)) + while ((sclock_t)(current - timeout) < 0 && (priv->error == 0)) { /* Check if any interrupt triggered, clear them * process the operation.