Skip to content

Commit

Permalink
Split into features
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth authored and niondir committed Aug 2, 2021
1 parent 10a5cb8 commit e44d1a4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
10 changes: 9 additions & 1 deletion freertos-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@ links = "freertos"

[lib]
name = "freertos_rust"
path = "src/lib.rs"
path = "src/lib.rs"

[features]
default = ["allocator", "sync", "time", "hooks", "interrupt"]
allocator = []
sync = ["interrupt"]
time = ["interrupt"]
hooks = []
interrupt = []
25 changes: 24 additions & 1 deletion freertos-rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,44 +58,67 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

#[macro_use]
#[cfg_attr(any(feature = "time", feature = "sync"), macro_use)]
extern crate alloc;

#[cfg(feature = "hooks")]
mod hooks;
mod prelude;
mod shim;

#[cfg(feature = "allocator")]
mod allocator;
mod base;
#[cfg(feature = "sync")]
mod critical;
#[cfg(feature = "time")]
mod delays;
#[cfg(feature = "interrupt")]
mod isr;
#[cfg(feature = "sync")]
mod mutex;
#[cfg(feature = "sync")]
mod queue;
#[cfg(feature = "sync")]
mod semaphore;
#[cfg(any(feature = "time", feature = "sync"))]
mod task;
#[cfg(feature = "time")]
mod timers;
#[cfg(any(feature = "time", feature = "sync"))]
mod units;
mod utils;

#[cfg(feature = "sync")]
pub mod patterns;

// Internal stuff that is only public for first Proof of Concept
pub use crate::base::*;
pub use crate::shim::*;
// ----------

#[cfg(feature = "allocator")]
pub use crate::allocator::*;
pub use crate::base::FreeRtosError;
#[cfg(feature = "sync")]
pub use crate::critical::*;
#[cfg(feature = "time")]
pub use crate::delays::*;
#[cfg(feature = "hooks")]
pub use crate::hooks::*;
#[cfg(feature = "interrupt")]
pub use crate::isr::*;
#[cfg(feature = "sync")]
pub use crate::mutex::*;
#[cfg(feature = "sync")]
pub use crate::queue::*;
#[cfg(feature = "sync")]
pub use crate::semaphore::*;
#[cfg(any(feature = "time", feature = "sync"))]
pub use crate::task::*;
#[cfg(feature = "time")]
pub use crate::timers::*;
#[cfg(any(feature = "time", feature = "sync"))]
pub use crate::units::*;

pub use crate::utils::shim_sanity_check;
1 change: 1 addition & 0 deletions freertos-rust/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub fn shim_sanity_check() -> Result<(), TypeSizeError> {
Ok(())
}

#[cfg(any(feature = "time", feature = "hooks", feature = "sync"))]
pub unsafe fn str_from_c_string(str: *const u8) -> Result<String, FreeRtosError> {
let mut buf = Vec::new();

Expand Down

0 comments on commit e44d1a4

Please sign in to comment.