aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/timer_queue.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/timer_queue.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/timer_queue.rs')
-rw-r--r--macros/src/codegen/timer_queue.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/macros/src/codegen/timer_queue.rs b/macros/src/codegen/timer_queue.rs
index 33905516..0d2c51ea 100644
--- a/macros/src/codegen/timer_queue.rs
+++ b/macros/src/codegen/timer_queue.rs
@@ -68,15 +68,12 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea
.map(|(_name, task)| task.args.capacity)
.sum();
let n = util::capacity_typenum(cap, false);
- let tq_ty = quote!(rtic::export::TimerQueue<#mono_type, #t, #n>);
+ let tq_ty =
+ quote!(core::mem::MaybeUninit<rtic::export::TimerQueue<#mono_type, #t, #n>>);
items.push(quote!(
#[doc(hidden)]
- static mut #tq: #tq_ty = rtic::export::TimerQueue(
- rtic::export::BinaryHeap(
- rtic::export::iBinaryHeap::new()
- )
- );
+ static mut #tq: #tq_ty = core::mem::MaybeUninit::uninit();
));
let mono = util::monotonic_ident(&monotonic_name);
@@ -138,7 +135,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea
while let Some((task, index)) = rtic::export::interrupt::free(|_|
if let Some(mono) = #app_path::#m_ident.as_mut() {
- #tq.dequeue(|| #disable_isr, mono)
+ (&mut *#tq.as_mut_ptr()).dequeue(|| #disable_isr, mono)
} else {
// We can only use the timer queue if `init` has returned, and it
// writes the `Some(monotonic)` we are accessing here.