diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2017-09-22 18:19:18 +0200 |
|---|---|---|
| committer | Jonas Schievink <jonasschievink@gmail.com> | 2017-09-22 18:19:18 +0200 |
| commit | 1556948458a386d13ff756e64dc60f8a6198e9d8 (patch) | |
| tree | e06c41e37dcc732ef2525cdc676e519564b173bd /examples/late-resources.rs | |
| parent | 70e243694dba333c62116e692edecfaf93186413 (diff) | |
Fix shared resource handling and extend example.
The extended example tests that this actually works this time.
Diffstat (limited to 'examples/late-resources.rs')
| -rw-r--r-- | examples/late-resources.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/examples/late-resources.rs b/examples/late-resources.rs index 933a252..b5dba14 100644 --- a/examples/late-resources.rs +++ b/examples/late-resources.rs @@ -26,13 +26,24 @@ app! { // the initializer. Doing that will require `init` to return the values of all "late" // resources. static IP_ADDRESS: u32; + + // PORT is used by 2 tasks, making it a shared resource. This just tests another internal + // code path and is not important for the example. + static PORT: u16; }, tasks: { SYS_TICK: { + priority: 1, path: sys_tick, - resources: [IP_ADDRESS, ON], + resources: [IP_ADDRESS, PORT, ON], }, + + EXTI0: { + priority: 2, + path: exti0, + resources: [PORT], + } } } @@ -47,6 +58,7 @@ fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResourceValues init::LateResourceValues { // This struct will contain fields for all resources with omitted initializers. IP_ADDRESS: ip_address, + PORT: 0, } } @@ -57,6 +69,8 @@ fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) { r.IP_ADDRESS; } +fn exti0(_t: &mut Threshold, _r: EXTI0::Resources) {} + fn idle() -> ! { loop { rtfm::wfi(); |
