File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ This changelog tracks the Rust `svdtools` project. See
77
88* Add ` _expand_array `
99* Allow register arrays in ` collect_in_cluster `
10+ * Custom ` dimIncrement ` for 1-element ` cluster ` or ` array `
1011
1112## [ v0.3.10] 2024-02-26
1213
Original file line number Diff line number Diff line change @@ -1249,11 +1249,13 @@ fn collect_in_array(
12491249 let dim_increment = if dim > 1 {
12501250 offsets[ 1 ] - offsets[ 0 ]
12511251 } else {
1252- registers[ 0 ]
1253- . properties
1254- . size
1255- . map ( |s| s / 8 )
1256- . unwrap_or_default ( )
1252+ rmod. get_u32 ( "dimIncrement" ) ?. unwrap_or_else ( || {
1253+ registers[ 0 ]
1254+ . properties
1255+ . size
1256+ . map ( |s| s / 8 )
1257+ . unwrap_or_default ( )
1258+ } )
12571259 } ;
12581260 if !check_offsets ( & offsets, dim_increment) {
12591261 return Err ( anyhow ! (
@@ -1359,15 +1361,15 @@ fn collect_in_cluster(
13591361 let mut first = None ;
13601362 let mut dim = 0 ;
13611363 let mut dim_index = Vec :: new ( ) ;
1362- let mut dim_increment = 0 ;
1364+ let mut dim_increment = cmod . get_u32 ( "dimIncrement" ) ? . unwrap_or ( 0 ) ;
13631365 let mut offsets = Vec :: new ( ) ;
13641366 let mut place = usize:: MAX ;
13651367 let mut rspecs = Vec :: new ( ) ;
13661368 let single = !cname. contains ( "%s" ) ;
13671369
13681370 for ( rspec, rmod) in cmod {
13691371 let rspec = rspec. str ( ) ?;
1370- if rspec == "description" {
1372+ if rspec == "description" || rspec == "dimIncrement" {
13711373 continue ;
13721374 }
13731375 let mut registers = Vec :: new ( ) ;
You can’t perform that action at this time.
0 commit comments