diff options
| author | Emil Fresk <emil.fresk@gmail.com> | 2023-03-19 22:15:36 +0100 |
|---|---|---|
| committer | Emil Fresk <emil.fresk@gmail.com> | 2023-03-19 22:15:36 +0100 |
| commit | 48e5acf294c2f035bda985c1f3441df23b5fad52 (patch) | |
| tree | ebcaad3b9db4daccac1cea985b48d5b22c417fc1 /rtic-macros/src/syntax/parse.rs | |
| parent | d18955a13450257c0a7725130beef44f21217138 (diff) | |
Start async tasks at lowest priority
Diffstat (limited to 'rtic-macros/src/syntax/parse.rs')
| -rw-r--r-- | rtic-macros/src/syntax/parse.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rtic-macros/src/syntax/parse.rs b/rtic-macros/src/syntax/parse.rs index 72eeeaf..823bd82 100644 --- a/rtic-macros/src/syntax/parse.rs +++ b/rtic-macros/src/syntax/parse.rs @@ -289,11 +289,13 @@ fn task_args(tokens: TokenStream2) -> parse::Result<Either<HardwareTaskArgs, Sof // Handle comma: , let _: Token![,] = content.parse()?; } - let priority = priority.unwrap_or(1); let shared_resources = shared_resources.unwrap_or_default(); let local_resources = local_resources.unwrap_or_default(); Ok(if let Some(binds) = binds { + // Hardware tasks can't run at anything lower than 1 + let priority = priority.unwrap_or(1); + if priority == 0 { return Err(parse::Error::new( prio_span.unwrap(), @@ -308,6 +310,9 @@ fn task_args(tokens: TokenStream2) -> parse::Result<Either<HardwareTaskArgs, Sof local_resources, }) } else { + // Software tasks start at idle priority + let priority = priority.unwrap_or(0); + Either::Right(SoftwareTaskArgs { priority, shared_resources, |
