mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-16 21:05:35 +01:00
more docs, remove Ceiling / Priority / Level traits
This commit is contained in:
parent
0a6583ddc6
commit
4992db7877
15 changed files with 578 additions and 170 deletions
|
|
@ -1,6 +1,6 @@
|
|||
extern crate cortex_m_srp;
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
|
||||
use cortex_m_srp::{C1, C2, C3, C4, C5, P2, Resource};
|
||||
use rtfm::{C1, C2, C3, C4, C5, P2, Resource};
|
||||
|
||||
static R1: Resource<i32, C4> = Resource::new(0);
|
||||
static R2: Resource<i32, C3> = Resource::new(0);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
extern crate cortex_m_srp as rtfm;
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
|
||||
use rtfm::{C3, P0, P2, Resource};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
extern crate cortex_m_srp;
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
|
||||
use cortex_m_srp::{C16, C2, P1, P16, P2, P3, Resource};
|
||||
use rtfm::{C16, C2, P1, P16, P2, P3, Resource};
|
||||
|
||||
static R1: Resource<i32, C2> = Resource::new(0);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
extern crate cortex_m_srp as srp;
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
|
||||
use srp::{C2, C4, P1, P3, Resource};
|
||||
use rtfm::{C2, C4, P1, P3, Resource};
|
||||
|
||||
static R1: Resource<i32, C2> = Resource::new(0);
|
||||
|
||||
fn j1(prio: P1) {
|
||||
R1.lock(&prio, |r1, _| {
|
||||
// Would preempt this critical section
|
||||
// srp::request(j2);
|
||||
// rtfm::request(j2);
|
||||
});
|
||||
}
|
||||
|
||||
fn j2(prio: P3) {
|
||||
srp::critical(|ceil| {
|
||||
rtfm::critical(|ceil| {
|
||||
let r1 = R1.borrow(&prio, &ceil);
|
||||
//~^ error
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
extern crate cortex_m_srp as srp;
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
|
||||
use srp::{C2, C4, P1, P3, Resource};
|
||||
use rtfm::{C2, C4, P1, P3, Resource};
|
||||
|
||||
static R1: Resource<i32, C2> = Resource::new(0);
|
||||
static R2: Resource<i32, C4> = Resource::new(0);
|
||||
|
|
@ -8,7 +8,7 @@ static R2: Resource<i32, C4> = Resource::new(0);
|
|||
fn j1(prio: P1) {
|
||||
R1.lock(&prio, |r1, _| {
|
||||
// Would preempt this critical section
|
||||
// srp::request(j2);
|
||||
// rtfm::request(j2);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
// error-pattern: no associated item named `hw`
|
||||
// error-pattern: type mismatch
|
||||
|
||||
#![feature(used)]
|
||||
|
||||
extern crate core;
|
||||
extern crate cortex_m;
|
||||
#[macro_use]
|
||||
extern crate cortex_m_srp;
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
|
||||
use cortex_m_srp::{C16, P0, P1};
|
||||
use rtfm::{C16, P0, P1};
|
||||
use device::interrupt::Exti0;
|
||||
|
||||
/// Tasks can't have priority 0. Only idle has priority 0
|
||||
|
|
@ -15,9 +15,11 @@ tasks!(device, {
|
|||
j1: (Exti0, P0),
|
||||
});
|
||||
|
||||
fn init(_: C16) {}
|
||||
fn init(_: P0, _: &C16) {}
|
||||
|
||||
fn idle(_: P0) {}
|
||||
fn idle(_: P0) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn j1(_task: Exti0, _prio: P1) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
extern crate core;
|
||||
extern crate cortex_m;
|
||||
#[macro_use]
|
||||
extern crate cortex_m_srp;
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
|
||||
use cortex_m_srp::{C16, P0, P1, P2};
|
||||
use rtfm::{C16, P0, P1, P2};
|
||||
use device::interrupt::Exti0;
|
||||
|
||||
// WRONG: Two tasks mapped to the same interrupt handler
|
||||
|
|
@ -16,9 +16,11 @@ tasks!(device, {
|
|||
j2: (Exti0, P2),
|
||||
});
|
||||
|
||||
fn init(_: C16) {}
|
||||
fn init(_: P0, _: &C16) {}
|
||||
|
||||
fn idle(_: P0) {}
|
||||
fn idle(_: P0) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn j1(_task: Exti0, _prio: P1) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,20 +5,22 @@
|
|||
extern crate core;
|
||||
extern crate cortex_m;
|
||||
#[macro_use]
|
||||
extern crate cortex_m_srp;
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
|
||||
use cortex_m_srp::{C16, P0, P1};
|
||||
use device::interrupt::Exti0;
|
||||
use rtfm::{C16, P0, P1};
|
||||
|
||||
/// Tasks can't have priority 0. Only idle has priority 0
|
||||
tasks!(device, {
|
||||
j1: (Exti0, P1),
|
||||
});
|
||||
|
||||
fn init(_: C16) {}
|
||||
fn init(_: P0, _: &C16) {}
|
||||
|
||||
// WRONG. `idle` must have signature `fn(P1)`
|
||||
fn idle(_: P1) {}
|
||||
// WRONG. `idle` must have signature `fn(P0) -> !`
|
||||
fn idle(_: P1) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn j1(_task: Exti0, _prio: P1) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,19 +5,21 @@
|
|||
extern crate core;
|
||||
extern crate cortex_m;
|
||||
#[macro_use]
|
||||
extern crate cortex_m_srp;
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
|
||||
use cortex_m_srp::{C1, P0, P1};
|
||||
use rtfm::{C1, P0, P1};
|
||||
use device::interrupt::Exti0;
|
||||
|
||||
tasks!(device, {
|
||||
j1: (Exti0, P1),
|
||||
});
|
||||
|
||||
// WRONG. `init` must have signature `fn(P0, C16)`
|
||||
fn init(_: P0, _: C1) {}
|
||||
// WRONG. `init` must have signature `fn(P0, &C16)`
|
||||
fn init(_: P0, _: &C1) {}
|
||||
|
||||
fn idle(_: P0) {}
|
||||
fn idle(_: P0) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn j1(_task: Exti0, _prio: P1) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
extern crate core;
|
||||
extern crate cortex_m;
|
||||
#[macro_use]
|
||||
extern crate cortex_m_srp;
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
|
||||
use cortex_m_srp::{C16, P0, P1, P2};
|
||||
use device::interrupt::Exti1;
|
||||
|
|
@ -14,9 +14,11 @@ tasks!(device, {
|
|||
j1: (Exti0, P1),
|
||||
});
|
||||
|
||||
fn init(_: C16) {}
|
||||
fn init(_: P0, _: &C16) {}
|
||||
|
||||
fn idle(_: P0) {}
|
||||
fn idle(_: P0) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
// Wrong priority token. Declared P1, got P2
|
||||
fn j1(_task: Exti1, _prio: P1) {}
|
||||
|
|
|
|||
|
|
@ -5,18 +5,20 @@
|
|||
extern crate core;
|
||||
extern crate cortex_m;
|
||||
#[macro_use]
|
||||
extern crate cortex_m_srp;
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
|
||||
use cortex_m_srp::{C16, P0, P1};
|
||||
use cortex_mrtfm::{C16, P0, P1};
|
||||
use device::interrupt::Exti1;
|
||||
|
||||
tasks!(device, {
|
||||
j1: (Exti0, P1),
|
||||
});
|
||||
|
||||
fn init(_: C16) {}
|
||||
fn init(_: P0, _: &C16) {}
|
||||
|
||||
fn idle(_: P0) {}
|
||||
fn idle(_: P0) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
// Wrong task token. Declared Exti0, got Exti1
|
||||
fn j1(_task: Exti1, _prio: P1) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue