diff options
| -rw-r--r-- | embassy-rp/src/i2c.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs index d1df671ed..cd5364393 100644 --- a/embassy-rp/src/i2c.rs +++ b/embassy-rp/src/i2c.rs | |||
| @@ -617,16 +617,22 @@ mod eh02 { | |||
| 617 | self.blocking_write_read(address, bytes, buffer) | 617 | self.blocking_write_read(address, bytes, buffer) |
| 618 | } | 618 | } |
| 619 | } | 619 | } |
| 620 | 620 | ||
| 621 | impl<'d, T: Instance, M: Mode> embedded_hal_02::blocking::i2c::Transactional for I2c<'d, T, M> { | 621 | impl<'d, T: Instance, M: Mode> embedded_hal_02::blocking::i2c::Transactional for I2c<'d, T, M> { |
| 622 | type Error = Error; | 622 | type Error = Error; |
| 623 | 623 | ||
| 624 | fn exec(&mut self, address: u8, operations: &mut [embedded_hal_02::blocking::i2c::Operation<'_>]) -> Result<(), Self::Error> { | 624 | fn exec( |
| 625 | &mut self, | ||
| 626 | address: u8, | ||
| 627 | operations: &mut [embedded_hal_02::blocking::i2c::Operation<'_>], | ||
| 628 | ) -> Result<(), Self::Error> { | ||
| 625 | Self::setup(address.into())?; | 629 | Self::setup(address.into())?; |
| 626 | for i in 0..operations.len() { | 630 | for i in 0..operations.len() { |
| 627 | let last = i == operations.len() - 1; | 631 | let last = i == operations.len() - 1; |
| 628 | match &mut operations[i] { | 632 | match &mut operations[i] { |
| 629 | embedded_hal_02::blocking::i2c::Operation::Read(buf) => self.read_blocking_internal(buf, false, last)?, | 633 | embedded_hal_02::blocking::i2c::Operation::Read(buf) => { |
| 634 | self.read_blocking_internal(buf, false, last)? | ||
| 635 | } | ||
| 630 | embedded_hal_02::blocking::i2c::Operation::Write(buf) => self.write_blocking_internal(buf, last)?, | 636 | embedded_hal_02::blocking::i2c::Operation::Write(buf) => self.write_blocking_internal(buf, last)?, |
| 631 | } | 637 | } |
| 632 | } | 638 | } |
