aboutsummaryrefslogtreecommitdiff
path: root/macros/src/codegen/module.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <26634292+bors[bot]@users.noreply.github.com> 2020-10-23 22:03:08 +0000
committerGravatar GitHub <noreply@github.com> 2020-10-23 22:03:08 +0000
commit4f4c95be40019f6656d4eee549932ee811a40116 (patch)
tree092cede9ccdaa9b7a4381f7c369db79583d7eb8b /macros/src/codegen/module.rs
parentbbcae14e37c5f4ab5701b2a688bee52bfa7aaa1b (diff)
parent1c244a995d54332649c1643aa0a3178f169406e4 (diff)
downloadrtic-4f4c95be40019f6656d4eee549932ee811a40116.tar.gz
rtic-4f4c95be40019f6656d4eee549932ee811a40116.tar.zst
rtic-4f4c95be40019f6656d4eee549932ee811a40116.zip
Merge #400
400: codegen and examples r=AfoHT a=perlindgren just a test Co-authored-by: Per Lindgren <per.lindgren@ltu.se>
Diffstat (limited to 'macros/src/codegen/module.rs')
-rw-r--r--macros/src/codegen/module.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs
index a5b61394..838a989f 100644
--- a/macros/src/codegen/module.rs
+++ b/macros/src/codegen/module.rs
@@ -23,7 +23,7 @@ pub fn codegen(
let mut lt = None;
match ctxt {
Context::Init => {
- if let Some(m) = extra.monotonic {
+ if let Some(m) = &extra.monotonic {
fields.push(quote!(
/// System start time = `Instant(0 /* cycles */)`
pub start: <#m as rtic::Monotonic>::Instant
@@ -43,7 +43,7 @@ pub fn codegen(
}
if extra.peripherals {
- let device = extra.device;
+ let device = &extra.device;
fields.push(quote!(
/// Device peripherals
@@ -67,7 +67,7 @@ pub fn codegen(
Context::Idle => {}
Context::HardwareTask(..) => {
- if let Some(m) = extra.monotonic {
+ if let Some(m) = &extra.monotonic {
fields.push(quote!(
/// Time at which this handler started executing
pub start: <#m as rtic::Monotonic>::Instant
@@ -80,7 +80,7 @@ pub fn codegen(
}
Context::SoftwareTask(..) => {
- if let Some(m) = extra.monotonic {
+ if let Some(m) = &extra.monotonic {
fields.push(quote!(
/// The time at which this task was scheduled to run
pub scheduled: <#m as rtic::Monotonic>::Instant
@@ -162,7 +162,7 @@ pub fn codegen(
};
let instant = if needs_instant {
- let m = extra.monotonic();
+ let m = extra.monotonic.clone().expect("RTIC-ICE: UNREACHABLE");
Some(quote!(, instant: <#m as rtic::Monotonic>::Instant))
} else {
@@ -205,9 +205,13 @@ pub fn codegen(
let app_name = &app.name;
let app_path = quote! {crate::#app_name};
- let device = extra.device;
+ let device = &extra.device;
let enum_ = util::interrupt_ident();
- let interrupt = &analysis.interrupts.get(&priority);
+ let interrupt = &analysis
+ .interrupts
+ .get(&priority)
+ .expect("RTIC-ICE: interrupt identifer not found")
+ .0;
// Spawn caller
items.push(quote!(
@@ -240,7 +244,7 @@ pub fn codegen(
}));
// Schedule caller
- if let Some(m) = extra.monotonic {
+ if let Some(m) = &extra.monotonic {
let instants = util::instants_ident(name);
let tq = util::tq_ident();