diff options
author | 2020-10-23 10:35:56 +0200 | |
---|---|---|
committer | 2020-10-23 23:58:09 +0200 | |
commit | 1c244a995d54332649c1643aa0a3178f169406e4 (patch) | |
tree | ef7676e7439ccf9407fcde998a654d9700f20524 /macros/src/codegen/pre_init.rs | |
parent | 86699039e99229049ee3c739eaf860acc70a1bf7 (diff) | |
download | rtic-1c244a995d54332649c1643aa0a3178f169406e4.tar.gz rtic-1c244a995d54332649c1643aa0a3178f169406e4.tar.zst rtic-1c244a995d54332649c1643aa0a3178f169406e4.zip |
move dispatchers to app argument
Diffstat (limited to 'macros/src/codegen/pre_init.rs')
-rw-r--r-- | macros/src/codegen/pre_init.rs | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/macros/src/codegen/pre_init.rs b/macros/src/codegen/pre_init.rs index 17c9c2f4..969de84a 100644 --- a/macros/src/codegen/pre_init.rs +++ b/macros/src/codegen/pre_init.rs @@ -26,22 +26,20 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream let mut core: rtic::export::Peripherals = rtic::export::Peripherals::steal().into(); )); - let device = extra.device; + let device = &extra.device; let nvic_prio_bits = quote!(#device::NVIC_PRIO_BITS); + let interrupt_ids = analysis.interrupts.iter().map(|(p, (id, _))| (p, id)); + // Unmask interrupts and set their priorities - for (&priority, name) in analysis - .interrupts - .iter() - .chain(app.hardware_tasks.values().flat_map(|task| { - if !util::is_exception(&task.args.binds) { - Some((&task.args.priority, &task.args.binds)) - } else { - // We do exceptions in another pass - None - } - })) - { + for (&priority, name) in interrupt_ids.chain(app.hardware_tasks.values().flat_map(|task| { + if !util::is_exception(&task.args.binds) { + Some((&task.args.priority, &task.args.binds)) + } else { + // We do exceptions in another pass + None + } + })) { // Compile time assert that this priority is supported by the device stmts.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];)); |