mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
updated docs and examples
This commit is contained in:
parent
c7e6385234
commit
12d2fa5fd3
3 changed files with 12 additions and 2 deletions
|
@ -36,7 +36,6 @@ mod app {
|
||||||
|
|
||||||
This works also for ram functions, see examples/ramfunc.rs
|
This works also for ram functions, see examples/ramfunc.rs
|
||||||
|
|
||||||
|
|
||||||
## Module instead of Const
|
## Module instead of Const
|
||||||
|
|
||||||
With the support of attributes on modules the `const APP` workaround is not needed.
|
With the support of attributes on modules the `const APP` workaround is not needed.
|
||||||
|
@ -125,3 +124,13 @@ struct whateveryouwant {
|
||||||
```
|
```
|
||||||
|
|
||||||
would work equally well.
|
would work equally well.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Additions
|
||||||
|
|
||||||
|
## Extern tasks
|
||||||
|
|
||||||
|
Both software and hardware tasks can now be defined external to the `mod app`. Previously this was possible only by implementing a trampoline calling out the task implementation.
|
||||||
|
|
||||||
|
See examples `examples/extern_binds.rs` and `examples/extern_spawn.rs`.
|
|
@ -8,11 +8,11 @@
|
||||||
use cortex_m_semihosting::hprintln;
|
use cortex_m_semihosting::hprintln;
|
||||||
use panic_semihosting as _;
|
use panic_semihosting as _;
|
||||||
|
|
||||||
|
// Free function implementing the interrupt bound task `foo`.
|
||||||
fn foo(_: app::foo::Context) {
|
fn foo(_: app::foo::Context) {
|
||||||
hprintln!("foo called").ok();
|
hprintln!("foo called").ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
// `examples/interrupt.rs` rewritten to use `binds`
|
|
||||||
#[rtic::app(device = lm3s6965)]
|
#[rtic::app(device = lm3s6965)]
|
||||||
mod app {
|
mod app {
|
||||||
use crate::foo;
|
use crate::foo;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
use cortex_m_semihosting::{debug, hprintln};
|
use cortex_m_semihosting::{debug, hprintln};
|
||||||
use panic_semihosting as _;
|
use panic_semihosting as _;
|
||||||
|
|
||||||
|
// Free function implementing the spawnable task `foo`.
|
||||||
fn foo(_c: app::foo::Context, x: i32, y: u32) {
|
fn foo(_c: app::foo::Context, x: i32, y: u32) {
|
||||||
hprintln!("foo {}, {}", x, y).unwrap();
|
hprintln!("foo {}, {}", x, y).unwrap();
|
||||||
if x == 2 {
|
if x == 2 {
|
||||||
|
|
Loading…
Reference in a new issue