aboutsummaryrefslogtreecommitdiff
path: root/embassy-embedded-hal/src/shared_bus/blocking/i2c.rs
diff options
context:
space:
mode:
authorDion Dokter <[email protected]>2025-09-18 11:04:13 +0200
committerDion Dokter <[email protected]>2025-09-18 11:04:13 +0200
commit6c801a0dba93680c8e41e611eada0576eab0f861 (patch)
treeddeea826c566b63d2451403f9290d8b80e1c7574 /embassy-embedded-hal/src/shared_bus/blocking/i2c.rs
parent93b5f1ebe312bbfa0fc93deb2d6d00062cbddc95 (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.rs18
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
39impl<'a, M: RawMutex, BUS> Clone for I2cDevice<'a, M, BUS> {
40 fn clone(&self) -> Self {
41 Self { bus: self.bus }
42 }
43}
44
39impl<'a, M: RawMutex, BUS> ErrorType for I2cDevice<'a, M, BUS> 45impl<'a, M: RawMutex, BUS> ErrorType for I2cDevice<'a, M, BUS>
40where 46where
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
148impl<'a, M: RawMutex, BUS: SetConfig> Clone for I2cDeviceWithConfig<'a, M, BUS>
149where
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
142impl<'a, M, BUS> ErrorType for I2cDeviceWithConfig<'a, M, BUS> 160impl<'a, M, BUS> ErrorType for I2cDeviceWithConfig<'a, M, BUS>
143where 161where
144 M: RawMutex, 162 M: RawMutex,