aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-07-20 08:51:53 +0000
committerGitHub <noreply@github.com>2021-07-20 08:51:53 +0000
commit78f556f9427e94e830b6ff6269bb1ac80010c5e6 (patch)
tree9db41cca23a87a9d78369c14b311d7fda9309fc0 /examples
parentc67657371b9f27353caae8a8ccf6e94cd0f25110 (diff)
parentbf80035aef21dd9c84a26ed47bbd1bb4a596952f (diff)
Merge #464
464: const generics r=AfoHT a=burrbull Co-authored-by: Andrey Zgarbul <zgarbul.andrey@gmail.com> Co-authored-by: mriise <mark.riise26@gmail.com> Co-authored-by: Zgarbul Andrey <zgarbul.andrey@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/pool.rs8
-rw-r--r--examples/shared.rs12
-rw-r--r--examples/static.rs12
3 files changed, 13 insertions, 19 deletions
diff --git a/examples/pool.rs b/examples/pool.rs
index 63be899..010ee44 100644
--- a/examples/pool.rs
+++ b/examples/pool.rs
@@ -42,14 +42,16 @@ 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]
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<u32, U4> = Queue(i::Queue::new())])]
+ #[init(local = [q: Queue<u32, 5> = 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<u32, U4> = Queue(i::Queue::new())])]
+ #[init(local = [q: Queue<u32, 5> = Queue::new()])]
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let (p, c) = cx.local.q.split();