aboutsummaryrefslogtreecommitdiff
path: root/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs
diff options
context:
space:
mode:
authorCaleb Jamison <[email protected]>2024-03-23 12:21:13 -0400
committerCaleb Jamison <[email protected]>2024-03-23 12:21:13 -0400
commit8f1bed3d956c1e2fae2ab11b292c8fe73c7b6a2b (patch)
tree2a06ac620dc9cda75b508450e00bf8c9fe0e0a37 /embassy-embedded-hal/src/shared_bus/asynch/i2c.rs
parent1171e116553f6ac43e12505b387b6eabe3037bf9 (diff)
Allow changing Spi/I2cDeviceWithConfig's config at runtime
Diffstat (limited to 'embassy-embedded-hal/src/shared_bus/asynch/i2c.rs')
-rw-r--r--embassy-embedded-hal/src/shared_bus/asynch/i2c.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs
index 779c04263..71ce09def 100644
--- a/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs
+++ b/embassy-embedded-hal/src/shared_bus/asynch/i2c.rs
@@ -106,6 +106,11 @@ impl<'a, M: RawMutex, BUS: SetConfig> I2cDeviceWithConfig<'a, M, BUS> {
106 pub fn new(bus: &'a Mutex<M, BUS>, config: BUS::Config) -> Self { 106 pub fn new(bus: &'a Mutex<M, BUS>, config: BUS::Config) -> Self {
107 Self { bus, config } 107 Self { bus, config }
108 } 108 }
109
110 /// Change the device's config at runtime
111 pub fn set_config(&mut self, config: BUS::Config) {
112 self.config = config;
113 }
109} 114}
110 115
111impl<'a, M, BUS> i2c::ErrorType for I2cDeviceWithConfig<'a, M, BUS> 116impl<'a, M, BUS> i2c::ErrorType for I2cDeviceWithConfig<'a, M, BUS>