stm32: fix setting uart databits
This commit is contained in:
parent
591612db7e
commit
188ee59ba6
@ -910,6 +910,11 @@ fn configure(
|
|||||||
brr + rounding
|
brr + rounding
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UART must be disabled during configuration.
|
||||||
|
r.cr1().modify(|w| {
|
||||||
|
w.set_ue(false);
|
||||||
|
});
|
||||||
|
|
||||||
#[cfg(not(usart_v1))]
|
#[cfg(not(usart_v1))]
|
||||||
let mut over8 = false;
|
let mut over8 = false;
|
||||||
let mut found_brr = None;
|
let mut found_brr = None;
|
||||||
@ -977,10 +982,9 @@ fn configure(
|
|||||||
// enable receiver
|
// enable receiver
|
||||||
w.set_re(enable_rx);
|
w.set_re(enable_rx);
|
||||||
// configure word size
|
// configure word size
|
||||||
w.set_m0(if config.parity != Parity::ParityNone {
|
w.set_m0(match config.data_bits {
|
||||||
vals::M0::BIT9
|
DataBits::DataBits8 => vals::M0::BIT8,
|
||||||
} else {
|
DataBits::DataBits9 => vals::M0::BIT9,
|
||||||
vals::M0::BIT8
|
|
||||||
});
|
});
|
||||||
// configure parity
|
// configure parity
|
||||||
w.set_pce(config.parity != Parity::ParityNone);
|
w.set_pce(config.parity != Parity::ParityNone);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user