Skip to content

Commit 22cdc79

Browse files
committed
Organize features
1 parent a597a5b commit 22cdc79

File tree

4 files changed

+11
-59
lines changed

4 files changed

+11
-59
lines changed

freertos-rust-examples/Cargo.toml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ Create to use FreeRTOS in rust projects. It contains binaries for demos on some
1414
[target.thumbv7m-none-eabi.dependencies]
1515
cortex-m = "0.7"
1616
cortex-m-rt = "0.7"
17-
freertos-next = { path = "../freertos-rust", features = [
18-
"critical_section_impl",
19-
] }
17+
freertos-next = { path = "../freertos-rust", features = ["standard"] }
2018
stm32f1xx-hal = { version = "0.10", features = [
2119
"rt",
2220
"stm32f103",
@@ -35,22 +33,16 @@ Create to use FreeRTOS in rust projects. It contains binaries for demos on some
3533
[target."thumbv8m.main-none-eabihf".dependencies]
3634
cortex-m = "0.7"
3735
cortex-m-rt = "0.7"
38-
freertos-next = { path = "../freertos-rust", features = [
39-
"critical_section_impl",
40-
] }
36+
freertos-next = { path = "../freertos-rust", features = ["standard"] }
4137
nrf9160-pac = { version = "0.12", features = ["rt"] }
4238

4339
# Example: win
4440
[target.x86_64-pc-windows-msvc.dependencies]
45-
freertos-next = { path = "../freertos-rust", features = [
46-
"critical_section_impl",
47-
] }
41+
freertos-next = { path = "../freertos-rust", features = ["standard"] }
4842

4943
# Example: linux
5044
[target.x86_64-unknown-linux-gnu.dependencies]
51-
freertos-next = { path = "../freertos-rust", features = [
52-
"critical_section_impl",
53-
] }
45+
freertos-next = { path = "../freertos-rust", features = ["standard"] }
5446

5547
[build-dependencies]
5648
freertos-build = { path = "../freertos-cargo-build" }

freertos-rust/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ The freertos-build crate can be used to build and link FreeRTOS from source insi
1818
path = "src/lib.rs"
1919

2020
[features]
21-
default = ["allocator", "sync", "time", "hooks", "interrupt", "delete_task"]
21+
default = ["minimum"]
22+
23+
minimum = ["allocator", "sync", "time"]
24+
standard = ["minimum", "hooks", "delete_task", "critical_section_impl"]
2225

2326
allocator = []
2427
cpu_clock = []
@@ -27,7 +30,6 @@ The freertos-build crate can be used to build and link FreeRTOS from source insi
2730
delete_task = []
2831
hooks = []
2932
interrupt = []
30-
std = ["critical-section/std"]
3133
sync = ["interrupt"]
3234
time = ["interrupt"]
3335

freertos-rust/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ mod event_group;
8181
mod isr;
8282
#[cfg(feature = "sync")]
8383
mod mutex;
84+
#[cfg(cortex_m)]
8485
mod os_traits_impls;
8586
#[cfg(feature = "sync")]
8687
mod queue;
@@ -117,6 +118,8 @@ pub use crate::hooks::*;
117118
pub use crate::isr::*;
118119
#[cfg(feature = "sync")]
119120
pub use crate::mutex::*;
121+
#[cfg(cortex_m)]
122+
pub use crate::os_traits_impls::*;
120123
#[cfg(feature = "sync")]
121124
pub use crate::queue::*;
122125
#[cfg(feature = "sync")]
@@ -127,8 +130,6 @@ pub use crate::task::*;
127130
pub use crate::timers::*;
128131
#[cfg(any(feature = "time", feature = "sync"))]
129132
pub use crate::units::*;
130-
131-
pub use crate::os_traits_impls::*;
132133
#[cfg(feature = "cpu_clock")]
133134
pub use crate::utils::cpu_clock_hz;
134135
pub use crate::utils::shim_sanity_check;

freertos-rust/src/os_traits_impls.rs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -349,46 +349,3 @@ mod sys_tick_timeout {
349349
}
350350
}
351351
}
352-
353-
#[cfg(not(cortex_m))]
354-
pub use other_timeout::*;
355-
#[cfg(not(cortex_m))]
356-
mod other_timeout {
357-
use super::*;
358-
359-
#[derive(Clone, Copy)]
360-
pub struct FreeRtosTimeoutState {
361-
timeout: u32,
362-
}
363-
364-
impl FreeRtosTimeoutState {
365-
pub fn new_ns(timeout: u32) -> Self {
366-
Self::new(timeout)
367-
}
368-
369-
pub fn new_us(timeout: u32) -> Self {
370-
Self::new(timeout)
371-
}
372-
373-
pub fn new_ms(timeout: u32) -> Self {
374-
Self::new(timeout)
375-
}
376-
377-
fn new(timeout: u32) -> Self {
378-
Self { timeout }
379-
}
380-
}
381-
382-
impl TimeoutState for FreeRtosTimeoutState {
383-
/// Can be reused without calling `restart()`.
384-
#[inline]
385-
fn timeout(&mut self) -> bool {
386-
true
387-
}
388-
389-
#[inline]
390-
fn restart(&mut self) {
391-
self.timeout = 0;
392-
}
393-
}
394-
}

0 commit comments

Comments
 (0)