From 4d148c9a559664a06ed551e592e87f74cd8b84ec Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 10 Dec 2024 18:18:15 +0800 Subject: [PATCH] check only the busy status bit for i2c to confirm command initiation --- libs/cramium-hal/src/udma/i2c.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/cramium-hal/src/udma/i2c.rs b/libs/cramium-hal/src/udma/i2c.rs index 0b0a436f8..c849724d5 100644 --- a/libs/cramium-hal/src/udma/i2c.rs +++ b/libs/cramium-hal/src/udma/i2c.rs @@ -305,7 +305,6 @@ impl<'a> I2c<'a> { fn busy(&self) -> bool { self.csr.rf(utra::udma_i2c_0::REG_STATUS_R_BUSY) != 0 - || self.csr.rf(utra::udma_i2c_0::REG_STATUS_R_BUSY) != 0 || self.udma_busy(Bank::Custom) || self.udma_busy(Bank::Tx) || self.udma_busy(Bank::Rx) @@ -361,7 +360,7 @@ impl<'a> I2c<'a> { self.udma_enqueue(Bank::Custom, &self.cmd_buf_phys[..self.seq_len], CFG_EN); } // wait for the commands to propagate before returning - while !self.busy() {} + while !self.csr.rf(utra::udma_i2c_0::REG_STATUS_R_BUSY) != 0 {} self.pending = I2cPending::Write(data.len()); Ok(data.len()) } @@ -421,7 +420,7 @@ impl<'a> I2c<'a> { self.udma_enqueue(Bank::Custom, &self.cmd_buf_phys[..self.seq_len], CFG_EN); } // wait for the commands to propagate before returning - while !self.busy() {} + while !self.csr.rf(utra::udma_i2c_0::REG_STATUS_R_BUSY) != 0 {} self.pending = I2cPending::Read(len); Ok(len) }