mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-26 20:00:27 +00:00
Add clone impl on shared i2c
This commit is contained in:
parent
93b5f1ebe3
commit
6c801a0dba
@ -41,6 +41,12 @@ impl<'a, M: RawMutex, BUS> I2cDevice<'a, M, BUS> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M: RawMutex, BUS> Clone for I2cDevice<'a, M, BUS> {
|
||||
fn clone(&self) -> Self {
|
||||
Self { bus: self.bus }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M: RawMutex, BUS> i2c::ErrorType for I2cDevice<'a, M, BUS>
|
||||
where
|
||||
BUS: i2c::ErrorType,
|
||||
@ -113,6 +119,18 @@ impl<'a, M: RawMutex, BUS: SetConfig> I2cDeviceWithConfig<'a, M, BUS> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M: RawMutex, BUS: SetConfig> Clone for I2cDeviceWithConfig<'a, M, BUS>
|
||||
where
|
||||
BUS::Config: Clone,
|
||||
{
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
bus: self.bus,
|
||||
config: self.config.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M, BUS> i2c::ErrorType for I2cDeviceWithConfig<'a, M, BUS>
|
||||
where
|
||||
BUS: i2c::ErrorType,
|
||||
|
@ -36,6 +36,12 @@ impl<'a, M: RawMutex, BUS> I2cDevice<'a, M, BUS> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M: RawMutex, BUS> Clone for I2cDevice<'a, M, BUS> {
|
||||
fn clone(&self) -> Self {
|
||||
Self { bus: self.bus }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M: RawMutex, BUS> ErrorType for I2cDevice<'a, M, BUS>
|
||||
where
|
||||
BUS: ErrorType,
|
||||
@ -139,6 +145,18 @@ impl<'a, M: RawMutex, BUS: SetConfig> I2cDeviceWithConfig<'a, M, BUS> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M: RawMutex, BUS: SetConfig> Clone for I2cDeviceWithConfig<'a, M, BUS>
|
||||
where
|
||||
BUS::Config: Clone,
|
||||
{
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
bus: self.bus,
|
||||
config: self.config.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, M, BUS> ErrorType for I2cDeviceWithConfig<'a, M, BUS>
|
||||
where
|
||||
M: RawMutex,
|
||||
|
Loading…
x
Reference in New Issue
Block a user