mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
cortex-m as optional dependency
This commit is contained in:
parent
3a0e2ac924
commit
6da7f63fb3
3 changed files with 25 additions and 24 deletions
|
@ -34,7 +34,7 @@ version = "2.0.0-alpha.0"
|
||||||
name = "rtic"
|
name = "rtic"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.7.0"
|
cortex-m = { version = "0.7.0", optional = true }
|
||||||
bare-metal = "1.0.0"
|
bare-metal = "1.0.0"
|
||||||
#portable-atomic = { version = "0.3.19" }
|
#portable-atomic = { version = "0.3.19" }
|
||||||
atomic-polyfill = "1"
|
atomic-polyfill = "1"
|
||||||
|
@ -65,17 +65,17 @@ trybuild = "1"
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
||||||
thumbv6-backend = ["rtic-macros/cortex-m-source-masking"]
|
thumbv6-backend = ["cortex-m", "rtic-macros/cortex-m-source-masking"]
|
||||||
thumbv7-backend = ["rtic-macros/cortex-m-basepri"]
|
thumbv7-backend = ["cortex-m", "rtic-macros/cortex-m-basepri"]
|
||||||
thumbv8base-backend = ["rtic-macros/cortex-m-source-masking"]
|
thumbv8base-backend = ["cortex-m", "rtic-macros/cortex-m-source-masking"]
|
||||||
thumbv8main-backend = ["rtic-macros/cortex-m-basepri"]
|
thumbv8main-backend = ["cortex-m", "rtic-macros/cortex-m-basepri"]
|
||||||
# riscv-clic-backend = ["rtic-macros/riscv-clic"]
|
# riscv-clic-backend = ["rtic-macros/riscv-clic"]
|
||||||
# riscv-ch32-backend = ["rtic-macros/riscv-ch32"]
|
# riscv-ch32-backend = ["rtic-macros/riscv-ch32"]
|
||||||
# riscv-esp32c3-backend = ["rtic-macros/riscv-esp32c3"]
|
# riscv-esp32c3-backend = ["rtic-macros/riscv-esp32c3"]
|
||||||
|
|
||||||
# needed for testing
|
# needed for testing
|
||||||
rtic-uitestv7 = ["thumbv7-backend", "rtic-macros/cortex-m-basepri"]
|
rtic-uitestv7 = ["thumbv7-backend"]
|
||||||
rtic-uitestv6 = ["thumbv6-backend", "rtic-macros/cortex-m-source-masking"]
|
rtic-uitestv6 = ["thumbv6-backend"]
|
||||||
test-critical-section = ["cortex-m/critical-section-single-core", "rtic-monotonics/systick-100hz"]
|
test-critical-section = ["cortex-m/critical-section-single-core", "rtic-monotonics/systick-100hz"]
|
||||||
|
|
||||||
# [[example]]
|
# [[example]]
|
||||||
|
|
|
@ -32,13 +32,23 @@ pub use cortex_source_mask::*;
|
||||||
#[cfg(any(feature = "cortex-m-source-masking", feature = "rtic-uitestv6"))]
|
#[cfg(any(feature = "cortex-m-source-masking", feature = "rtic-uitestv6"))]
|
||||||
mod cortex_source_mask;
|
mod cortex_source_mask;
|
||||||
|
|
||||||
|
#[cfg(feature = "cortex-m")]
|
||||||
|
pub use cortex_m::{interrupt::InterruptNumber, peripheral::NVIC};
|
||||||
|
|
||||||
|
/// Sets the given `interrupt` as pending
|
||||||
|
///
|
||||||
|
/// This is a convenience function around
|
||||||
|
/// [`NVIC::pend`](../cortex_m/peripheral/struct.NVIC.html#method.pend)
|
||||||
|
#[cfg(feature = "cortex-m")]
|
||||||
|
pub fn pend<I>(interrupt: I)
|
||||||
|
where
|
||||||
|
I: InterruptNumber,
|
||||||
|
{
|
||||||
|
NVIC::pend(interrupt);
|
||||||
|
}
|
||||||
|
|
||||||
/// Priority conversion, takes logical priorities 1..=N and converts it to NVIC priority.
|
/// Priority conversion, takes logical priorities 1..=N and converts it to NVIC priority.
|
||||||
#[cfg(any(
|
#[cfg(feature = "cortex-m")]
|
||||||
feature = "cortex-m-basepri",
|
|
||||||
feature = "cortex-m-source-masking",
|
|
||||||
feature = "rtic-uitestv6",
|
|
||||||
feature = "rtic-uitestv7",
|
|
||||||
))]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn cortex_logical2hw(logical: u8, nvic_prio_bits: u8) -> u8 {
|
pub const fn cortex_logical2hw(logical: u8, nvic_prio_bits: u8) -> u8 {
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
//deny_warnings_placeholder_for_ci
|
//deny_warnings_placeholder_for_ci
|
||||||
#![allow(clippy::inline_always)]
|
#![allow(clippy::inline_always)]
|
||||||
|
|
||||||
use cortex_m::{interrupt::InterruptNumber, peripheral::NVIC};
|
|
||||||
pub use rtic_core::{prelude as mutex_prelude, Exclusive, Mutex};
|
pub use rtic_core::{prelude as mutex_prelude, Exclusive, Mutex};
|
||||||
pub use rtic_macros::app;
|
pub use rtic_macros::app;
|
||||||
// pub use rtic_monotonic::{self, Monotonic};
|
// pub use rtic_monotonic::{self, Monotonic};
|
||||||
|
@ -47,16 +46,8 @@ pub mod mutex {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub mod export;
|
pub mod export;
|
||||||
|
|
||||||
/// Sets the given `interrupt` as pending
|
#[cfg(feature = "cortex-m")]
|
||||||
///
|
pub use export::pend;
|
||||||
/// This is a convenience function around
|
|
||||||
/// [`NVIC::pend`](../cortex_m/peripheral/struct.NVIC.html#method.pend)
|
|
||||||
pub fn pend<I>(interrupt: I)
|
|
||||||
where
|
|
||||||
I: InterruptNumber,
|
|
||||||
{
|
|
||||||
NVIC::pend(interrupt);
|
|
||||||
}
|
|
||||||
|
|
||||||
use core::cell::UnsafeCell;
|
use core::cell::UnsafeCell;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue