Skip to content

Commit 7f61392

Browse files
committed
Removed device from init context in preparation for its disapearance
1 parent 064cf19 commit 7f61392

File tree

9 files changed

+8
-36
lines changed

9 files changed

+8
-36
lines changed

rtic-macros/src/codegen/module.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@ pub fn codegen(ctxt: Context, app: &App, analysis: &Analysis) -> TokenStream2 {
2121
pub core: rtic::export::Peripherals
2222
));
2323

24-
if app.args.peripherals {
25-
let device = &app.args.device;
26-
27-
fields.push(quote!(
28-
/// Device peripherals (PAC)
29-
pub device: #device::Peripherals
30-
));
31-
32-
values.push(quote!(device: #device::Peripherals::steal()));
33-
}
34-
3524
fields.push(quote!(
3625
/// Critical section token for init
3726
pub cs: rtic::export::CriticalSection<'a>

rtic-macros/src/syntax/ast.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ pub struct AppArgs {
5656
/// Device
5757
pub device: Path,
5858

59-
/// Peripherals
60-
pub peripherals: bool,
61-
6259
/// Interrupts used to dispatch software tasks
6360
pub dispatchers: Dispatchers,
6461
}

rtic-macros/src/syntax/parse/app.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use proc_macro2::TokenStream as TokenStream2;
55
use syn::{
66
parse::{self, ParseStream, Parser},
77
spanned::Spanned,
8-
Expr, ExprArray, Fields, ForeignItem, Ident, Item, LitBool, Path, Token, Visibility,
8+
Expr, ExprArray, Fields, ForeignItem, Ident, Item, Path, Token, Visibility,
99
};
1010

1111
use super::Input;
@@ -23,7 +23,6 @@ impl AppArgs {
2323
(|input: ParseStream<'_>| -> parse::Result<Self> {
2424
let mut custom = Set::new();
2525
let mut device = None;
26-
let mut peripherals = true;
2726
let mut dispatchers = Dispatchers::new();
2827

2928
loop {
@@ -58,17 +57,6 @@ impl AppArgs {
5857
}
5958
}
6059

61-
"peripherals" => {
62-
if let Ok(p) = input.parse::<LitBool>() {
63-
peripherals = p.value;
64-
} else {
65-
return Err(parse::Error::new(
66-
ident.span(),
67-
"unexpected argument value; this should be a boolean",
68-
));
69-
}
70-
}
71-
7260
"dispatchers" => {
7361
if let Ok(p) = input.parse::<ExprArray>() {
7462
for e in p.elems {
@@ -133,7 +121,6 @@ impl AppArgs {
133121

134122
Ok(AppArgs {
135123
device,
136-
peripherals,
137124
dispatchers,
138125
})
139126
})

rtic/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
1313

1414
### Changed
1515

16+
- `peripherals = ...` is removed
17+
- The context in init has removed `cx.device`
1618
- `cortex-m` set as an optional dependency
1719
- Moved `cortex-m`-related utilities from `rtic/lib.rs` to `rtic/export.rs`
1820
- Make async task priorities start at 0, instead of 1, to always start at the lowest priority

rtic/examples/async-delay.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use panic_semihosting as _;
1111

12-
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
12+
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0])]
1313
mod app {
1414
use cortex_m_semihosting::{debug, hprintln};
1515
use rtic_monotonics::systick::*;

rtic/examples/async-task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use panic_semihosting as _;
1515
// task can have a mutable reference stored.
1616
// - Spawning an async task equates to it being polled once.
1717

18-
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
18+
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0])]
1919
mod app {
2020
use cortex_m_semihosting::{debug, hprintln};
2121

rtic/examples/async-timeout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use cortex_m_semihosting::{debug, hprintln};
1111
use panic_semihosting as _;
1212
use rtic_monotonics::systick::*;
1313

14-
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
14+
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0])]
1515
mod app {
1616
use super::*;
1717
use futures::{future::FutureExt, select_biased};

rtic/examples/init.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
use panic_semihosting as _;
1010

11-
#[rtic::app(device = lm3s6965, peripherals = true)]
11+
#[rtic::app(device = lm3s6965)]
1212
mod app {
1313
use cortex_m_semihosting::{debug, hprintln};
1414

@@ -23,9 +23,6 @@ mod app {
2323
// Cortex-M peripherals
2424
let _core: cortex_m::Peripherals = cx.core;
2525

26-
// Device specific peripherals
27-
let _device: lm3s6965::Peripherals = cx.device;
28-
2926
// Locals in `init` have 'static lifetime
3027
let _x: &'static mut u32 = cx.local.x;
3128

rtic/examples/zero-prio-task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct NotSend {
1515
_0: PhantomData<*const ()>,
1616
}
1717

18-
#[rtic::app(device = lm3s6965, peripherals = true)]
18+
#[rtic::app(device = lm3s6965)]
1919
mod app {
2020
use super::NotSend;
2121
use core::marker::PhantomData;

0 commit comments

Comments
 (0)