Skip to content

Commit 82ebef2

Browse files
committed
omit peripherals for which svd2rust won't generate an API
1 parent 7afacb7 commit 82ebef2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/generate.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ pub fn device(
133133
}
134134

135135
::generate::peripheral(p, &d.peripherals, items, &d.defaults)?;
136+
137+
if p.registers
138+
.as_ref()
139+
.map(|v| &v[..])
140+
.unwrap_or(&[])
141+
.is_empty()
142+
{
143+
// No register block will be generated so don't put this peripheral
144+
// in the `Peripherals` struct
145+
continue;
146+
}
147+
136148
let p = p.name.to_sanitized_upper_case();
137149
let id = Ident::new(&*p);
138150
fields.push(quote! {

0 commit comments

Comments
 (0)