summaryrefslogtreecommitdiff
path: root/embassy-embedded-hal/src/shared_bus/i2c.rs
diff options
context:
space:
mode:
authorHenrik Alsér <henrik@mindbite.se>2022-07-09 00:00:55 +0200
committerHenrik Alsér <henrik@mindbite.se>2022-07-09 00:00:55 +0200
commitd637510b44ec8e58581f3e22f8398b53145503dc (patch)
treeb1a062c6b032947323248c6945fee87110bfc10d /embassy-embedded-hal/src/shared_bus/i2c.rs
parent15384d27bb181bf48e580ca4a1c4fd848ecb1720 (diff)
downloadembassy-d637510b44ec8e58581f3e22f8398b53145503dc.zip
Associated type
Diffstat (limited to 'embassy-embedded-hal/src/shared_bus/i2c.rs')
-rw-r--r--embassy-embedded-hal/src/shared_bus/i2c.rs16
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 0e964773..18f14453 100644
--- a/embassy-embedded-hal/src/shared_bus/i2c.rs
+++ b/embassy-embedded-hal/src/shared_bus/i2c.rs
@@ -119,28 +119,30 @@ where
}
}
-pub struct I2cBusDeviceWithConfig<'a, M: RawMutex, BUS, C> {
+pub struct I2cBusDeviceWithConfig<'a, M: RawMutex, BUS: SetConfig> {
bus: &'a Mutex<M, BUS>,
- config: C,
+ config: BUS::Config,
}
-impl<'a, M: RawMutex, BUS, C> I2cBusDeviceWithConfig<'a, M, BUS, C> {
- pub fn new(bus: &'a Mutex<M, BUS>, config: C) -> Self {
+impl<'a, M: RawMutex, BUS: SetConfig> I2cBusDeviceWithConfig<'a, M, BUS> {
+ pub fn new(bus: &'a Mutex<M, BUS>, config: BUS::Config) -> Self {
Self { bus, config }
}
}
-impl<'a, M: RawMutex, BUS, C> i2c::ErrorType for I2cBusDeviceWithConfig<'a, M, BUS, C>
+impl<'a, M, BUS> i2c::ErrorType for I2cBusDeviceWithConfig<'a, M, BUS>
where
BUS: i2c::ErrorType,
+ M: RawMutex,
+ BUS: SetConfig,
{
type Error = I2cBusDeviceError<BUS::Error>;
}
-impl<M, BUS, C> i2c::I2c for I2cBusDeviceWithConfig<'_, M, BUS, C>
+impl<M, BUS> i2c::I2c for I2cBusDeviceWithConfig<'_, M, BUS>
where
M: RawMutex + 'static,
- BUS: i2c::I2c + SetConfig<C> + 'static,
+ BUS: i2c::I2c + SetConfig + 'static,
{
type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;