aboutsummaryrefslogtreecommitdiff
path: root/examples/generics.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2017-11-20 05:11:25 +0100
committerGravatar Jorge Aparicio <jorge@japaric.io> 2017-12-09 12:45:57 +0100
commite97afa71ce7bf3d78e257de1aab329135e98c721 (patch)
tree8335f9d8327a9863ec64b79934f8241b350f7fe3 /examples/generics.rs
parente620b1e57a39f342cf73ad6ac8ab0e179b97bfd5 (diff)
downloadrtic-e97afa71ce7bf3d78e257de1aab329135e98c721.tar.gz
rtic-e97afa71ce7bf3d78e257de1aab329135e98c721.tar.zst
rtic-e97afa71ce7bf3d78e257de1aab329135e98c721.zip
peripherals as scoped singletons
Diffstat (limited to 'examples/generics.rs')
-rw-r--r--examples/generics.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/examples/generics.rs b/examples/generics.rs
index 57c9b8eb..afcafa0a 100644
--- a/examples/generics.rs
+++ b/examples/generics.rs
@@ -12,6 +12,11 @@ use stm32f103xx::{SPI1, GPIOA};
app! {
device: stm32f103xx,
+ resources: {
+ static GPIOA: GPIOA;
+ static SPI1: SPI1;
+ },
+
tasks: {
EXTI0: {
path: exti0,
@@ -27,7 +32,12 @@ app! {
},
}
-fn init(_p: init::Peripherals) {}
+fn init(p: init::Peripherals) -> init::LateResourceValues {
+ init::LateResourceValues {
+ GPIOA: p.device.GPIOA,
+ SPI1: p.device.SPI1,
+ }
+}
fn idle() -> ! {
loop {