mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
stm32/usart: sending break character
This commit is contained in:
parent
1ff1f00d5a
commit
bea1f34440
@ -520,6 +520,21 @@ impl<'d, M: Mode> UartTx<'d, M> {
|
||||
pub fn blocking_flush(&mut self) -> Result<(), Error> {
|
||||
blocking_flush(self.info)
|
||||
}
|
||||
|
||||
/// Send break character
|
||||
pub fn send_break(&self) {
|
||||
// Busy wait until previous break has been sent
|
||||
#[cfg(any(usart_v1, usart_v2))]
|
||||
while self.info.regs.cr1().read().sbk() {}
|
||||
#[cfg(any(usart_v3, usart_v4))]
|
||||
while self.info.regs.isr().read().sbkf() {}
|
||||
|
||||
// Send break right after completing the current character transmission
|
||||
#[cfg(any(usart_v1, usart_v2))]
|
||||
self.info.regs.cr1().modify(|w| w.set_sbk(true));
|
||||
#[cfg(any(usart_v3, usart_v4))]
|
||||
self.info.regs.rqr().write(|w| w.set_sbkrq(true));
|
||||
}
|
||||
}
|
||||
|
||||
fn blocking_flush(info: &Info) -> Result<(), Error> {
|
||||
@ -1365,6 +1380,11 @@ impl<'d, M: Mode> Uart<'d, M> {
|
||||
pub fn split(self) -> (UartTx<'d, M>, UartRx<'d, M>) {
|
||||
(self.tx, self.rx)
|
||||
}
|
||||
|
||||
/// Send break character
|
||||
pub fn send_break(&self) {
|
||||
self.tx.send_break();
|
||||
}
|
||||
}
|
||||
|
||||
fn reconfigure(info: &Info, kernel_clock: Hertz, config: &Config) -> Result<(), ConfigError> {
|
||||
|
Loading…
Reference in New Issue
Block a user