aboutsummaryrefslogtreecommitdiff
path: root/examples/full-syntax.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/full-syntax.rs')
-rw-r--r--examples/full-syntax.rs40
1 files changed, 25 insertions, 15 deletions
diff --git a/examples/full-syntax.rs b/examples/full-syntax.rs
index 184349bf..20e8dfbc 100644
--- a/examples/full-syntax.rs
+++ b/examples/full-syntax.rs
@@ -1,5 +1,4 @@
//! A showcase of the `app!` macro syntax
-
#![deny(unsafe_code)]
#![feature(const_fn)]
#![feature(proc_macro)]
@@ -8,7 +7,7 @@
extern crate cortex_m_rtfm as rtfm;
extern crate stm32f103xx;
-use rtfm::{app, Resource, Threshold};
+use rtfm::{app, Threshold};
app! {
device: stm32f103xx,
@@ -21,23 +20,30 @@ app! {
},
init: {
- path: init_, // this is a path to the "init" function
+ // This is the path to the `init` function
+ //
+ // `init` doesn't necessarily has to be in the root of the crate
+ path: main::init,
},
idle: {
- path: idle_, // this is a path to the "idle" function
+ // This is a path to the `idle` function
+ //
+ // `idle` doesn't necessarily has to be in the root of the crate
+ path: main::idle,
resources: [OWNED, SHARED],
},
tasks: {
SYS_TICK: {
path: sys_tick,
- priority: 1,
+ // If omitted priority is assumed to be 1
+ // priority: 1,
resources: [CO_OWNED, ON, SHARED],
},
TIM2: {
- // tasks are enabled, between `init` and `idle`, by default but they
+ // Tasks are enabled, between `init` and `idle`, by default but they
// can start disabled if `false` is specified here
enabled: false,
path: tim2,
@@ -47,18 +53,22 @@ app! {
},
}
-fn init_(_p: init::Peripherals, _r: init::Resources) {}
+mod main {
+ use rtfm::{self, Resource, Threshold};
+
+ pub fn init(_p: ::init::Peripherals, _r: ::init::Resources) {}
-fn idle_(t: &mut Threshold, mut r: idle::Resources) -> ! {
- loop {
- *r.OWNED != *r.OWNED;
+ pub fn idle(t: &mut Threshold, mut r: ::idle::Resources) -> ! {
+ loop {
+ *r.OWNED != *r.OWNED;
- if *r.OWNED {
- if r.SHARED.claim(t, |shared, _| **shared) {
- rtfm::wfi();
+ if *r.OWNED {
+ if r.SHARED.claim(t, |shared, _| **shared) {
+ rtfm::wfi();
+ }
+ } else {
+ r.SHARED.claim_mut(t, |shared, _| **shared = !**shared);
}
- } else {
- r.SHARED.claim_mut(t, |shared, _| **shared = !**shared);
}
}
}
types/readable-stream-default'>types/readable-stream-default Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-linux-x64 (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2023-07-05Fix incorrect signaturesGravatar Ashcon Partovi 3-21/+21
2023-07-05Fix detect-libcGravatar Ashcon Partovi 16-98/+116
2023-07-05Update websocket_http_client.zigGravatar Dylan Conway 1-0/+2
2023-07-05Fixes #3512 (#3526)Gravatar Jarred Sumner 9-38/+168
2023-07-05Fixes #3515 (#3523)Gravatar Jarred Sumner 4-190/+182
2023-07-05Fixes #3520 (#3522)Gravatar Jarred Sumner 3-23/+37
2023-07-05add envs on tests (#3518)Gravatar Ciro Spaciari 4-0/+20
2023-07-04Update build-idGravatar Jarred Sumner 1-1/+1
2023-07-04Fix build determinism issue (thanks to @alexlamsl)Gravatar Jarred Sumner 1-2/+2
2023-07-04boopGravatar Jarred Sumner 10-55/+55
2023-07-04use sengrid account on nodemailer test (#3517)bun-v0.6.13Gravatar Ciro Spaciari 2-14/+15
2023-07-04[tls] fix servername (#3513)Gravatar Ciro Spaciari 4-8/+109
2023-07-04Add alias for readBigUInt64BE ... (#3514)Gravatar Ai Hoshino 2-4/+58
2023-07-04reduce countGravatar Jarred Sumner 1-2/+2
2023-07-04bumpGravatar Jarred Sumner 3-2/+2
2023-07-04Fix crashGravatar Jarred Sumner 1-5/+8