File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ This changelog tracks the Rust `svdtools` project. See
5
5
6
6
## [ Unreleased]
7
7
8
+ * Allow to specify ` name ` for ` enumeratedValues `
9
+
8
10
## [ v0.3.9] 2024-01-19
9
11
10
12
* Use ` <details> ` instead of JavaScript in ` html ` template
Original file line number Diff line number Diff line change @@ -306,6 +306,8 @@ _rebase:
306
306
307
307
# A field in this register, matches an SVD <field> tag
308
308
FIELD :
309
+ # You can optionally specify name for `enumeratedValues`
310
+ _name : NAME
309
311
# By giving the field a dictionary we construct an enumerateValues
310
312
VARIANT : [VALUE, DESCRIPTION]
311
313
VARIANT : [VALUE, DESCRIPTION]
Original file line number Diff line number Diff line change @@ -742,7 +742,11 @@ impl RegisterExt for Register {
742
742
let ( min_offset, fname, min_offset_pos) =
743
743
offsets. iter ( ) . min_by_key ( |& on| on. 0 ) . unwrap ( ) ;
744
744
let min_pos = offsets. iter ( ) . map ( |on| on. 2 ) . min ( ) . unwrap ( ) ;
745
- let name = make_ev_name ( & fname. replace ( "%s" , "" ) , usage) ?;
745
+ let name = if let Some ( name) = fmod. get_str ( "_name" ) ? {
746
+ name. to_string ( )
747
+ } else {
748
+ make_ev_name ( & fname. replace ( "%s" , "" ) , usage) ?
749
+ } ;
746
750
for ftag in self . iter_fields ( fspec) {
747
751
let access = ftag. access . or ( reg_access) . unwrap_or_default ( ) ;
748
752
let checked_usage = check_usage ( access, usage)
You can’t perform that action at this time.
0 commit comments