mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
Removed same prio spawn
This commit is contained in:
parent
08d2930fb3
commit
efe00ab63c
5 changed files with 0 additions and 49 deletions
|
@ -25,7 +25,6 @@ type CodegenResult = (
|
||||||
/// Generates support code for `#[init]` functions
|
/// Generates support code for `#[init]` functions
|
||||||
pub fn codegen(app: &App, analysis: &Analysis) -> CodegenResult {
|
pub fn codegen(app: &App, analysis: &Analysis) -> CodegenResult {
|
||||||
let init = &app.init;
|
let init = &app.init;
|
||||||
let mut local_needs_lt = false;
|
|
||||||
let name = &init.name;
|
let name = &init.name;
|
||||||
|
|
||||||
let mut root_init = vec![];
|
let mut root_init = vec![];
|
||||||
|
|
|
@ -224,9 +224,6 @@ pub struct SoftwareTaskArgs {
|
||||||
|
|
||||||
/// Shared resources that can be accessed from this context
|
/// Shared resources that can be accessed from this context
|
||||||
pub shared_resources: SharedResources,
|
pub shared_resources: SharedResources,
|
||||||
|
|
||||||
/// Only same priority tasks can spawn this task
|
|
||||||
pub only_same_priority_spawn: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SoftwareTaskArgs {
|
impl Default for SoftwareTaskArgs {
|
||||||
|
@ -235,7 +232,6 @@ impl Default for SoftwareTaskArgs {
|
||||||
priority: 1,
|
priority: 1,
|
||||||
local_resources: LocalResources::new(),
|
local_resources: LocalResources::new(),
|
||||||
shared_resources: SharedResources::new(),
|
shared_resources: SharedResources::new(),
|
||||||
only_same_priority_spawn: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,8 +196,6 @@ fn task_args(tokens: TokenStream2) -> parse::Result<Either<HardwareTaskArgs, Sof
|
||||||
let mut shared_resources = None;
|
let mut shared_resources = None;
|
||||||
let mut local_resources = None;
|
let mut local_resources = None;
|
||||||
let mut prio_span = None;
|
let mut prio_span = None;
|
||||||
let mut only_same_priority_spawn = false;
|
|
||||||
let mut only_same_prio_span = None;
|
|
||||||
|
|
||||||
let content;
|
let content;
|
||||||
parenthesized!(content in input);
|
parenthesized!(content in input);
|
||||||
|
@ -210,27 +208,6 @@ fn task_args(tokens: TokenStream2) -> parse::Result<Either<HardwareTaskArgs, Sof
|
||||||
let ident: Ident = content.parse()?;
|
let ident: Ident = content.parse()?;
|
||||||
let ident_s = ident.to_string();
|
let ident_s = ident.to_string();
|
||||||
|
|
||||||
if ident_s == "only_same_priority_spawn_please_fix_me" {
|
|
||||||
if only_same_priority_spawn {
|
|
||||||
return Err(parse::Error::new(
|
|
||||||
ident.span(),
|
|
||||||
"argument appears more than once",
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
only_same_priority_spawn = true;
|
|
||||||
only_same_prio_span = Some(ident.span());
|
|
||||||
|
|
||||||
if content.is_empty() {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle comma: ,
|
|
||||||
let _: Token![,] = content.parse()?;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle equal sign
|
// Handle equal sign
|
||||||
let _: Token![=] = content.parse()?;
|
let _: Token![=] = content.parse()?;
|
||||||
|
|
||||||
|
@ -344,7 +321,6 @@ fn task_args(tokens: TokenStream2) -> parse::Result<Either<HardwareTaskArgs, Sof
|
||||||
local_resources = Some(util::parse_local_resources(&content)?);
|
local_resources = Some(util::parse_local_resources(&content)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
return Err(parse::Error::new(ident.span(), "unexpected argument"));
|
return Err(parse::Error::new(ident.span(), "unexpected argument"));
|
||||||
}
|
}
|
||||||
|
@ -369,13 +345,6 @@ fn task_args(tokens: TokenStream2) -> parse::Result<Either<HardwareTaskArgs, Sof
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if only_same_priority_spawn {
|
|
||||||
return Err(parse::Error::new(
|
|
||||||
only_same_prio_span.unwrap(),
|
|
||||||
"hardware tasks are not allowed to be spawned, `only_same_priority_spawn_please_fix_me` is only for software tasks",
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
Either::Left(HardwareTaskArgs {
|
Either::Left(HardwareTaskArgs {
|
||||||
binds,
|
binds,
|
||||||
priority,
|
priority,
|
||||||
|
@ -387,7 +356,6 @@ fn task_args(tokens: TokenStream2) -> parse::Result<Either<HardwareTaskArgs, Sof
|
||||||
priority,
|
priority,
|
||||||
shared_resources,
|
shared_resources,
|
||||||
local_resources,
|
local_resources,
|
||||||
only_same_priority_spawn,
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#![no_main]
|
|
||||||
|
|
||||||
#[rtic_macros::mock_app(device = mock)]
|
|
||||||
mod app {
|
|
||||||
#[task(binds = SysTick, only_same_priority_spawn_please_fix_me)]
|
|
||||||
fn foo(_: foo::Context) {}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
error: hardware tasks are not allowed to be spawned, `only_same_priority_spawn_please_fix_me` is only for software tasks
|
|
||||||
--> ui/task-interrupt-same-prio-spawn.rs:5:29
|
|
||||||
|
|
|
||||||
5 | #[task(binds = SysTick, only_same_priority_spawn_please_fix_me)]
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
Loading…
Reference in a new issue