diff options
| author | Dion Dokter <[email protected]> | 2025-09-18 11:04:13 +0200 |
|---|---|---|
| committer | Dion Dokter <[email protected]> | 2025-09-18 11:04:13 +0200 |
| commit | 6c801a0dba93680c8e41e611eada0576eab0f861 (patch) | |
| tree | ddeea826c566b63d2451403f9290d8b80e1c7574 /embassy-embedded-hal/src/shared_bus/blocking/i2c.rs | |
| parent | 93b5f1ebe312bbfa0fc93deb2d6d00062cbddc95 (diff) | |
Add clone impl on shared i2c
Diffstat (limited to 'embassy-embedded-hal/src/shared_bus/blocking/i2c.rs')
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/blocking/i2c.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs index 627767c8a..fa34cd416 100644 --- a/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs +++ b/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs | |||
| @@ -36,6 +36,12 @@ impl<'a, M: RawMutex, BUS> I2cDevice<'a, M, BUS> { | |||
| 36 | } | 36 | } |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | impl<'a, M: RawMutex, BUS> Clone for I2cDevice<'a, M, BUS> { | ||
| 40 | fn clone(&self) -> Self { | ||
| 41 | Self { bus: self.bus } | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 39 | impl<'a, M: RawMutex, BUS> ErrorType for I2cDevice<'a, M, BUS> | 45 | impl<'a, M: RawMutex, BUS> ErrorType for I2cDevice<'a, M, BUS> |
| 40 | where | 46 | where |
| 41 | BUS: ErrorType, | 47 | BUS: ErrorType, |
| @@ -139,6 +145,18 @@ impl<'a, M: RawMutex, BUS: SetConfig> I2cDeviceWithConfig<'a, M, BUS> { | |||
| 139 | } | 145 | } |
| 140 | } | 146 | } |
| 141 | 147 | ||
| 148 | impl<'a, M: RawMutex, BUS: SetConfig> Clone for I2cDeviceWithConfig<'a, M, BUS> | ||
| 149 | where | ||
| 150 | BUS::Config: Clone, | ||
| 151 | { | ||
| 152 | fn clone(&self) -> Self { | ||
| 153 | Self { | ||
| 154 | bus: self.bus, | ||
| 155 | config: self.config.clone(), | ||
| 156 | } | ||
| 157 | } | ||
| 158 | } | ||
| 159 | |||
| 142 | impl<'a, M, BUS> ErrorType for I2cDeviceWithConfig<'a, M, BUS> | 160 | impl<'a, M, BUS> ErrorType for I2cDeviceWithConfig<'a, M, BUS> |
| 143 | where | 161 | where |
| 144 | M: RawMutex, | 162 | M: RawMutex, |
