Skip to content

Commit 3d784c9

Browse files
committed
emit NVIC_PRIO_BITS constant
if <cpu> information is available
1 parent f2e69e8 commit 3d784c9

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ either = "1.0.3"
1717
error-chain = "0.10.0"
1818
inflections = "1.1.0"
1919
quote = "0.3.15"
20-
svd-parser = "0.5.1"
20+
svd-parser = "0.5.2"
2121
syn = "0.11.9"
2222

2323
[[bin]]

src/generate.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ pub fn device(d: &Device, items: &mut Vec<Tokens>) -> Result<()> {
4848
},
4949
);
5050

51+
if let Some(cpu) = d.cpu.as_ref() {
52+
let bits = util::unsuffixed(cpu.nvic_priority_bits as u64);
53+
54+
items.push(quote! {
55+
/// Number available in the NVIC for configuring priority
56+
pub const NVIC_PRIO_BITS: u8 = #bits;
57+
});
58+
}
59+
5160
::generate::interrupt(&d.peripherals, items);
5261

5362
const CORE_PERIPHERALS: &'static [&'static str] = &[

0 commit comments

Comments
 (0)