2019-08-21 10:17:27 +02:00
|
|
|
//! examples/preempt.rs
|
|
|
|
|
|
|
|
#![no_main]
|
|
|
|
#![no_std]
|
|
|
|
|
|
|
|
use cortex_m_semihosting::{debug, hprintln};
|
|
|
|
use lm3s6965::Interrupt;
|
|
|
|
use panic_semihosting as _;
|
2020-06-11 19:18:29 +02:00
|
|
|
use rtic::app;
|
2019-08-21 10:17:27 +02:00
|
|
|
|
|
|
|
#[app(device = lm3s6965)]
|
2020-05-19 20:00:13 +02:00
|
|
|
mod app {
|
2019-08-21 10:17:27 +02:00
|
|
|
#[init]
|
|
|
|
fn init(_: init::Context) {
|
2020-06-11 19:18:29 +02:00
|
|
|
rtic::pend(Interrupt::GPIOA);
|
2019-08-21 10:17:27 +02:00
|
|
|
}
|
|
|
|
|
2019-08-21 10:53:13 +02:00
|
|
|
#[task(binds = GPIOA, priority = 1)]
|
|
|
|
fn gpioa(_: gpioa::Context) {
|
|
|
|
hprintln!("GPIOA - start").unwrap();
|
2020-06-11 19:18:29 +02:00
|
|
|
rtic::pend(Interrupt::GPIOC);
|
2019-08-21 10:53:13 +02:00
|
|
|
hprintln!("GPIOA - end").unwrap();
|
2019-08-21 10:17:27 +02:00
|
|
|
debug::exit(debug::EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2019-08-21 10:53:13 +02:00
|
|
|
#[task(binds = GPIOB, priority = 2)]
|
|
|
|
fn gpiob(_: gpiob::Context) {
|
|
|
|
hprintln!(" GPIOB").unwrap();
|
2019-08-21 10:17:27 +02:00
|
|
|
}
|
|
|
|
|
2019-08-21 10:53:13 +02:00
|
|
|
#[task(binds = GPIOC, priority = 2)]
|
|
|
|
fn gpioc(_: gpioc::Context) {
|
|
|
|
hprintln!(" GPIOC - start").unwrap();
|
2020-06-11 19:18:29 +02:00
|
|
|
rtic::pend(Interrupt::GPIOB);
|
2019-08-21 10:53:13 +02:00
|
|
|
hprintln!(" GPIOC - end").unwrap();
|
2019-08-21 10:17:27 +02:00
|
|
|
}
|
2020-04-22 12:58:14 +02:00
|
|
|
}
|