diff options
| author | TrAyZeN <[email protected]> | 2025-12-01 10:57:41 +0100 |
|---|---|---|
| committer | TrAyZeN <[email protected]> | 2025-12-01 10:57:41 +0100 |
| commit | 8e7d0e6406d8e701860a3138292ae87d75ddc8b0 (patch) | |
| tree | 7c6139b3726480b1fb8c7a5b12550606ec14621c | |
| parent | fcd5383f475f7bd413541123d941d3d7e1cd326b (diff) | |
stm32/i2c: Restrict listen to async I2c mode
| -rw-r--r-- | embassy-stm32/src/i2c/v2.rs | 32 |
1 files 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> { | |||
| 1673 | Ok(()) | 1673 | Ok(()) |
| 1674 | } | 1674 | } |
| 1675 | 1675 | ||
| 1676 | /// Respond to a write command. | ||
| 1677 | /// | ||
| 1678 | /// Returns total number of bytes received. | ||
| 1679 | pub fn blocking_respond_to_write(&self, read: &mut [u8]) -> Result<usize, Error> { | ||
| 1680 | let timeout = self.timeout(); | ||
| 1681 | self.slave_read_internal(read, timeout) | ||
| 1682 | } | ||
| 1683 | |||
| 1684 | /// Respond to a read command. | ||
| 1685 | pub fn blocking_respond_to_read(&mut self, write: &[u8]) -> Result<(), Error> { | ||
| 1686 | let timeout = self.timeout(); | ||
| 1687 | self.slave_write_internal(write, timeout) | ||
| 1688 | } | ||
| 1689 | } | ||
| 1690 | |||
| 1691 | impl<'d> I2c<'d, Async, MultiMaster> { | ||
| 1676 | /// Listen for incoming I2C messages. | 1692 | /// Listen for incoming I2C messages. |
| 1677 | /// | 1693 | /// |
| 1678 | /// The listen method is an asynchronous method but it does not require DMA to be asynchronous. | 1694 | /// The listen method is an asynchronous method but it does not require DMA to be asynchronous. |
| @@ -1715,22 +1731,6 @@ impl<'d, M: Mode> I2c<'d, M, MultiMaster> { | |||
| 1715 | 1731 | ||
| 1716 | /// Respond to a write command. | 1732 | /// Respond to a write command. |
| 1717 | /// | 1733 | /// |
| 1718 | /// Returns total number of bytes received. | ||
| 1719 | pub fn blocking_respond_to_write(&self, read: &mut [u8]) -> Result<usize, Error> { | ||
| 1720 | let timeout = self.timeout(); | ||
| 1721 | self.slave_read_internal(read, timeout) | ||
| 1722 | } | ||
| 1723 | |||
| 1724 | /// Respond to a read command. | ||
| 1725 | pub fn blocking_respond_to_read(&mut self, write: &[u8]) -> Result<(), Error> { | ||
| 1726 | let timeout = self.timeout(); | ||
| 1727 | self.slave_write_internal(write, timeout) | ||
| 1728 | } | ||
| 1729 | } | ||
| 1730 | |||
| 1731 | impl<'d> I2c<'d, Async, MultiMaster> { | ||
| 1732 | /// Respond to a write command. | ||
| 1733 | /// | ||
| 1734 | /// Returns the total number of bytes received. | 1734 | /// Returns the total number of bytes received. |
| 1735 | pub async fn respond_to_write(&mut self, buffer: &mut [u8]) -> Result<usize, Error> { | 1735 | pub async fn respond_to_write(&mut self, buffer: &mut [u8]) -> Result<usize, Error> { |
| 1736 | let timeout = self.timeout(); | 1736 | let timeout = self.timeout(); |
