Skip to content

Commit

Permalink
Shorten old buffer when we have extra characters in DMA buffer after …
Browse files Browse the repository at this point in the history
…a character match (#306)

* Shorten old_buf when we have leftover characters in DMA buffer after a character match, as to not receive duplicate characters

* Bump version & add changelog entry
  • Loading branch information
MathiasKoch authored Apr 11, 2022
1 parent a1baa2f commit 26e0917
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [v0.7.0] - 2021-04-04

## [v0.7.1] - 2022-04-11

### Fixed

- Shorten old buffer when we have extra characters in DMA buffer after a character match.
## [v0.7.0] - 2022-04-04

### Added

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stm32l4xx-hal"
version = "0.7.0"
version = "0.7.1"
authors = ["Scott Mabin <[email protected]>"]
description = "Hardware abstraction layer for the stm32l4xx chips"
keywords = ["no-std", "stm32l4xx", "stm32l4", "embedded", "embedded-hal"]
Expand Down
1 change: 1 addition & 0 deletions src/dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ macro_rules! dma {

self.payload.channel.set_memory_address(unsafe { new_buf.buffer_as_ptr().add(diff) } as u32, true);
self.payload.channel.set_transfer_length((new_buf.max_len() - diff) as u16);
unsafe { old_buf.set_len(got_data_len - diff) };
let received_buffer = core::mem::replace(&mut self.buffer, next_frame);

// NOTE(compiler_fence) operations on `buffer` should not be reordered after
Expand Down

0 comments on commit 26e0917

Please sign in to comment.