Skip to content

UART DMA improvements and refactoring #328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ No changes.
### Changed

- The MSRV was bumped to 1.59 ([#340])
### Changed

- serial: The DMA functions `write_all` and `read_exact` now returns
the wrapper structs `SerialDmaTx` and `SerialDmaRx` instead of the direct
DMA transfer struct. These allow checking the USART ISR events
with `is_event_triggered` as well.

### Fixed

- serial: The previous DMA `write_all` implementation did use the DMA transfer completion
event to check for transfer completion, but MCU datasheet specifies that the TC
flag of the USART peripheral should be checked for transfer completion to avoid
corruption of the last transfer. This is now done by the new `SerialDmaTx` wrapper.

## Added

- serial: Public `is_event_triggered` method which allows to check for events
given an event and a USART reference.

## [v0.9.1] - 2022-09-07

Expand Down
5 changes: 5 additions & 0 deletions src/dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ impl<B, C: Channel, T: Target> Transfer<B, C, T> {

self.stop()
}

pub(crate) fn target(&self) -> &T {
let inner = crate::unwrap!(self.inner.as_ref());
&inner.target
}
}

impl<B, C: Channel, T: Target> Drop for Transfer<B, C, T> {
Expand Down
Loading