Skip to content

Commit

Permalink
Merge pull request #191 from kossnikita/modifiedWriteValues
Browse files Browse the repository at this point in the history
Add modifiedWriteValues patch
  • Loading branch information
burrbull authored Dec 18, 2023
2 parents 0da386b + b08ee9e commit 2cf9544
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This changelog tracks the Rust `svdtools` project. See

* Add `--enum_derive` flag
* Strip `alternateRegister` too
* Add `modifiedWriteValues` and `readAction` field patch (#156)

## [v0.3.6] 2023-11-01

Expand Down
11 changes: 9 additions & 2 deletions src/patch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ use svd_parser::svd::{
addressblock::AddressBlockBuilder, interrupt::InterruptBuilder, Access, AddressBlock,
AddressBlockUsage, ClusterInfo, ClusterInfoBuilder, Cpu, CpuBuilder, Endian, EnumeratedValue,
EnumeratedValues, EnumeratedValuesBuilder, FieldInfo, FieldInfoBuilder, Interrupt,
PeripheralInfo, PeripheralInfoBuilder, RegisterCluster, RegisterInfo, RegisterInfoBuilder,
RegisterProperties, Usage, ValidateLevel, WriteConstraint, WriteConstraintRange,
ModifiedWriteValues, PeripheralInfo, PeripheralInfoBuilder, ReadAction, RegisterCluster,
RegisterInfo, RegisterInfoBuilder, RegisterProperties, Usage, ValidateLevel, WriteConstraint,
WriteConstraintRange,
};
use svd_parser::SVDError::DimIndexParse;
use svd_rs::{DimElement, DimElementBuilder, MaybeArray};
Expand Down Expand Up @@ -430,6 +431,12 @@ fn make_field(fadd: &Hash) -> Result<FieldInfoBuilder> {
if let Some(width) = fadd.get_i64("bitWidth")? {
fnew = fnew.bit_width(width as u32)
}
if let Some(modified_write_values) = fadd.get_str("modifiedWriteValues")? {
fnew = fnew.modified_write_values(ModifiedWriteValues::parse_str(modified_write_values))
}
if let Some(read_action) = fadd.get_str("readAction")? {
fnew = fnew.read_action(ReadAction::parse_str(read_action))
}

Ok(fnew)
}
Expand Down

0 comments on commit 2cf9544

Please sign in to comment.