Skip to content

Commit 21b6ad3

Browse files
committed
Add idle line event to serial
1 parent 69faaba commit 21b6ad3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/serial.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ pub enum Event {
2222
Rxne,
2323
/// New data can be sent
2424
Txe,
25+
/// The line has gone idle
26+
Idle
2527
}
2628

2729
/// Serial error
@@ -128,6 +130,9 @@ macro_rules! hal {
128130
Event::Txe => {
129131
self.usart.cr1.modify(|_, w| w.txeie().set_bit())
130132
},
133+
Event::Idle => {
134+
self.usart.cr1.modify(|_, w| w.idleie().set_bit())
135+
},
131136
}
132137
}
133138

@@ -140,6 +145,9 @@ macro_rules! hal {
140145
Event::Txe => {
141146
self.usart.cr1.modify(|_, w| w.txeie().clear_bit())
142147
},
148+
Event::Idle => {
149+
self.usart.cr1.modify(|_, w| w.idleie().clear_bit())
150+
},
143151
}
144152
}
145153

0 commit comments

Comments
 (0)