diff options
Diffstat (limited to 'book/en/src/by-example/tips.md')
| -rw-r--r-- | book/en/src/by-example/tips.md | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/book/en/src/by-example/tips.md b/book/en/src/by-example/tips.md index b923ed0..ce9bba8 100644 --- a/book/en/src/by-example/tips.md +++ b/book/en/src/by-example/tips.md @@ -8,15 +8,15 @@ appear as *different* types in different contexts one cannot refactor a common operation that uses resources into a plain function; however, such refactor is possible using *generics*. -All resource proxies implement the `rtfm::Mutex` trait. On the other hand, +All resource proxies implement the `rtic::Mutex` trait. On the other hand, unique references (`&mut-`) do *not* implement this trait (due to limitations in -the trait system) but one can wrap these references in the [`rtfm::Exclusive`] +the trait system) but one can wrap these references in the [`rtic::Exclusive`] newtype which does implement the `Mutex` trait. With the help of this newtype one can write a generic function that operates on generic resources and call it from different tasks to perform some operation on the same set of resources. Here's one such example: -[`rtfm::Exclusive`]: ../../../api/rtfm/struct.Exclusive.html +[`rtic::Exclusive`]: ../../../api/rtic/struct.Exclusive.html ``` rust {{#include ../../../../examples/generics.rs}} @@ -51,8 +51,8 @@ $ cargo run --example cfg ## Running tasks from RAM -The main goal of moving the specification of RTFM applications to attributes in -RTFM v0.4.0 was to allow inter-operation with other attributes. For example, the +The main goal of moving the specification of RTIC applications to attributes in +RTIC v0.4.0 was to allow inter-operation with other attributes. For example, the `link_section` attribute can be applied to tasks to place them in RAM; this can improve performance in some cases. @@ -119,22 +119,22 @@ $ cargo run --example pool ## Inspecting the expanded code -`#[rtfm::app]` is a procedural macro that produces support code. If for some +`#[rtic::app]` is a procedural macro that produces support code. If for some reason you need to inspect the code generated by this macro you have two options: -You can inspect the file `rtfm-expansion.rs` inside the `target` directory. This -file contains the expansion of the `#[rtfm::app]` item (not your whole program!) -of the *last built* (via `cargo build` or `cargo check`) RTFM application. The +You can inspect the file `rtic-expansion.rs` inside the `target` directory. This +file contains the expansion of the `#[rtic::app]` item (not your whole program!) +of the *last built* (via `cargo build` or `cargo check`) RTIC application. The expanded code is not pretty printed by default so you'll want to run `rustfmt` over it before you read it. ``` console $ cargo build --example foo -$ rustfmt target/rtfm-expansion.rs +$ rustfmt target/rtic-expansion.rs -$ tail target/rtfm-expansion.rs +$ tail target/rtic-expansion.rs ``` ``` rust @@ -144,19 +144,19 @@ const APP: () = { use lm3s6965 as _; #[no_mangle] unsafe extern "C" fn main() -> ! { - rtfm::export::interrupt::disable(); - let mut core: rtfm::export::Peripherals = core::mem::transmute(()); + rtic::export::interrupt::disable(); + let mut core: rtic::export::Peripherals = core::mem::transmute(()); core.SCB.scr.modify(|r| r | 1 << 1); - rtfm::export::interrupt::enable(); + rtic::export::interrupt::enable(); loop { - rtfm::export::wfi() + rtic::export::wfi() } } }; ``` Or, you can use the [`cargo-expand`] subcommand. This subcommand will expand -*all* the macros, including the `#[rtfm::app]` attribute, and modules in your +*all* the macros, including the `#[rtic::app]` attribute, and modules in your crate and print the output to the console. [`cargo-expand`]: https://crates.io/crates/cargo-expand |
