コンテンツにスキップ

RTIC — Crate 詳細

RTIC

Mature no_std

RTIC(Real-Time Interrupt-driven Concurrency)フレームワーク。Cortex-M の割り込み優先度をスケジューラとして活用し、競合の少ないリアルタイムタスク設計を支援します(共有リソースの静的解析・優先度継承など)。

Real-Time Interrupt-driven Concurrency framework for Cortex-M, providing priority-based scheduling and safe resource sharing.

バージョン
2.1.1
ライセンス
MIT OR Apache-2.0
メンテナンス
活発に開発中

コード例

RTIC は割り込み優先度をスケジューリング優先度として扱い、共有資源を lock で安全に更新します。

RTIC の最小構成
#![no_std]
#![no_main]
use panic_probe as _;
#[rtic::app(device = stm32f4xx_hal::pac, peripherals = true)]
mod app {
#[shared]
struct Shared {
counter: u32,
}
#[local]
struct Local {}
#[init]
fn init(_cx: init::Context) -> (Shared, Local) {
(Shared { counter: 0 }, Local {})
}
#[task(shared = [counter])]
fn work(mut cx: work::Context) {
cx.shared.counter.lock(|c| *c += 1);
}
}

関連 Crates