aboutsummaryrefslogtreecommitdiff
path: root/examples/not-send.rs
diff options
context:
space:
mode:
authorGravatar Emil Fresk <emil.fresk@gmail.com> 2020-10-11 19:41:57 +0200
committerGravatar Emil Fresk <emil.fresk@gmail.com> 2020-10-11 20:35:50 +0200
commit5b8e6a22ab68e316e11641dedf5b39e20878c7b7 (patch)
tree1bdc1812ca24203f3b99f381b1e9f8c89f60be24 /examples/not-send.rs
parent524273c96a978299b64e51a9cdcc007585a0f170 (diff)
downloadrtic-5b8e6a22ab68e316e11641dedf5b39e20878c7b7.tar.gz
rtic-5b8e6a22ab68e316e11641dedf5b39e20878c7b7.tar.zst
rtic-5b8e6a22ab68e316e11641dedf5b39e20878c7b7.zip
Fixing examples and tests, modules now import user imports correctly
Fmt Correct syntax crate UI test fix Fix build script Cleanup More cleanup
Diffstat (limited to 'examples/not-send.rs')
-rw-r--r--examples/not-send.rs68
1 files changed, 0 insertions, 68 deletions
diff --git a/examples/not-send.rs b/examples/not-send.rs
deleted file mode 100644
index 18071fc5..00000000
--- a/examples/not-send.rs
+++ /dev/null
@@ -1,68 +0,0 @@
-//! `examples/not-send.rs`
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use core::marker::PhantomData;
-
-use cortex_m_semihosting::debug;
-use panic_halt as _;
-use rtic::app;
-
-pub struct NotSend {
- _0: PhantomData<*const ()>,
-}
-
-#[app(device = lm3s6965)]
-mod app {
- use super::NotSend;
-
- #[resources]
- struct Resources {
- #[init(None)]
- shared: Option<NotSend>,
- }
-
- #[init(spawn = [baz, quux])]
- fn init(c: init::Context) -> init::LateResources {
- c.spawn.baz().unwrap();
- c.spawn.quux().unwrap();
-
- init::LateResources {}
- }
-
- #[task(spawn = [bar])]
- fn foo(c: foo::Context) {
- // scenario 1: message passed to task that runs at the same priority
- c.spawn.bar(NotSend { _0: PhantomData }).ok();
- }
-
- #[task]
- fn bar(_: bar::Context, _x: NotSend) {
- // scenario 1
- }
-
- #[task(priority = 2, resources = [shared])]
- fn baz(c: baz::Context) {
- // scenario 2: resource shared between tasks that run at the same priority
- *c.resources.shared = Some(NotSend { _0: PhantomData });
- }
-
- #[task(priority = 2, resources = [shared])]
- fn quux(c: quux::Context) {
- // scenario 2
- let _not_send = c.resources.shared.take().unwrap();
-
- debug::exit(debug::EXIT_SUCCESS);
- }
-
- // RTIC requires that unused interrupts are declared in an extern block when
- // using software tasks; these free interrupts will be used to dispatch the
- // software tasks.
- extern "C" {
- fn SSI0();
- fn QEI0();
- }
-}