Skip to content

Commit

Permalink
Merge #342
Browse files Browse the repository at this point in the history
342: Add serial port Idle interrupt r=burrbull a=gqf2008

Add serial port Idle interrupt.


Co-authored-by: 高庆丰 <gao.qingfeng@gmail.com>
  • Loading branch information
bors[bot] and gqf2008 authored Jul 14, 2021
2 parents c756888 + 7176f6f commit 01942ff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ pub enum Event {
Rxne,
/// New data can be sent
Txe,
/// Idle line state detected
Idle,
}

/// Serial error
Expand Down Expand Up @@ -358,6 +360,7 @@ macro_rules! hal {
match event {
Event::Rxne => self.usart.cr1.modify(|_, w| w.rxneie().set_bit()),
Event::Txe => self.usart.cr1.modify(|_, w| w.txeie().set_bit()),
Event::Idle => self.usart.cr1.modify(|_, w| w.idleie().set_bit()),
}
}

Expand All @@ -368,6 +371,7 @@ macro_rules! hal {
match event {
Event::Rxne => self.usart.cr1.modify(|_, w| w.rxneie().clear_bit()),
Event::Txe => self.usart.cr1.modify(|_, w| w.txeie().clear_bit()),
Event::Idle => self.usart.cr1.modify(|_, w| w.idleie().clear_bit()),
}
}

Expand Down

0 comments on commit 01942ff

Please sign in to comment.