Skip to content

Commit 64530cb

Browse files
bors[bot]burrbull
andauthored
Merge #590
590: 1-element array r=therealprof a=burrbull Co-authored-by: Andrey Zgarbul <[email protected]>
2 parents a5f8239 + 6962220 commit 64530cb

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
## [v0.22.2] - 2022-04-13
11+
12+
- Fix #579 2: support 1-element arrays
13+
1014
## [v0.22.1] - 2022-04-05
1115

1216
- Fix #579
@@ -677,7 +681,8 @@ peripheral.register.write(|w| w.field().set());
677681

678682
- Initial version of the `svd2rust` tool
679683

680-
[Unreleased]: https://github.com/rust-embedded/svd2rust/compare/v0.22.1...HEAD
684+
[Unreleased]: https://github.com/rust-embedded/svd2rust/compare/v0.22.2...HEAD
685+
[v0.22.2]: https://github.com/rust-embedded/svd2rust/compare/v0.22.1...v0.22.2
681686
[v0.22.1]: https://github.com/rust-embedded/svd2rust/compare/v0.22.0...v0.22.1
682687
[v0.22.0]: https://github.com/rust-embedded/svd2rust/compare/v0.21.0...v0.22.0
683688
[v0.21.0]: https://github.com/rust-embedded/svd2rust/compare/v0.20.0...v0.21.0

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ keywords = [
2323
license = "MIT OR Apache-2.0"
2424
name = "svd2rust"
2525
repository = "https://github.com/rust-embedded/svd2rust/"
26-
version = "0.22.1"
26+
version = "0.22.2"
2727
readme = "README.md"
2828

2929
[package.metadata.deb]

src/generate/peripheral.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,8 @@ fn expand_cluster(
713713
accessors: None,
714714
}),
715715
Cluster::Array(info, array_info) => {
716-
let sequential_addresses = cluster_size == array_info.dim_increment * BITS_PER_BYTE;
716+
let sequential_addresses =
717+
(array_info.dim == 1) || (cluster_size == array_info.dim_increment * BITS_PER_BYTE);
717718

718719
// if dimIndex exists, test if it is a sequence of numbers from 0 to dim
719720
let sequential_indexes = array_info.dim_index.as_ref().map_or(true, |dim_index| {
@@ -823,7 +824,8 @@ fn expand_register(
823824
accessors: None,
824825
}),
825826
Register::Array(info, array_info) => {
826-
let sequential_addresses = register_size == array_info.dim_increment * BITS_PER_BYTE;
827+
let sequential_addresses = (array_info.dim == 1)
828+
|| (register_size == array_info.dim_increment * BITS_PER_BYTE);
827829

828830
// if dimIndex exists, test if it is a sequence of numbers from 0 to dim
829831
let sequential_indexes = array_info.dim_index.as_ref().map_or(true, |dim_index| {

0 commit comments

Comments
 (0)