aboutsummaryrefslogtreecommitdiff
path: root/embassy-embedded-hal/src/shared_bus/mod.rs
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-10-01 09:37:20 -0500
committerxoviat <[email protected]>2023-10-01 09:37:20 -0500
commit5ad34404af9b7cfecfed5075d987c4c03ff2ca27 (patch)
tree72f07beb474ef99a94408aba6b9c0362aa454889 /embassy-embedded-hal/src/shared_bus/mod.rs
parenta7b1e516504bb0df9f7af42361e4280adcc30417 (diff)
eh: update set_config and add get_config
Diffstat (limited to 'embassy-embedded-hal/src/shared_bus/mod.rs')
-rw-r--r--embassy-embedded-hal/src/shared_bus/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/embassy-embedded-hal/src/shared_bus/mod.rs b/embassy-embedded-hal/src/shared_bus/mod.rs
index 79a90bd52..b0159ac09 100644
--- a/embassy-embedded-hal/src/shared_bus/mod.rs
+++ b/embassy-embedded-hal/src/shared_bus/mod.rs
@@ -14,6 +14,8 @@ pub mod blocking;
14pub enum I2cDeviceError<BUS> { 14pub enum I2cDeviceError<BUS> {
15 /// An operation on the inner I2C bus failed. 15 /// An operation on the inner I2C bus failed.
16 I2c(BUS), 16 I2c(BUS),
17 /// Configuration of the inner I2C bus failed.
18 Config,
17} 19}
18 20
19impl<BUS> i2c::Error for I2cDeviceError<BUS> 21impl<BUS> i2c::Error for I2cDeviceError<BUS>
@@ -23,6 +25,7 @@ where
23 fn kind(&self) -> i2c::ErrorKind { 25 fn kind(&self) -> i2c::ErrorKind {
24 match self { 26 match self {
25 Self::I2c(e) => e.kind(), 27 Self::I2c(e) => e.kind(),
28 Self::Config => i2c::ErrorKind::Other,
26 } 29 }
27 } 30 }
28} 31}
@@ -38,6 +41,8 @@ pub enum SpiDeviceError<BUS, CS> {
38 Cs(CS), 41 Cs(CS),
39 /// DelayUs operations are not supported when the `time` Cargo feature is not enabled. 42 /// DelayUs operations are not supported when the `time` Cargo feature is not enabled.
40 DelayUsNotSupported, 43 DelayUsNotSupported,
44 /// The SPI bus could not be configured.
45 Config,
41} 46}
42 47
43impl<BUS, CS> spi::Error for SpiDeviceError<BUS, CS> 48impl<BUS, CS> spi::Error for SpiDeviceError<BUS, CS>
@@ -50,6 +55,7 @@ where
50 Self::Spi(e) => e.kind(), 55 Self::Spi(e) => e.kind(),
51 Self::Cs(_) => spi::ErrorKind::Other, 56 Self::Cs(_) => spi::ErrorKind::Other,
52 Self::DelayUsNotSupported => spi::ErrorKind::Other, 57 Self::DelayUsNotSupported => spi::ErrorKind::Other,
58 Self::Config => spi::ErrorKind::Other,
53 } 59 }
54 } 60 }
55} 61}