diff options
author | 2021-08-17 12:21:20 +0000 | |
---|---|---|
committer | 2021-08-17 12:21:20 +0000 | |
commit | 6b9966678cd4d9e1242779b6a62643f44857d45f (patch) | |
tree | 73d4d91075f06a35149ee3b5303bde465d881a64 /macros/src/codegen/timer_queue.rs | |
parent | 74b396497861ad69dcab0414851ddb8b5c624036 (diff) | |
parent | bc3eb5c54784c32ccfff404dba58a27d5a47f04e (diff) | |
download | rtic-6b9966678cd4d9e1242779b6a62643f44857d45f.tar.gz rtic-6b9966678cd4d9e1242779b6a62643f44857d45f.tar.zst rtic-6b9966678cd4d9e1242779b6a62643f44857d45f.zip |
Merge #511
511: Remove linked list impl - use heapless, linked list init now const fn r=AfoHT a=korken89
Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
Diffstat (limited to 'macros/src/codegen/timer_queue.rs')
-rw-r--r-- | macros/src/codegen/timer_queue.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/macros/src/codegen/timer_queue.rs b/macros/src/codegen/timer_queue.rs index abddbadc..bf896ee6 100644 --- a/macros/src/codegen/timer_queue.rs +++ b/macros/src/codegen/timer_queue.rs @@ -62,21 +62,20 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea { // For future use // let doc = &format!("Timer queue for {}", monotonic_name); - let cap: u8 = app + let cap: usize = app .software_tasks .iter() - .map(|(_name, task)| task.args.capacity) + .map(|(_name, task)| task.args.capacity as usize) .sum(); - let n = util::capacity_literal(cap as usize); - let tq_ty = - quote!(core::mem::MaybeUninit<rtic::export::TimerQueue<#mono_type, #t, #n>>); + let n = util::capacity_literal(cap); + let tq_ty = quote!(rtic::export::TimerQueue<#mono_type, #t, #n>); // For future use // let doc = format!(" RTIC internal: {}:{}", file!(), line!()); items.push(quote!( #[doc(hidden)] static #tq: rtic::RacyCell<#tq_ty> = - rtic::RacyCell::new(core::mem::MaybeUninit::uninit()); + rtic::RacyCell::new(rtic::export::TimerQueue(rtic::export::SortedLinkedList::new_u16())); )); let mono = util::monotonic_ident(&monotonic_name); @@ -138,7 +137,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea unsafe fn #bound_interrupt() { while let Some((task, index)) = rtic::export::interrupt::free(|_| if let Some(mono) = #m_ident.get_mut_unchecked().as_mut() { - (&mut *#tq.get_mut_unchecked().as_mut_ptr()).dequeue(|| #disable_isr, mono) + #tq.get_mut_unchecked().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. |