Skip to content

Commit 93c41f7

Browse files
committed
iter registers always 1-depth
1 parent 6540ba0 commit 93c41f7

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/patch/peripheral.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use super::{
1414
};
1515
use super::{make_cluster, make_interrupt, make_register};
1616

17-
use svd::registercluster::{AllRegistersIterMut, ClusterIterMut};
17+
use svd::registercluster::{ClusterIterMut, RegisterIterMut};
1818
pub type ClusterMatchIterMut<'a, 'b> = MatchIter<'b, ClusterIterMut<'a>>;
19-
pub type RegMatchIterMut<'a, 'b> = MatchIter<'b, AllRegistersIterMut<'a>>;
19+
pub type RegMatchIterMut<'a, 'b> = MatchIter<'b, RegisterIterMut<'a>>;
2020

2121
/// Collecting methods for processing peripheral contents
2222
pub trait PeripheralExt: InterruptExt + RegisterBlockExt {
@@ -403,7 +403,7 @@ impl InterruptExt for Peripheral {
403403

404404
impl RegisterBlockExt for Peripheral {
405405
fn iter_registers<'a, 'b>(&'a mut self, spec: &'b str) -> RegMatchIterMut<'a, 'b> {
406-
self.all_registers_mut().matched(spec)
406+
self.registers_mut().matched(spec)
407407
}
408408

409409
fn iter_clusters<'a, 'b>(&'a mut self, spec: &'b str) -> ClusterMatchIterMut<'a, 'b> {
@@ -515,7 +515,7 @@ impl RegisterBlockExt for Peripheral {
515515
})?;
516516

517517
let mut source = self
518-
.all_registers()
518+
.registers()
519519
.find(|r| r.name == srcname)
520520
.ok_or_else(|| anyhow!("peripheral {} does not have register {srcname}", self.name))?
521521
.clone();
@@ -524,7 +524,7 @@ impl RegisterBlockExt for Peripheral {
524524
.display_name(Some("".into()));
525525
// Modifying fields in derived register not implemented
526526
source.modify_from(fixes, VAL_LVL)?;
527-
if let Some(ptag) = self.all_registers_mut().find(|r| r.name == rname) {
527+
if let Some(ptag) = self.registers_mut().find(|r| r.name == rname) {
528528
source.address_offset = ptag.address_offset;
529529
*ptag = source;
530530
} else {
@@ -574,7 +574,7 @@ impl RegisterBlockExt for Peripheral {
574574
fn strip_start(&mut self, prefix: &str) -> PatchResult {
575575
let len = prefix.len();
576576
let glob = globset::Glob::new(&(prefix.to_string() + "*"))?.compile_matcher();
577-
for rtag in self.all_registers_mut() {
577+
for rtag in self.registers_mut() {
578578
if glob.is_match(&rtag.name) {
579579
rtag.name.drain(..len);
580580
}
@@ -592,7 +592,7 @@ impl RegisterBlockExt for Peripheral {
592592
let glob = globset::Glob::new(&("*".to_string() + suffix))
593593
.unwrap()
594594
.compile_matcher();
595-
for rtag in self.all_registers_mut() {
595+
for rtag in self.registers_mut() {
596596
if glob.is_match(&rtag.name) {
597597
let nlen = rtag.name.len();
598598
rtag.name.truncate(nlen - len);
@@ -867,7 +867,7 @@ impl ClusterExt for Cluster {
867867

868868
impl RegisterBlockExt for Cluster {
869869
fn iter_registers<'a, 'b>(&'a mut self, spec: &'b str) -> RegMatchIterMut<'a, 'b> {
870-
self.all_registers_mut().matched(spec)
870+
self.registers_mut().matched(spec)
871871
}
872872

873873
fn iter_clusters<'a, 'b>(&'a mut self, spec: &'b str) -> ClusterMatchIterMut<'a, 'b> {
@@ -973,7 +973,7 @@ impl RegisterBlockExt for Cluster {
973973
})?;
974974

975975
let mut source = self
976-
.all_registers()
976+
.registers()
977977
.find(|r| r.name == srcname)
978978
.ok_or_else(|| anyhow!("peripheral {} does not have register {srcname}", self.name,))?
979979
.clone();
@@ -982,7 +982,7 @@ impl RegisterBlockExt for Cluster {
982982
.display_name(Some("".into()));
983983
// Modifying fields in derived register not implemented
984984
source.modify_from(fixes, VAL_LVL)?;
985-
if let Some(ptag) = self.all_registers_mut().find(|r| r.name == rname) {
985+
if let Some(ptag) = self.registers_mut().find(|r| r.name == rname) {
986986
source.address_offset = ptag.address_offset;
987987
*ptag = source;
988988
} else {
@@ -1023,7 +1023,7 @@ impl RegisterBlockExt for Cluster {
10231023
fn strip_start(&mut self, prefix: &str) -> PatchResult {
10241024
let len = prefix.len();
10251025
let glob = globset::Glob::new(&(prefix.to_string() + "*"))?.compile_matcher();
1026-
for rtag in self.all_registers_mut() {
1026+
for rtag in self.registers_mut() {
10271027
if glob.is_match(&rtag.name) {
10281028
rtag.name.drain(..len);
10291029
}
@@ -1041,7 +1041,7 @@ impl RegisterBlockExt for Cluster {
10411041
let glob = globset::Glob::new(&("*".to_string() + suffix))
10421042
.unwrap()
10431043
.compile_matcher();
1044-
for rtag in self.all_registers_mut() {
1044+
for rtag in self.registers_mut() {
10451045
if glob.is_match(&rtag.name) {
10461046
let nlen = rtag.name.len();
10471047
rtag.name.truncate(nlen - len);

0 commit comments

Comments
 (0)