Skip to content
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

Add DMA channel NDTR getter function #327

Open
wants to merge 3 commits 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

No changes.
- dma: Added `get_remaining_transfer_len` for the `Channel` trait
to read the NDTR register.

## [v0.10.0] - 2023-11-30

Expand Down
10 changes: 10 additions & 0 deletions src/dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,16 @@ pub trait Channel: private::Channel {
self.ch().ndtr.write(|w| w.ndt().bits(len));
}

/// Get the content of the number of data (NDTR) register
///
/// If the DMA has not been enabled yet, this will be the value which
/// was set with [`set_transfer_length`]. If the DMA is active, the value
/// indicates the number of remaining bytes to be transmitted. This value
/// is decremented by the hardware after each DMA transfer.
fn get_remaining_transfer_len(&self) -> u16 {
self.ch().ndtr.read().ndt().bits()
}

/// Set the word size.
///
/// # Panics
Expand Down
Loading