diff options
| author | Dion Dokter <[email protected]> | 2025-09-18 11:06:33 +0200 |
|---|---|---|
| committer | Dion Dokter <[email protected]> | 2025-09-18 11:06:33 +0200 |
| commit | b794997c56a7111b2c628b978486b7252ae98e26 (patch) | |
| tree | 75a84af33b82d332d14cb45d4923ee94b6d99e79 /embassy-embedded-hal/src/shared_bus/blocking | |
| parent | 6c801a0dba93680c8e41e611eada0576eab0f861 (diff) | |
Clippy fixes
Diffstat (limited to 'embassy-embedded-hal/src/shared_bus/blocking')
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/blocking/i2c.rs | 10 | ||||
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/blocking/spi.rs | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs index fa34cd416..dc634a209 100644 --- a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs +++ b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs | |||
| @@ -81,33 +81,33 @@ where | |||
| 81 | } | 81 | } |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | impl<'a, M, BUS, E> embedded_hal_02::blocking::i2c::Write for I2cDevice<'_, M, BUS> | 84 | impl<M, BUS, E> embedded_hal_02::blocking::i2c::Write for I2cDevice<'_, M, BUS> |
| 85 | where | 85 | where |
| 86 | M: RawMutex, | 86 | M: RawMutex, |
| 87 | BUS: embedded_hal_02::blocking::i2c::Write<Error = E>, | 87 | BUS: embedded_hal_02::blocking::i2c::Write<Error = E>, |
| 88 | { | 88 | { |
| 89 | type Error = I2cDeviceError<E>; | 89 | type Error = I2cDeviceError<E>; |
| 90 | 90 | ||
| 91 | fn write<'w>(&mut self, addr: u8, bytes: &'w [u8]) -> Result<(), Self::Error> { | 91 | fn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Self::Error> { |
| 92 | self.bus | 92 | self.bus |
| 93 | .lock(|bus| bus.borrow_mut().write(addr, bytes).map_err(I2cDeviceError::I2c)) | 93 | .lock(|bus| bus.borrow_mut().write(addr, bytes).map_err(I2cDeviceError::I2c)) |
| 94 | } | 94 | } |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | impl<'a, M, BUS, E> embedded_hal_02::blocking::i2c::Read for I2cDevice<'_, M, BUS> | 97 | impl<M, BUS, E> embedded_hal_02::blocking::i2c::Read for I2cDevice<'_, M, BUS> |
| 98 | where | 98 | where |
| 99 | M: RawMutex, | 99 | M: RawMutex, |
| 100 | BUS: embedded_hal_02::blocking::i2c::Read<Error = E>, | 100 | BUS: embedded_hal_02::blocking::i2c::Read<Error = E>, |
| 101 | { | 101 | { |
| 102 | type Error = I2cDeviceError<E>; | 102 | type Error = I2cDeviceError<E>; |
| 103 | 103 | ||
| 104 | fn read<'w>(&mut self, addr: u8, bytes: &'w mut [u8]) -> Result<(), Self::Error> { | 104 | fn read(&mut self, addr: u8, bytes: &mut [u8]) -> Result<(), Self::Error> { |
| 105 | self.bus | 105 | self.bus |
| 106 | .lock(|bus| bus.borrow_mut().read(addr, bytes).map_err(I2cDeviceError::I2c)) | 106 | .lock(|bus| bus.borrow_mut().read(addr, bytes).map_err(I2cDeviceError::I2c)) |
| 107 | } | 107 | } |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | impl<'a, M, BUS, E> embedded_hal_02::blocking::i2c::WriteRead for I2cDevice<'_, M, BUS> | 110 | impl<M, BUS, E> embedded_hal_02::blocking::i2c::WriteRead for I2cDevice<'_, M, BUS> |
| 111 | where | 111 | where |
| 112 | M: RawMutex, | 112 | M: RawMutex, |
| 113 | BUS: embedded_hal_02::blocking::i2c::WriteRead<Error = E>, | 113 | BUS: embedded_hal_02::blocking::i2c::WriteRead<Error = E>, |
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs index eb9c0c4f4..ffe2aa1c6 100644 --- a/embassy-embedded-hal/src/shared_bus/blocking/spi.rs +++ b/embassy-embedded-hal/src/shared_bus/blocking/spi.rs | |||
| @@ -82,11 +82,11 @@ where | |||
| 82 | let flush_res = bus.flush(); | 82 | let flush_res = bus.flush(); |
| 83 | let cs_res = self.cs.set_high(); | 83 | let cs_res = self.cs.set_high(); |
| 84 | 84 | ||
| 85 | let op_res = op_res.map_err(SpiDeviceError::Spi)?; | 85 | op_res.map_err(SpiDeviceError::Spi)?; |
| 86 | flush_res.map_err(SpiDeviceError::Spi)?; | 86 | flush_res.map_err(SpiDeviceError::Spi)?; |
| 87 | cs_res.map_err(SpiDeviceError::Cs)?; | 87 | cs_res.map_err(SpiDeviceError::Cs)?; |
| 88 | 88 | ||
| 89 | Ok(op_res) | 89 | Ok(()) |
| 90 | }) | 90 | }) |
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| @@ -158,10 +158,10 @@ where | |||
| 158 | let flush_res = bus.flush(); | 158 | let flush_res = bus.flush(); |
| 159 | let cs_res = self.cs.set_high(); | 159 | let cs_res = self.cs.set_high(); |
| 160 | 160 | ||
| 161 | let op_res = op_res.map_err(SpiDeviceError::Spi)?; | 161 | op_res.map_err(SpiDeviceError::Spi)?; |
| 162 | flush_res.map_err(SpiDeviceError::Spi)?; | 162 | flush_res.map_err(SpiDeviceError::Spi)?; |
| 163 | cs_res.map_err(SpiDeviceError::Cs)?; | 163 | cs_res.map_err(SpiDeviceError::Cs)?; |
| 164 | Ok(op_res) | 164 | Ok(()) |
| 165 | }) | 165 | }) |
| 166 | } | 166 | } |
| 167 | } | 167 | } |
