diff options
author | 2020-12-13 14:52:16 +0100 | |
---|---|---|
committer | 2020-12-13 14:52:16 +0100 | |
commit | 62771839061aaa7dd518d40969bee609d7d2bda8 (patch) | |
tree | e1fec18f0cd9fe519961c8b72ea41e72ddfc294d /macros/src/codegen/module.rs | |
parent | 0e134a41b5f53843b5e1c90cd0633ae56b7a3113 (diff) | |
download | rtic-62771839061aaa7dd518d40969bee609d7d2bda8.tar.gz rtic-62771839061aaa7dd518d40969bee609d7d2bda8.tar.zst rtic-62771839061aaa7dd518d40969bee609d7d2bda8.zip |
Now handling SysTick as well
Diffstat (limited to 'macros/src/codegen/module.rs')
-rw-r--r-- | macros/src/codegen/module.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index 2b6042c8..bf77c4d9 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -246,6 +246,19 @@ pub fn codegen( items.push(quote!(pub use #m::spawn_at;)); } + let (unmask, pend) = if &*m_isr.to_string() == "SysTick" { + ( + quote!(core::mem::transmute::<_, cortex_m::peripheral::SYST>(()).disable_interrupt()), + quote!(cortex_m::peripheral::SCB::set_pendst()), + ) + } else { + let rt_err = util::rt_err_ident(); + ( + quote!(rtic::export::NVIC::unmask(#app_path::#rt_err::#enum_::#m_isr)), + quote!(rtic::pend(#app_path::#rt_err::#enum_::#m_isr)), + ) + }; + items.push(quote!( pub mod #m { #(#cfgs)* @@ -287,8 +300,8 @@ pub fn codegen( rtic::export::interrupt::free(|_| #app_path::#tq.enqueue_unchecked( nr, - || rtic::export::NVIC::unmask(#app_path::you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::#enum_::#m_isr), - || rtic::pend(#app_path::you_must_enable_the_rt_feature_for_the_pac_in_your_cargo_toml::#enum_::#m_isr), + || #unmask, + || #pend, )); Ok(()) |