From 5ad34404af9b7cfecfed5075d987c4c03ff2ca27 Mon Sep 17 00:00:00 2001 From: xoviat Date: Sun, 1 Oct 2023 09:37:20 -0500 Subject: eh: update set_config and add get_config --- embassy-embedded-hal/src/lib.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'embassy-embedded-hal/src/lib.rs') diff --git a/embassy-embedded-hal/src/lib.rs b/embassy-embedded-hal/src/lib.rs index 3aad838bd..8872b3d61 100644 --- a/embassy-embedded-hal/src/lib.rs +++ b/embassy-embedded-hal/src/lib.rs @@ -26,6 +26,18 @@ pub trait SetConfig { /// The configuration type used by this driver. type Config; + /// The error type that can occur if `set_config` fails. + type ConfigError; + /// Set the configuration of the driver. - fn set_config(&mut self, config: &Self::Config); + fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>; +} + +/// Get the configuration of a peripheral driver. +pub trait GetConfig { + /// The configuration type used by this driver. + type Config; + + /// Get the configuration of the driver. + fn get_config(&self) -> Self::Config; } -- cgit