diff options
| author | liebman <[email protected]> | 2025-10-22 14:24:01 -0700 |
|---|---|---|
| committer | liebman <[email protected]> | 2025-11-03 12:50:36 -0800 |
| commit | ea94cb58a2016b1ab408aa975192de7aefe52ec5 (patch) | |
| tree | 9f954331a22d65f1565dd54362043a4a674cdfad /embassy-stm32/src/i2c | |
| parent | 36aa3e10aaf27bb1bd1109a203b378dc93b90b02 (diff) | |
use DeviceBusy to mark when stop1 or stop2 is unavailable.
Diffstat (limited to 'embassy-stm32/src/i2c')
| -rw-r--r-- | embassy-stm32/src/i2c/v2.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs index a2184630f..6f2d03bd1 100644 --- a/embassy-stm32/src/i2c/v2.rs +++ b/embassy-stm32/src/i2c/v2.rs | |||
| @@ -819,6 +819,8 @@ impl<'d, IM: MasterMode> I2c<'d, Async, IM> { | |||
| 819 | 819 | ||
| 820 | /// Write. | 820 | /// Write. |
| 821 | pub async fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Error> { | 821 | pub async fn write(&mut self, address: u8, write: &[u8]) -> Result<(), Error> { |
| 822 | #[cfg(all(feature = "low-power", stm32wlex))] | ||
| 823 | let _device_busy = crate::low_power::DeviceBusy::new(); | ||
| 822 | let timeout = self.timeout(); | 824 | let timeout = self.timeout(); |
| 823 | if write.is_empty() { | 825 | if write.is_empty() { |
| 824 | self.write_internal(address.into(), write, true, timeout) | 826 | self.write_internal(address.into(), write, true, timeout) |
| @@ -833,6 +835,8 @@ impl<'d, IM: MasterMode> I2c<'d, Async, IM> { | |||
| 833 | /// | 835 | /// |
| 834 | /// The buffers are concatenated in a single write transaction. | 836 | /// The buffers are concatenated in a single write transaction. |
| 835 | pub async fn write_vectored(&mut self, address: Address, write: &[&[u8]]) -> Result<(), Error> { | 837 | pub async fn write_vectored(&mut self, address: Address, write: &[&[u8]]) -> Result<(), Error> { |
| 838 | #[cfg(all(feature = "low-power", stm32wlex))] | ||
| 839 | let _device_busy = crate::low_power::DeviceBusy::new(); | ||
| 836 | let timeout = self.timeout(); | 840 | let timeout = self.timeout(); |
| 837 | 841 | ||
| 838 | if write.is_empty() { | 842 | if write.is_empty() { |
| @@ -856,6 +860,8 @@ impl<'d, IM: MasterMode> I2c<'d, Async, IM> { | |||
| 856 | 860 | ||
| 857 | /// Read. | 861 | /// Read. |
| 858 | pub async fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Error> { | 862 | pub async fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Error> { |
| 863 | #[cfg(all(feature = "low-power", stm32wlex))] | ||
| 864 | let _device_busy = crate::low_power::DeviceBusy::new(); | ||
| 859 | let timeout = self.timeout(); | 865 | let timeout = self.timeout(); |
| 860 | 866 | ||
| 861 | if buffer.is_empty() { | 867 | if buffer.is_empty() { |
| @@ -868,6 +874,8 @@ impl<'d, IM: MasterMode> I2c<'d, Async, IM> { | |||
| 868 | 874 | ||
| 869 | /// Write, restart, read. | 875 | /// Write, restart, read. |
| 870 | pub async fn write_read(&mut self, address: u8, write: &[u8], read: &mut [u8]) -> Result<(), Error> { | 876 | pub async fn write_read(&mut self, address: u8, write: &[u8], read: &mut [u8]) -> Result<(), Error> { |
| 877 | #[cfg(all(feature = "low-power", stm32wlex))] | ||
| 878 | let _device_busy = crate::low_power::DeviceBusy::new(); | ||
| 871 | let timeout = self.timeout(); | 879 | let timeout = self.timeout(); |
| 872 | 880 | ||
| 873 | if write.is_empty() { | 881 | if write.is_empty() { |
| @@ -893,6 +901,8 @@ impl<'d, IM: MasterMode> I2c<'d, Async, IM> { | |||
| 893 | /// | 901 | /// |
| 894 | /// [transaction contract]: embedded_hal_1::i2c::I2c::transaction | 902 | /// [transaction contract]: embedded_hal_1::i2c::I2c::transaction |
| 895 | pub async fn transaction(&mut self, addr: u8, operations: &mut [Operation<'_>]) -> Result<(), Error> { | 903 | pub async fn transaction(&mut self, addr: u8, operations: &mut [Operation<'_>]) -> Result<(), Error> { |
| 904 | #[cfg(all(feature = "low-power", stm32wlex))] | ||
| 905 | let _device_busy = crate::low_power::DeviceBusy::new(); | ||
| 896 | let _ = addr; | 906 | let _ = addr; |
| 897 | let _ = operations; | 907 | let _ = operations; |
| 898 | todo!() | 908 | todo!() |
