aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/t-init-main.rs24
-rw-r--r--examples/t-resource.rs85
-rw-r--r--examples/t-stask-main.rs29
-rw-r--r--examples/task_named_main.rs32
-rw-r--r--examples/type-usage.rs26
5 files changed, 0 insertions, 196 deletions
diff --git a/examples/t-init-main.rs b/examples/t-init-main.rs
deleted file mode 100644
index 9271788..0000000
--- a/examples/t-init-main.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965)]
-mod app {
- use cortex_m_semihosting::debug;
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- debug::exit(debug::EXIT_SUCCESS);
-
- (Shared {}, Local {}, init::Monotonics())
- }
-}
diff --git a/examples/t-resource.rs b/examples/t-resource.rs
deleted file mode 100644
index 2732491..0000000
--- a/examples/t-resource.rs
+++ /dev/null
@@ -1,85 +0,0 @@
-//! [compile-pass] Check code generation of shared resources
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965)]
-mod app {
- #[shared]
- struct Shared {
- o2: u32, // idle
- o3: u32, // EXTI0
- o4: u32, // idle
- o5: u32, // EXTI1
- s1: u32, // idle & uart0
- s2: u32, // uart0 & uart1
- s3: u32, // idle & uart0
- }
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- (
- Shared {
- o2: 0,
- o3: 0,
- o4: 0,
- o5: 0,
- s1: 0,
- s2: 0,
- s3: 0,
- },
- Local {},
- init::Monotonics(),
- )
- }
-
- #[idle(shared = [o2, &o4, s1, &s3])]
- fn idle(mut c: idle::Context) -> ! {
- // owned by `idle` == `&'static mut`
- let _: shared_resources::o2 = c.shared.o2;
-
- // owned by `idle` == `&'static` if read-only
- let _: &u32 = c.shared.o4;
-
- // shared with `idle` == `Mutex`
- c.shared.s1.lock(|_| {});
-
- // `&` if read-only
- let _: &u32 = c.shared.s3;
-
- loop {
- cortex_m::asm::nop();
- }
- }
-
- #[task(binds = UART0, shared = [o3, s1, s2, &s3])]
- fn uart0(c: uart0::Context) {
- // owned by interrupt == `&mut`
- let _: shared_resources::o3 = c.shared.o3;
-
- // no `Mutex` proxy when access from highest priority task
- let _: shared_resources::s1 = c.shared.s1;
-
- // no `Mutex` proxy when co-owned by cooperative (same priority) tasks
- let _: shared_resources::s2 = c.shared.s2;
-
- // `&` if read-only
- let _: &u32 = c.shared.s3;
- }
-
- #[task(binds = UART1, shared = [s2, &o5])]
- fn uart1(c: uart1::Context) {
- // owned by interrupt == `&` if read-only
- let _: &u32 = c.shared.o5;
-
- // no `Mutex` proxy when co-owned by cooperative (same priority) tasks
- let _: shared_resources::s2 = c.shared.s2;
- }
-}
diff --git a/examples/t-stask-main.rs b/examples/t-stask-main.rs
deleted file mode 100644
index ee5959d..0000000
--- a/examples/t-stask-main.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::debug;
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- taskmain::spawn().ok();
-
- (Shared {}, Local {}, init::Monotonics())
- }
-
- #[task]
- fn taskmain(_: taskmain::Context) {
- debug::exit(debug::EXIT_SUCCESS);
- }
-}
diff --git a/examples/task_named_main.rs b/examples/task_named_main.rs
deleted file mode 100644
index b030b5e..0000000
--- a/examples/task_named_main.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-//! examples/task_named_main.rs
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::{debug, hprintln};
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- main::spawn().unwrap();
-
- (Shared {}, Local {}, init::Monotonics())
- }
-
- #[task]
- fn main(_: main::Context) {
- hprintln!("This task is named main, useful for rust-analyzer").unwrap();
- debug::exit(debug::EXIT_SUCCESS);
- }
-}
diff --git a/examples/type-usage.rs b/examples/type-usage.rs
deleted file mode 100644
index e5a088f..0000000
--- a/examples/type-usage.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-//! examples/type-usage.rs
-
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _; // panic handler
-use rtic::app;
-
-#[app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- type Test = u32;
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- (Shared {}, Local {}, init::Monotonics {})
- }
-
- #[task]
- fn t1(_: t1::Context, _val: Test) {}
-}