aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/pre_init.rs
diff options
context:
space:
mode:
authorGravatar Emil Fresk <emil.fresk@gmail.com> 2021-03-14 21:27:21 +0100
committerGravatar Emil Fresk <emil.fresk@gmail.com> 2021-03-20 08:19:56 +0100
commit53c407017f50d0fde17d38afed714b2fcb54194b (patch)
treeed4e5a8b95896e07e0a6d4209844665d9a678324 /macros/src/codegen/pre_init.rs
parent1087f2ee64a5be1aedf3b702ccb5d86cc64708d9 (diff)
downloadrtic-53c407017f50d0fde17d38afed714b2fcb54194b.tar.gz
rtic-53c407017f50d0fde17d38afed714b2fcb54194b.tar.zst
rtic-53c407017f50d0fde17d38afed714b2fcb54194b.zip
Cancel and reschedule working
Support cfgs in the imports Account for extern tasks
Diffstat (limited to 'macros/src/codegen/pre_init.rs')
-rw-r--r--macros/src/codegen/pre_init.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/macros/src/codegen/pre_init.rs b/macros/src/codegen/pre_init.rs
index d5105445..287f41a4 100644
--- a/macros/src/codegen/pre_init.rs
+++ b/macros/src/codegen/pre_init.rs
@@ -77,12 +77,16 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream
);));
}
- // Initialize monotonic's interrupts
- for (_, monotonic) in app.monotonics.iter()
- //.map(|(ident, monotonic)| (ident, &monotonic.args.priority, &monotonic.args.binds))
- {
+ // Initialize monotonic's interrupts and timer queues
+ for (_, monotonic) in &app.monotonics {
let priority = &monotonic.args.priority;
let binds = &monotonic.args.binds;
+ let monotonic_name = monotonic.ident.to_string();
+ let tq = util::tq_ident(&monotonic_name);
+ let tq = util::mark_internal_ident(&tq);
+
+ // Initialize timer queues
+ stmts.push(quote!(#tq.as_mut_ptr().write(rtic::export::TimerQueue::new());));
// Compile time assert that this priority is supported by the device
stmts.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];));