From e4319de3d526285381f5cc53e14f9a17d123a81a Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Sat, 3 Apr 2021 20:30:34 +0300 Subject: const generics --- examples/shared.rs | 12 ++++-------- examples/static.rs | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) (limited to 'examples') diff --git a/examples/shared.rs b/examples/shared.rs index c3fa07b..9585c38 100644 --- a/examples/shared.rs +++ b/examples/shared.rs @@ -10,23 +10,19 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965)] mod app { use cortex_m_semihosting::{debug, hprintln}; - use heapless::{ - consts::*, - i, - spsc::{Consumer, Producer, Queue}, - }; + use heapless::spsc::{Consumer, Producer, Queue}; use lm3s6965::Interrupt; #[shared] struct Shared { - p: Producer<'static, u32, U4>, - c: Consumer<'static, u32, U4>, + p: Producer<'static, u32, 5>, + c: Consumer<'static, u32, 5>, } #[local] struct Local {} - #[init(local = [q: Queue = Queue(i::Queue::new())])] + #[init(local = [q: Queue = Queue::new()])] fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { let (p, c) = cx.local.q.split(); diff --git a/examples/static.rs b/examples/static.rs index f51c5f2..0ea5d2d 100644 --- a/examples/static.rs +++ b/examples/static.rs @@ -11,23 +11,19 @@ use panic_semihosting as _; mod app { use cortex_m_semihosting::{debug, hprintln}; - use heapless::{ - consts::*, - i, - spsc::{Consumer, Producer, Queue}, - }; + use heapless::spsc::{Consumer, Producer, Queue}; use lm3s6965::Interrupt; #[shared] struct Shared { - p: Producer<'static, u32, U4>, - c: Consumer<'static, u32, U4>, + p: Producer<'static, u32, 5>, + c: Consumer<'static, u32, 5>, } #[local] struct Local {} - #[init(local = [q: Queue = Queue(i::Queue::new())])] + #[init(local = [q: Queue = Queue::new()])] fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) { let (p, c) = cx.local.q.split(); -- cgit v1.2.3 From 5e92715d8cfce6dd91168ece7ce07502eda3145e Mon Sep 17 00:00:00 2001 From: mriise Date: Tue, 20 Jul 2021 01:13:24 -0700 Subject: fix pool example --- examples/pool.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/pool.rs b/examples/pool.rs index 63be899..7c61dfb 100644 --- a/examples/pool.rs +++ b/examples/pool.rs @@ -42,14 +42,14 @@ mod app { #[task(binds = I2C0, priority = 2)] fn i2c0(_: i2c0::Context) { - // claim a memory block, leave it uninitialized and .. - let x = P::alloc().unwrap().freeze(); + // claim a memory block, initialize it and .. + let x = P::alloc().unwrap().init([0u8; 128]); // .. send it to the `foo` task foo::spawn(x).ok().unwrap(); // send another block to the task `bar` - bar::spawn(P::alloc().unwrap().freeze()).ok().unwrap(); + bar::spawn(P::alloc().unwrap().init([0u8; 128])).ok().unwrap(); } #[task] -- cgit v1.2.3 From bf80035aef21dd9c84a26ed47bbd1bb4a596952f Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Tue, 20 Jul 2021 11:44:03 +0300 Subject: rustfmt --- examples/pool.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/pool.rs b/examples/pool.rs index 7c61dfb..010ee44 100644 --- a/examples/pool.rs +++ b/examples/pool.rs @@ -49,7 +49,9 @@ mod app { foo::spawn(x).ok().unwrap(); // send another block to the task `bar` - bar::spawn(P::alloc().unwrap().init([0u8; 128])).ok().unwrap(); + bar::spawn(P::alloc().unwrap().init([0u8; 128])) + .ok() + .unwrap(); } #[task] -- cgit v1.2.3