diff options
Diffstat (limited to 'embassy-embedded-hal/src/shared_bus/i2c.rs')
| -rw-r--r-- | embassy-embedded-hal/src/shared_bus/i2c.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/embassy-embedded-hal/src/shared_bus/i2c.rs b/embassy-embedded-hal/src/shared_bus/i2c.rs index 0e964773c..18f144531 100644 --- a/embassy-embedded-hal/src/shared_bus/i2c.rs +++ b/embassy-embedded-hal/src/shared_bus/i2c.rs | |||
| @@ -119,28 +119,30 @@ where | |||
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | pub struct I2cBusDeviceWithConfig<'a, M: RawMutex, BUS, C> { | 122 | pub struct I2cBusDeviceWithConfig<'a, M: RawMutex, BUS: SetConfig> { |
| 123 | bus: &'a Mutex<M, BUS>, | 123 | bus: &'a Mutex<M, BUS>, |
| 124 | config: C, | 124 | config: BUS::Config, |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | impl<'a, M: RawMutex, BUS, C> I2cBusDeviceWithConfig<'a, M, BUS, C> { | 127 | impl<'a, M: RawMutex, BUS: SetConfig> I2cBusDeviceWithConfig<'a, M, BUS> { |
| 128 | pub fn new(bus: &'a Mutex<M, BUS>, config: C) -> Self { | 128 | pub fn new(bus: &'a Mutex<M, BUS>, config: BUS::Config) -> Self { |
| 129 | Self { bus, config } | 129 | Self { bus, config } |
| 130 | } | 130 | } |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | impl<'a, M: RawMutex, BUS, C> i2c::ErrorType for I2cBusDeviceWithConfig<'a, M, BUS, C> | 133 | impl<'a, M, BUS> i2c::ErrorType for I2cBusDeviceWithConfig<'a, M, BUS> |
| 134 | where | 134 | where |
| 135 | BUS: i2c::ErrorType, | 135 | BUS: i2c::ErrorType, |
| 136 | M: RawMutex, | ||
| 137 | BUS: SetConfig, | ||
| 136 | { | 138 | { |
| 137 | type Error = I2cBusDeviceError<BUS::Error>; | 139 | type Error = I2cBusDeviceError<BUS::Error>; |
| 138 | } | 140 | } |
| 139 | 141 | ||
| 140 | impl<M, BUS, C> i2c::I2c for I2cBusDeviceWithConfig<'_, M, BUS, C> | 142 | impl<M, BUS> i2c::I2c for I2cBusDeviceWithConfig<'_, M, BUS> |
| 141 | where | 143 | where |
| 142 | M: RawMutex + 'static, | 144 | M: RawMutex + 'static, |
| 143 | BUS: i2c::I2c + SetConfig<C> + 'static, | 145 | BUS: i2c::I2c + SetConfig + 'static, |
| 144 | { | 146 | { |
| 145 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 147 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 146 | 148 | ||
