diff options
Diffstat (limited to 'embassy-stm32/src/i2c/v1.rs')
| -rw-r--r-- | embassy-stm32/src/i2c/v1.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/embassy-stm32/src/i2c/v1.rs b/embassy-stm32/src/i2c/v1.rs index 128a58db7..81a6d74c1 100644 --- a/embassy-stm32/src/i2c/v1.rs +++ b/embassy-stm32/src/i2c/v1.rs | |||
| @@ -529,6 +529,7 @@ impl<'d, IM: MasterMode> I2c<'d, Async, IM> { | |||
| 529 | 529 | ||
| 530 | /// Write. | 530 | /// Write. |
| 531 | pub async fn write(&mut self, address: u8, write_buffer: &[u8]) -> Result<(), Error> { | 531 | pub async fn write(&mut self, address: u8, write_buffer: &[u8]) -> Result<(), Error> { |
| 532 | let _scoped_block_stop = self.info.rcc.block_stop(); | ||
| 532 | self.write_frame(address, write_buffer, FrameOptions::FirstAndLastFrame) | 533 | self.write_frame(address, write_buffer, FrameOptions::FirstAndLastFrame) |
| 533 | .await?; | 534 | .await?; |
| 534 | 535 | ||
| @@ -537,6 +538,7 @@ impl<'d, IM: MasterMode> I2c<'d, Async, IM> { | |||
| 537 | 538 | ||
| 538 | /// Read. | 539 | /// Read. |
| 539 | pub async fn read(&mut self, address: u8, read_buffer: &mut [u8]) -> Result<(), Error> { | 540 | pub async fn read(&mut self, address: u8, read_buffer: &mut [u8]) -> Result<(), Error> { |
| 541 | let _scoped_block_stop = self.info.rcc.block_stop(); | ||
| 540 | self.read_frame(address, read_buffer, FrameOptions::FirstAndLastFrame) | 542 | self.read_frame(address, read_buffer, FrameOptions::FirstAndLastFrame) |
| 541 | .await?; | 543 | .await?; |
| 542 | 544 | ||
| @@ -701,6 +703,7 @@ impl<'d, IM: MasterMode> I2c<'d, Async, IM> { | |||
| 701 | 703 | ||
| 702 | /// Write, restart, read. | 704 | /// Write, restart, read. |
| 703 | pub async fn write_read(&mut self, address: u8, write_buffer: &[u8], read_buffer: &mut [u8]) -> Result<(), Error> { | 705 | pub async fn write_read(&mut self, address: u8, write_buffer: &[u8], read_buffer: &mut [u8]) -> Result<(), Error> { |
| 706 | let _scoped_block_stop = self.info.rcc.block_stop(); | ||
| 704 | // Check empty read buffer before starting transaction. Otherwise, we would not generate the | 707 | // Check empty read buffer before starting transaction. Otherwise, we would not generate the |
| 705 | // stop condition below. | 708 | // stop condition below. |
| 706 | if read_buffer.is_empty() { | 709 | if read_buffer.is_empty() { |
| @@ -719,6 +722,7 @@ impl<'d, IM: MasterMode> I2c<'d, Async, IM> { | |||
| 719 | /// | 722 | /// |
| 720 | /// [transaction contract]: embedded_hal_1::i2c::I2c::transaction | 723 | /// [transaction contract]: embedded_hal_1::i2c::I2c::transaction |
| 721 | pub async fn transaction(&mut self, address: u8, operations: &mut [Operation<'_>]) -> Result<(), Error> { | 724 | pub async fn transaction(&mut self, address: u8, operations: &mut [Operation<'_>]) -> Result<(), Error> { |
| 725 | let _scoped_block_stop = self.info.rcc.block_stop(); | ||
| 722 | for (op, frame) in operation_frames(operations)? { | 726 | for (op, frame) in operation_frames(operations)? { |
| 723 | match op { | 727 | match op { |
| 724 | Operation::Read(read_buffer) => self.read_frame(address, read_buffer, frame).await?, | 728 | Operation::Read(read_buffer) => self.read_frame(address, read_buffer, frame).await?, |
| @@ -1357,6 +1361,7 @@ impl<'d> I2c<'d, Async, MultiMaster> { | |||
| 1357 | /// (Read/Write) and the matched address. This method will suspend until | 1361 | /// (Read/Write) and the matched address. This method will suspend until |
| 1358 | /// an address match occurs. | 1362 | /// an address match occurs. |
| 1359 | pub async fn listen(&mut self) -> Result<SlaveCommand, Error> { | 1363 | pub async fn listen(&mut self) -> Result<SlaveCommand, Error> { |
| 1364 | let _scoped_block_stop = self.info.rcc.block_stop(); | ||
| 1360 | trace!("I2C slave: starting async listen for address match"); | 1365 | trace!("I2C slave: starting async listen for address match"); |
| 1361 | let state = self.state; | 1366 | let state = self.state; |
| 1362 | let info = self.info; | 1367 | let info = self.info; |
| @@ -1421,6 +1426,7 @@ impl<'d> I2c<'d, Async, MultiMaster> { | |||
| 1421 | /// | 1426 | /// |
| 1422 | /// Returns the number of bytes stored in the buffer (not total received). | 1427 | /// Returns the number of bytes stored in the buffer (not total received). |
| 1423 | pub async fn respond_to_write(&mut self, buffer: &mut [u8]) -> Result<usize, Error> { | 1428 | pub async fn respond_to_write(&mut self, buffer: &mut [u8]) -> Result<usize, Error> { |
| 1429 | let _scoped_block_stop = self.info.rcc.block_stop(); | ||
| 1424 | trace!("I2C slave: starting respond_to_write, buffer_len={}", buffer.len()); | 1430 | trace!("I2C slave: starting respond_to_write, buffer_len={}", buffer.len()); |
| 1425 | 1431 | ||
| 1426 | if buffer.is_empty() { | 1432 | if buffer.is_empty() { |
| @@ -1454,6 +1460,7 @@ impl<'d> I2c<'d, Async, MultiMaster> { | |||
| 1454 | /// | 1460 | /// |
| 1455 | /// Returns the total number of bytes transmitted (data + padding). | 1461 | /// Returns the total number of bytes transmitted (data + padding). |
| 1456 | pub async fn respond_to_read(&mut self, data: &[u8]) -> Result<usize, Error> { | 1462 | pub async fn respond_to_read(&mut self, data: &[u8]) -> Result<usize, Error> { |
| 1463 | let _scoped_block_stop = self.info.rcc.block_stop(); | ||
| 1457 | trace!("I2C slave: starting respond_to_read, data_len={}", data.len()); | 1464 | trace!("I2C slave: starting respond_to_read, data_len={}", data.len()); |
| 1458 | 1465 | ||
| 1459 | if data.is_empty() { | 1466 | if data.is_empty() { |
