Skip to content

Commit f99550d

Browse files
authored
generic: uart: Fix DataRegisterEmpty and add TxComplete irq
1 parent 0258ed5 commit f99550d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

avr-hal-generic/src/usart.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ pub enum Event {
150150
/// your MCU for details.
151151
RxComplete,
152152

153+
/// A compete byte was sent.
154+
///
155+
/// Corresponds to the `USART_TX` or `USART#_TX` interrupt. Please refer to the datasheet for
156+
/// your MCU for details.
157+
TxComplete,
158+
153159
/// All data from the USART data register was transmitted.
154160
///
155161
/// Corresponds to the `USART_UDRE` or `USART#_UDRE` interrupt. Please refer to the datasheet
@@ -531,8 +537,10 @@ macro_rules! impl_usart_traditional {
531537
match event {
532538
$crate::usart::Event::RxComplete =>
533539
self.[<ucsr $n b>].modify(|_, w| w.[<rxcie $n>]().bit(state)),
534-
$crate::usart::Event::DataRegisterEmpty =>
540+
$crate::usart::Event::TxComplete =>
535541
self.[<ucsr $n b>].modify(|_, w| w.[<txcie $n>]().bit(state)),
542+
$crate::usart::Event::DataRegisterEmpty =>
543+
self.[<ucsr $n b>].modify(|_, w| w.[<udrie $n>]().bit(state)),
536544
}
537545
}
538546
}

0 commit comments

Comments
 (0)