aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Emil Fresk <emil.fresk@gmail.com> 2023-03-31 20:42:14 +0200
committerGravatar Emil Fresk <emil.fresk@gmail.com> 2023-03-31 20:42:14 +0200
commit7f61392a63959ce260c1d7d05628feee4ffa07e8 (patch)
tree231184f0d91deae4307f55ea1d1416c547f00e40
parent064cf19265f72d7f01e0847c545e6250391a2172 (diff)
downloadrtic-remove-core-device-peripherals.tar.gz
rtic-remove-core-device-peripherals.tar.zst
rtic-remove-core-device-peripherals.zip
Removed device from init context in preparation for its disapearanceremove-core-device-peripherals
-rw-r--r--rtic-macros/src/codegen/module.rs11
-rw-r--r--rtic-macros/src/syntax/ast.rs3
-rw-r--r--rtic-macros/src/syntax/parse/app.rs15
-rw-r--r--rtic/CHANGELOG.md2
-rw-r--r--rtic/examples/async-delay.rs2
-rw-r--r--rtic/examples/async-task.rs2
-rw-r--r--rtic/examples/async-timeout.rs2
-rw-r--r--rtic/examples/init.rs5
-rw-r--r--rtic/examples/zero-prio-task.rs2
9 files changed, 8 insertions, 36 deletions
diff --git a/rtic-macros/src/codegen/module.rs b/rtic-macros/src/codegen/module.rs
index cf066ef9..60905889 100644
--- a/rtic-macros/src/codegen/module.rs
+++ b/rtic-macros/src/codegen/module.rs
@@ -21,17 +21,6 @@ pub fn codegen(ctxt: Context, app: &App, analysis: &Analysis) -> TokenStream2 {
pub core: rtic::export::Peripherals
));
- if app.args.peripherals {
- let device = &app.args.device;
-
- fields.push(quote!(
- /// Device peripherals (PAC)
- pub device: #device::Peripherals
- ));
-
- values.push(quote!(device: #device::Peripherals::steal()));
- }
-
fields.push(quote!(
/// Critical section token for init
pub cs: rtic::export::CriticalSection<'a>
diff --git a/rtic-macros/src/syntax/ast.rs b/rtic-macros/src/syntax/ast.rs
index 27e6773f..c3f2befa 100644
--- a/rtic-macros/src/syntax/ast.rs
+++ b/rtic-macros/src/syntax/ast.rs
@@ -56,9 +56,6 @@ pub struct AppArgs {
/// Device
pub device: Path,
- /// Peripherals
- pub peripherals: bool,
-
/// Interrupts used to dispatch software tasks
pub dispatchers: Dispatchers,
}
diff --git a/rtic-macros/src/syntax/parse/app.rs b/rtic-macros/src/syntax/parse/app.rs
index e797f75e..2a5f8d86 100644
--- a/rtic-macros/src/syntax/parse/app.rs
+++ b/rtic-macros/src/syntax/parse/app.rs
@@ -5,7 +5,7 @@ use proc_macro2::TokenStream as TokenStream2;
use syn::{
parse::{self, ParseStream, Parser},
spanned::Spanned,
- Expr, ExprArray, Fields, ForeignItem, Ident, Item, LitBool, Path, Token, Visibility,
+ Expr, ExprArray, Fields, ForeignItem, Ident, Item, Path, Token, Visibility,
};
use super::Input;
@@ -23,7 +23,6 @@ impl AppArgs {
(|input: ParseStream<'_>| -> parse::Result<Self> {
let mut custom = Set::new();
let mut device = None;
- let mut peripherals = true;
let mut dispatchers = Dispatchers::new();
loop {
@@ -58,17 +57,6 @@ impl AppArgs {
}
}
- "peripherals" => {
- if let Ok(p) = input.parse::<LitBool>() {
- peripherals = p.value;
- } else {
- return Err(parse::Error::new(
- ident.span(),
- "unexpected argument value; this should be a boolean",
- ));
- }
- }
-
"dispatchers" => {
if let Ok(p) = input.parse::<ExprArray>() {
for e in p.elems {
@@ -133,7 +121,6 @@ impl AppArgs {
Ok(AppArgs {
device,
- peripherals,
dispatchers,
})
})
diff --git a/rtic/CHANGELOG.md b/rtic/CHANGELOG.md
index 2d0a392f..374554fd 100644
--- a/rtic/CHANGELOG.md
+++ b/rtic/CHANGELOG.md
@@ -13,6 +13,8 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
### Changed
+- `peripherals = ...` is removed
+- The context in init has removed `cx.device`
- `cortex-m` set as an optional dependency
- Moved `cortex-m`-related utilities from `rtic/lib.rs` to `rtic/export.rs`
- Make async task priorities start at 0, instead of 1, to always start at the lowest priority
diff --git a/rtic/examples/async-delay.rs b/rtic/examples/async-delay.rs
index cdffa620..8c3fe1f1 100644
--- a/rtic/examples/async-delay.rs
+++ b/rtic/examples/async-delay.rs
@@ -9,7 +9,7 @@
use panic_semihosting as _;
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
+#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0])]
mod app {
use cortex_m_semihosting::{debug, hprintln};
use rtic_monotonics::systick::*;
diff --git a/rtic/examples/async-task.rs b/rtic/examples/async-task.rs
index 1ca18021..6f5ab641 100644
--- a/rtic/examples/async-task.rs
+++ b/rtic/examples/async-task.rs
@@ -15,7 +15,7 @@ use panic_semihosting as _;
// task can have a mutable reference stored.
// - Spawning an async task equates to it being polled once.
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
+#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0])]
mod app {
use cortex_m_semihosting::{debug, hprintln};
diff --git a/rtic/examples/async-timeout.rs b/rtic/examples/async-timeout.rs
index 7690408e..7e81c50e 100644
--- a/rtic/examples/async-timeout.rs
+++ b/rtic/examples/async-timeout.rs
@@ -11,7 +11,7 @@ use cortex_m_semihosting::{debug, hprintln};
use panic_semihosting as _;
use rtic_monotonics::systick::*;
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
+#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0])]
mod app {
use super::*;
use futures::{future::FutureExt, select_biased};
diff --git a/rtic/examples/init.rs b/rtic/examples/init.rs
index 634d309d..c7e013cf 100644
--- a/rtic/examples/init.rs
+++ b/rtic/examples/init.rs
@@ -8,7 +8,7 @@
use panic_semihosting as _;
-#[rtic::app(device = lm3s6965, peripherals = true)]
+#[rtic::app(device = lm3s6965)]
mod app {
use cortex_m_semihosting::{debug, hprintln};
@@ -23,9 +23,6 @@ mod app {
// Cortex-M peripherals
let _core: cortex_m::Peripherals = cx.core;
- // Device specific peripherals
- let _device: lm3s6965::Peripherals = cx.device;
-
// Locals in `init` have 'static lifetime
let _x: &'static mut u32 = cx.local.x;
diff --git a/rtic/examples/zero-prio-task.rs b/rtic/examples/zero-prio-task.rs
index dbe1959e..58b52101 100644
--- a/rtic/examples/zero-prio-task.rs
+++ b/rtic/examples/zero-prio-task.rs
@@ -15,7 +15,7 @@ pub struct NotSend {
_0: PhantomData<*const ()>,
}
-#[rtic::app(device = lm3s6965, peripherals = true)]
+#[rtic::app(device = lm3s6965)]
mod app {
use super::NotSend;
use core::marker::PhantomData;