rtic/examples/t-binds.rs

35 lines
718 B
Rust
Raw Permalink Normal View History

//! [compile-pass] Check that `binds` works as advertised
2019-04-21 20:13:15 +02:00
#![deny(unsafe_code)]
#![deny(warnings)]
2019-02-23 21:50:52 +01:00
#![no_main]
#![no_std]
2021-03-03 08:53:03 +01:00
use panic_semihosting as _;
2019-02-23 21:50:52 +01:00
2020-06-11 19:18:29 +02:00
#[rtic::app(device = lm3s6965)]
2020-05-19 20:00:13 +02:00
mod app {
2019-02-23 21:50:52 +01:00
#[init]
2021-02-20 19:22:45 +01:00
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
(init::LateResources {}, init::Monotonics())
2020-10-01 19:38:49 +02:00
}
2019-02-23 21:50:52 +01:00
2019-06-20 06:19:59 +02:00
// Cortex-M exception
#[task(binds = SVCall)]
2019-04-21 20:13:15 +02:00
fn foo(c: foo::Context) {
2020-10-15 18:50:17 +02:00
crate::foo_trampoline(c)
2019-04-21 20:13:15 +02:00
}
2019-02-23 21:50:52 +01:00
2019-06-20 06:19:59 +02:00
// LM3S6965 interrupt
#[task(binds = UART0)]
2019-04-21 20:13:15 +02:00
fn bar(c: bar::Context) {
2020-10-15 18:50:17 +02:00
crate::bar_trampoline(c)
2019-04-21 20:13:15 +02:00
}
2020-04-22 12:58:14 +02:00
}
2019-02-23 21:50:52 +01:00
2019-02-23 21:56:05 +01:00
#[allow(dead_code)]
2020-10-15 18:50:17 +02:00
fn foo_trampoline(_: app::foo::Context) {}
2019-02-23 21:50:52 +01:00
2019-02-23 21:56:05 +01:00
#[allow(dead_code)]
2020-10-15 18:50:17 +02:00
fn bar_trampoline(_: app::bar::Context) {}