Merge pull request #2051 from MabezDev/stm32/set_config-concrete

make set_config concrete methods public again
This commit is contained in:
Dario Nieuwenhuis 2023-10-12 22:06:29 +00:00 committed by GitHub
commit 75baf186f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 10 deletions

View File

@ -322,7 +322,7 @@ impl<'d, T: Instance, Tx, Rx> Spi<'d, T, Tx, Rx> {
} }
/// Reconfigures it with the supplied config. /// Reconfigures it with the supplied config.
fn set_config(&mut self, config: Config) { pub fn set_config(&mut self, config: &Config) -> Result<(), ()> {
let cpha = config.raw_phase(); let cpha = config.raw_phase();
let cpol = config.raw_polarity(); let cpol = config.raw_polarity();
@ -351,6 +351,7 @@ impl<'d, T: Instance, Tx, Rx> Spi<'d, T, Tx, Rx> {
w.set_mbr(br); w.set_mbr(br);
}); });
} }
Ok(())
} }
pub fn get_current_config(&self) -> Config { pub fn get_current_config(&self) -> Config {
@ -1062,8 +1063,6 @@ impl<'d, T: Instance, Tx, Rx> SetConfig for Spi<'d, T, Tx, Rx> {
type Config = Config; type Config = Config;
type ConfigError = (); type ConfigError = ();
fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> { fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> {
self.set_config(*config); self.set_config(config)
Ok(())
} }
} }

View File

@ -253,7 +253,7 @@ impl<'d, T: BasicInstance> BufferedUart<'d, T> {
(self.tx, self.rx) (self.tx, self.rx)
} }
fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> { pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
reconfigure::<T>(config) reconfigure::<T>(config)
} }
} }
@ -333,7 +333,7 @@ impl<'d, T: BasicInstance> BufferedUartRx<'d, T> {
} }
} }
fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> { pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
reconfigure::<T>(config) reconfigure::<T>(config)
} }
} }
@ -407,7 +407,7 @@ impl<'d, T: BasicInstance> BufferedUartTx<'d, T> {
} }
} }
fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> { pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
reconfigure::<T>(config) reconfigure::<T>(config)
} }
} }

View File

@ -274,7 +274,7 @@ impl<'d, T: BasicInstance, TxDma> UartTx<'d, T, TxDma> {
}) })
} }
fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> { pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
reconfigure::<T>(config) reconfigure::<T>(config)
} }
@ -373,7 +373,7 @@ impl<'d, T: BasicInstance, RxDma> UartRx<'d, T, RxDma> {
}) })
} }
fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> { pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
reconfigure::<T>(config) reconfigure::<T>(config)
} }

View File

@ -64,7 +64,7 @@ impl<'d, T: BasicInstance, RxDma: super::RxDma<T>> RingBufferedUartRx<'d, T, RxD
Err(err) Err(err)
} }
fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> { pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
self.teardown_uart(); self.teardown_uart();
reconfigure::<T>(config) reconfigure::<T>(config)
} }