Skip to content

Commit 26e0917

Browse files
authored
Shorten old buffer when we have extra characters in DMA buffer after 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
1 parent a1baa2f commit 26e0917

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6-
## [v0.7.0] - 2021-04-04
6+
7+
## [v0.7.1] - 2022-04-11
8+
9+
### Fixed
10+
11+
- Shorten old buffer when we have extra characters in DMA buffer after a character match.
12+
## [v0.7.0] - 2022-04-04
713

814
### Added
915

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "stm32l4xx-hal"
3-
version = "0.7.0"
3+
version = "0.7.1"
44
authors = ["Scott Mabin <[email protected]>"]
55
description = "Hardware abstraction layer for the stm32l4xx chips"
66
keywords = ["no-std", "stm32l4xx", "stm32l4", "embedded", "embedded-hal"]

src/dma.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,7 @@ macro_rules! dma {
848848

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

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

0 commit comments

Comments
 (0)