mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 16:23:10 +00:00
stm32: fix set_config for buffered uart
In reconfigure() cr1 register is initialised with write (not modify) which means rxneie and idleneie are disabled after reconfiguration.
This commit is contained in:
parent
188ee59ba6
commit
7f72dbdaf2
@ -233,7 +233,7 @@ impl<'d, T: BasicInstance> BufferedUart<'d, T> {
|
||||
configure(r, &config, T::frequency(), T::KIND, true, true)?;
|
||||
|
||||
r.cr1().modify(|w| {
|
||||
#[cfg(lpuart_v2)]
|
||||
#[cfg(usart_v4)]
|
||||
w.set_fifoen(true);
|
||||
|
||||
w.set_rxneie(true);
|
||||
@ -254,7 +254,17 @@ impl<'d, T: BasicInstance> BufferedUart<'d, T> {
|
||||
}
|
||||
|
||||
pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
|
||||
reconfigure::<T>(config)
|
||||
reconfigure::<T>(config)?;
|
||||
|
||||
T::regs().cr1().modify(|w| {
|
||||
#[cfg(usart_v4)]
|
||||
w.set_fifoen(true);
|
||||
|
||||
w.set_rxneie(true);
|
||||
w.set_idleie(true);
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,7 +344,17 @@ impl<'d, T: BasicInstance> BufferedUartRx<'d, T> {
|
||||
}
|
||||
|
||||
pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
|
||||
reconfigure::<T>(config)
|
||||
reconfigure::<T>(config)?;
|
||||
|
||||
T::regs().cr1().modify(|w| {
|
||||
#[cfg(usart_v4)]
|
||||
w.set_fifoen(true);
|
||||
|
||||
w.set_rxneie(true);
|
||||
w.set_idleie(true);
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,7 +428,17 @@ impl<'d, T: BasicInstance> BufferedUartTx<'d, T> {
|
||||
}
|
||||
|
||||
pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
|
||||
reconfigure::<T>(config)
|
||||
reconfigure::<T>(config)?;
|
||||
|
||||
T::regs().cr1().modify(|w| {
|
||||
#[cfg(usart_v4)]
|
||||
w.set_fifoen(true);
|
||||
|
||||
w.set_rxneie(true);
|
||||
w.set_idleie(true);
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user