mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-30 15:34:33 +01:00
wip4, benchmark
This commit is contained in:
parent
7c504668da
commit
245f4f9b6e
2 changed files with 40 additions and 1 deletions
|
@ -25,7 +25,7 @@ const APP: () = {
|
||||||
|
|
||||||
// when omitted priority is assumed to be `1`
|
// when omitted priority is assumed to be `1`
|
||||||
#[task(binds = GPIOA, resources = [shared, shared2])]
|
#[task(binds = GPIOA, resources = [shared, shared2])]
|
||||||
fn gpioa(mut c: gpioa::Context) {
|
fn gpioa(c: gpioa::Context) {
|
||||||
c.resources.shared.lock(|shared| {
|
c.resources.shared.lock(|shared| {
|
||||||
*shared += 1;
|
*shared += 1;
|
||||||
rtic::pend(Interrupt::GPIOB);
|
rtic::pend(Interrupt::GPIOB);
|
||||||
|
|
39
examples/lock2_minimal.rs
Normal file
39
examples/lock2_minimal.rs
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
//! examples/lock2.rs
|
||||||
|
|
||||||
|
#![deny(unsafe_code)]
|
||||||
|
#![deny(warnings)]
|
||||||
|
#![no_main]
|
||||||
|
#![no_std]
|
||||||
|
|
||||||
|
use cortex_m_semihosting::debug;
|
||||||
|
use lm3s6965::Interrupt;
|
||||||
|
use panic_semihosting as _;
|
||||||
|
|
||||||
|
#[rtic::app(device = lm3s6965)]
|
||||||
|
const APP: () = {
|
||||||
|
struct Resources {
|
||||||
|
#[init(0)]
|
||||||
|
shared: u32,
|
||||||
|
#[init(0)]
|
||||||
|
shared2: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[init]
|
||||||
|
fn init(_: init::Context) {
|
||||||
|
rtic::pend(Interrupt::GPIOA);
|
||||||
|
debug::exit(debug::EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// when omitted priority is assumed to be `1`
|
||||||
|
#[task(binds = GPIOA, resources = [shared, shared2])]
|
||||||
|
fn gpioa(c: gpioa::Context) {
|
||||||
|
c.resources.shared.lock(|shared| {
|
||||||
|
*shared += 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[task(binds = GPIOB, priority = 2, resources = [shared, shared2])]
|
||||||
|
fn gpiob(c: gpiob::Context) {
|
||||||
|
*c.resources.shared += 1;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue