From 306aa47170fd59369b7a184924e287dc3706d64d Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Mon, 23 Jan 2023 20:05:47 +0100 Subject: Add rtic-timer (timerqueue + monotonic) and rtic-monotonics (systick-monotonic) --- examples/shared.rs | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 examples/shared.rs (limited to 'examples/shared.rs') diff --git a/examples/shared.rs b/examples/shared.rs deleted file mode 100644 index d0633fb..0000000 --- a/examples/shared.rs +++ /dev/null @@ -1,51 +0,0 @@ -//! examples/late.rs - -#![deny(unsafe_code)] -#![deny(warnings)] -#![deny(missing_docs)] -#![no_main] -#![no_std] - -use panic_semihosting as _; - -#[rtic::app(device = lm3s6965)] -mod app { - use cortex_m_semihosting::{debug, hprintln}; - use heapless::spsc::{Consumer, Producer, Queue}; - use lm3s6965::Interrupt; - - #[shared] - struct Shared { - p: Producer<'static, u32, 5>, - c: Consumer<'static, u32, 5>, - } - - #[local] - struct Local {} - - #[init(local = [q: Queue = Queue::new()])] - fn init(cx: init::Context) -> (Shared, Local) { - let (p, c) = cx.local.q.split(); - - // Initialization of shared resources - (Shared { p, c }, Local {}) - } - - #[idle(shared = [c])] - fn idle(mut c: idle::Context) -> ! { - loop { - if let Some(byte) = c.shared.c.lock(|c| c.dequeue()) { - hprintln!("received message: {}", byte); - - debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator - } else { - rtic::pend(Interrupt::UART0); - } - } - } - - #[task(binds = UART0, shared = [p])] - fn uart0(mut c: uart0::Context) { - c.shared.p.lock(|p| p.enqueue(42).unwrap()); - } -} -- cgit v1.2.3