From 8e7d0e6406d8e701860a3138292ae87d75ddc8b0 Mon Sep 17 00:00:00 2001 From: TrAyZeN Date: Mon, 1 Dec 2025 10:57:41 +0100 Subject: stm32/i2c: Restrict listen to async I2c mode --- embassy-stm32/src/i2c/v2.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs index 6b213484c..4f105adef 100644 --- a/embassy-stm32/src/i2c/v2.rs +++ b/embassy-stm32/src/i2c/v2.rs @@ -1673,6 +1673,22 @@ impl<'d, M: Mode> I2c<'d, M, MultiMaster> { Ok(()) } + /// Respond to a write command. + /// + /// Returns total number of bytes received. + pub fn blocking_respond_to_write(&self, read: &mut [u8]) -> Result { + let timeout = self.timeout(); + self.slave_read_internal(read, timeout) + } + + /// Respond to a read command. + pub fn blocking_respond_to_read(&mut self, write: &[u8]) -> Result<(), Error> { + let timeout = self.timeout(); + self.slave_write_internal(write, timeout) + } +} + +impl<'d> I2c<'d, Async, MultiMaster> { /// Listen for incoming I2C messages. /// /// The listen method is an asynchronous method but it does not require DMA to be asynchronous. @@ -1713,22 +1729,6 @@ impl<'d, M: Mode> I2c<'d, M, MultiMaster> { .await } - /// Respond to a write command. - /// - /// Returns total number of bytes received. - pub fn blocking_respond_to_write(&self, read: &mut [u8]) -> Result { - let timeout = self.timeout(); - self.slave_read_internal(read, timeout) - } - - /// Respond to a read command. - pub fn blocking_respond_to_read(&mut self, write: &[u8]) -> Result<(), Error> { - let timeout = self.timeout(); - self.slave_write_internal(write, timeout) - } -} - -impl<'d> I2c<'d, Async, MultiMaster> { /// Respond to a write command. /// /// Returns the total number of bytes received. -- cgit