aboutsummaryrefslogtreecommitdiff
path: root/examples/resource-user-struct.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/resource-user-struct.rs')
-rw-r--r--examples/resource-user-struct.rs26
1 files changed, 14 insertions, 12 deletions
diff --git a/examples/resource-user-struct.rs b/examples/resource-user-struct.rs
index 6ad540b0..1ebaa59e 100644
--- a/examples/resource-user-struct.rs
+++ b/examples/resource-user-struct.rs
@@ -12,26 +12,28 @@ mod app {
use cortex_m_semihosting::{debug, hprintln};
use lm3s6965::Interrupt;
- #[resources]
- struct Resources {
+ #[shared]
+ struct Shared {
// A resource
- #[init(0)]
shared: u32,
}
// Should not collide with the struct above
#[allow(dead_code)]
- struct Resources2 {
+ struct Shared2 {
// A resource
shared: u32,
}
+ #[local]
+ struct Local {}
+
#[init]
- fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
+ fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
rtic::pend(Interrupt::UART0);
rtic::pend(Interrupt::UART1);
- (init::LateResources {}, init::Monotonics())
+ (Shared { shared: 0 }, Local {}, init::Monotonics())
}
// `shared` cannot be accessed from this context
@@ -39,16 +41,16 @@ mod app {
fn idle(_cx: idle::Context) -> ! {
debug::exit(debug::EXIT_SUCCESS);
- // error: no `resources` field in `idle::Context`
- // _cx.resources.shared += 1;
+ // error: no `shared` field in `idle::Context`
+ // _cx.shared.shared += 1;
loop {}
}
// `shared` can be accessed from this context
- #[task(binds = UART0, resources = [shared])]
+ #[task(binds = UART0, shared = [shared])]
fn uart0(mut cx: uart0::Context) {
- let shared = cx.resources.shared.lock(|shared| {
+ let shared = cx.shared.shared.lock(|shared| {
*shared += 1;
*shared
});
@@ -57,9 +59,9 @@ mod app {
}
// `shared` can be accessed from this context
- #[task(binds = UART1, resources = [shared])]
+ #[task(binds = UART1, shared = [shared])]
fn uart1(mut cx: uart1::Context) {
- let shared = cx.resources.shared.lock(|shared| {
+ let shared = cx.shared.shared.lock(|shared| {
*shared += 1;
*shared
});
origin/main Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/docs (unfollow)
AgeCommit message (Collapse)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
* Fixes #3512 * Fix `clearTimeout` and `clearInterval` not cancelling jobs same-tick --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-05Fixes #3515 (#3523)Gravatar Jarred Sumner 4-190/+182
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-05Fixes #3520 (#3522)Gravatar Jarred Sumner 3-23/+37
* Fixes #3520 * Update html_rewriter.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2023-07-05add envs on tests (#3518)Gravatar Ciro Spaciari 4-0/+20
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
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
cc @dylan-conway this was the cause
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
* fix servername * add postgres tls tests * update test packages * add basic CRUD test
2023-07-04Add alias for readBigUInt64BE ... (#3514)Gravatar Ai Hoshino 2-4/+58
* Add alias for `readBigUInt64BE` ... Close: https://github.com/oven-sh/bun/issues/3338 * add some tests for `readBigUint64BE` alias * format code
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