Skip to content

Commit 8296969

Browse files
committed
offer clear_idle_interrupt from serial::Rx in DMA Transfer
currently, if DMA is used for a `Serial` connection, it is not possible to clear the idle interrupt without manually copying the implementation of the `Rx::clear_idle_interrupt` method. with this, a consumer can now properly call the method directly on the `Transfer`. this solves #550
1 parent 2a3f51b commit 8296969

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
5454
- Added rtic-usart-shell example [#551]
5555
- Added rtic-usart-shell-ssd1306 example [#551]
5656
- Added rtic-usb-cdc-echo example [#553]
57+
- Add possibility to clear a Serial `Rx` idle interrupt from a DMA `Transfer` [#556]
5758

5859

5960
[#481]: https://github.com/stm32-rs/stm32f4xx-hal/pull/481
@@ -79,6 +80,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7980
[#553]: https://github.com/stm32-rs/stm32f4xx-hal/pull/553
8081
[#554]: https://github.com/stm32-rs/stm32f4xx-hal/pull/554
8182
[#555]: https://github.com/stm32-rs/stm32f4xx-hal/pull/555
83+
[#556]: https://github.com/stm32-rs/stm32f4xx-hal/pull/556
8284

8385
## [v0.13.2] - 2022-05-16
8486

src/dma/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::pac::RCC;
2121
use crate::{pac, rcc};
2222

2323
pub mod traits;
24+
use crate::serial::RxISR;
2425
use traits::{
2526
sealed::{Bits, Sealed},
2627
Channel, DMASet, Direction, Instance, PeriAddress, SafePeripheralRead, Stream, StreamISR,
@@ -1014,6 +1015,20 @@ where
10141015
}
10151016
}
10161017

1018+
impl<STREAM, const CHANNEL: u8, PERIPHERAL, BUF>
1019+
Transfer<STREAM, CHANNEL, PERIPHERAL, PeripheralToMemory, BUF>
1020+
where
1021+
STREAM: Stream,
1022+
ChannelX<CHANNEL>: Channel,
1023+
PERIPHERAL: PeriAddress + DMASet<STREAM, CHANNEL, PeripheralToMemory> + RxISR,
1024+
BUF: ReadBuffer<Word = <PERIPHERAL as PeriAddress>::MemSize>,
1025+
{
1026+
/// Clear idle line interrupt flag
1027+
pub fn clear_idle_interrupt(&self) {
1028+
self.peripheral.clear_idle_interrupt();
1029+
}
1030+
}
1031+
10171032
impl<STREAM, const CHANNEL: u8, PERIPHERAL, BUF>
10181033
Transfer<STREAM, CHANNEL, PERIPHERAL, PeripheralToMemory, BUF>
10191034
where

0 commit comments

Comments
 (0)