aboutsummaryrefslogtreecommitdiff
path: root/examples/pool.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-07-09 11:00:11 +0000
committerGitHub <noreply@github.com>2021-07-09 11:00:11 +0000
commite1a4d001f8e724596cd9de3e90698ce7de473b3f (patch)
treef7aac5eae4cc2e19cc06bfd6fa8dab843dcfb276 /examples/pool.rs
parent13dc3992e616d817e38c167c4b47db816855f18b (diff)
parentf3d9fd9b638a25b497e1ca02e7ce5de86c9fc1c9 (diff)
Merge #494
494: Resoures take 2 r=korken89 a=korken89 Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
Diffstat (limited to 'examples/pool.rs')
-rw-r--r--examples/pool.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/examples/pool.rs b/examples/pool.rs
index 44405b4..63be899 100644
--- a/examples/pool.rs
+++ b/examples/pool.rs
@@ -24,16 +24,20 @@ mod app {
// Import the memory pool into scope
use super::P;
- #[init]
- fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
- static mut MEMORY: [u8; 512] = [0; 512];
+ #[shared]
+ struct Shared {}
+ #[local]
+ struct Local {}
+
+ #[init(local = [memory: [u8; 512] = [0; 512]])]
+ fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
// Increase the capacity of the memory pool by ~4
- P::grow(MEMORY);
+ P::grow(cx.local.memory);
rtic::pend(Interrupt::I2C0);
- (init::LateResources {}, init::Monotonics())
+ (Shared {}, Local {}, init::Monotonics())
}
#[task(binds = I2C0, priority = 2)]