aboutsummaryrefslogtreecommitdiff
path: root/macros/src
diff options
context:
space:
mode:
authorGravatar Per Lindgren <per.lindgren@ltu.se> 2021-03-11 14:47:06 +0100
committerGravatar Per Lindgren <per.lindgren@ltu.se> 2021-03-11 14:47:06 +0100
commit78a6d8442012c4066c2e2baf1810594b7b16f376 (patch)
tree0128c337818529a3fd1a3bc3a78313ca7cec701e /macros/src
parentd7f79bf3ce57c793edb9cab45c0fba78cd9b2e36 (diff)
downloadrtic-78a6d8442012c4066c2e2baf1810594b7b16f376.tar.gz
rtic-78a6d8442012c4066c2e2baf1810594b7b16f376.tar.zst
rtic-78a6d8442012c4066c2e2baf1810594b7b16f376.zip
wip
Diffstat (limited to 'macros/src')
-rw-r--r--macros/src/codegen/module.rs4
-rw-r--r--macros/src/codegen/timer_queue.rs6
2 files changed, 5 insertions, 5 deletions
diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs
index afda26cf..22e08b9d 100644
--- a/macros/src/codegen/module.rs
+++ b/macros/src/codegen/module.rs
@@ -290,7 +290,7 @@ pub fn codegen(
D::T: Into<<#app_path::#mono_type as rtic::time::Clock>::T>,
{
- let instant = if rtic::export::interrupt::free(|_| unsafe { #app_path::#m_ident.is_none() }) {
+ let instant = if rtic::export::interrupt::free(|_| unsafe { #app_path::#m_ident.get_mut_unchecked().is_none() }) {
rtic::time::Instant::new(0)
} else {
#app_path::#m::now()
@@ -327,7 +327,7 @@ pub fn codegen(
};
rtic::export::interrupt::free(|_|
- if let Some(mono) = #app_path::#m_ident.as_mut() {
+ if let Some(mono) = #app_path::#m_ident.get_mut_unchecked().as_mut() {
#app_path::#tq.get_mut_unchecked().enqueue_unchecked(
nr,
|| #enable_interrupt,
diff --git a/macros/src/codegen/timer_queue.rs b/macros/src/codegen/timer_queue.rs
index 47f45350..1d2a678e 100644
--- a/macros/src/codegen/timer_queue.rs
+++ b/macros/src/codegen/timer_queue.rs
@@ -76,7 +76,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea
items.push(quote!(
#[doc(hidden)]
- static mut #mono: Option<#mono_type> = None;
+ static #mono: rtic::RacyCell<Option<#mono_type>> = rtic::RacyCell::new(None);
));
}
@@ -128,7 +128,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) = #app_path::#m_ident.as_mut() {
+ if let Some(mono) = #app_path::#m_ident.get_mut_unchecked().as_mut() {
#tq.get_mut_unchecked().dequeue(|| #disable_isr, mono)
} else {
// We can only use the timer queue if `init` has returned, and it
@@ -141,7 +141,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec<TokenStrea
}
}
- rtic::export::interrupt::free(|_| if let Some(mono) = #app_path::#m_ident.as_mut() {
+ rtic::export::interrupt::free(|_| if let Some(mono) = #app_path::#m_ident.get_mut_unchecked().as_mut() {
mono.on_interrupt();
});
}