From 32b537aef63a2f69c5abc83b0af3fd88205ce0ce Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Wed, 1 Mar 2023 20:11:00 +0100 Subject: [PATCH] Merge arbiter and channel into sync --- Cargo.toml | 3 +- rtic-arbiter/Cargo.toml | 29 ------------------- rtic-channel/.gitignore | 2 -- rtic-channel/CHANGELOG.md | 16 ---------- {rtic-arbiter => rtic-sync}/.gitignore | 0 {rtic-arbiter => rtic-sync}/CHANGELOG.md | 0 {rtic-channel => rtic-sync}/Cargo.toml | 4 +-- .../src/lib.rs => rtic-sync/src/arbiter.rs | 8 ----- .../src/lib.rs => rtic-sync/src/channel.rs | 8 ----- rtic-sync/src/lib.rs | 12 ++++++++ rtic/Cargo.toml | 2 +- rtic/examples/async-channel-done.rs | 2 +- rtic/examples/async-channel-no-receiver.rs | 2 +- rtic/examples/async-channel-no-sender.rs | 2 +- rtic/examples/async-channel-try.rs | 2 +- rtic/examples/async-channel.rs | 2 +- 16 files changed, 21 insertions(+), 73 deletions(-) delete mode 100644 rtic-arbiter/Cargo.toml delete mode 100644 rtic-channel/.gitignore delete mode 100644 rtic-channel/CHANGELOG.md rename {rtic-arbiter => rtic-sync}/.gitignore (100%) rename {rtic-arbiter => rtic-sync}/CHANGELOG.md (100%) rename {rtic-channel => rtic-sync}/Cargo.toml (89%) rename rtic-arbiter/src/lib.rs => rtic-sync/src/arbiter.rs (98%) rename rtic-channel/src/lib.rs => rtic-sync/src/channel.rs (99%) create mode 100644 rtic-sync/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index c049e5471a..888a6eecc9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,7 @@ [workspace] members = [ "rtic", - "rtic-arbiter", - "rtic-channel", + "rtic-sync", "rtic-common", "rtic-macros", "rtic-monotonics", diff --git a/rtic-arbiter/Cargo.toml b/rtic-arbiter/Cargo.toml deleted file mode 100644 index d8b18c409f..0000000000 --- a/rtic-arbiter/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "rtic-arbiter" -version = "1.0.0-alpha.0" - -edition = "2021" -authors = [ - "The Real-Time Interrupt-driven Concurrency developers", - "Emil Fresk ", - "Henrik Tjäder ", - "Jorge Aparicio ", - "Per Lindgren ", -] -categories = ["concurrency", "embedded", "no-std", "asynchronous"] -description = "rtic-arbiter lib TODO" -license = "MIT OR Apache-2.0" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -critical-section = "1" -rtic-common = { version = "1.0.0-alpha.0", path = "../rtic-common" } - -[dev-dependencies] -tokio = { version = "1", features = ["rt", "macros", "time"] } - - -[features] -default = [] -testing = ["critical-section/std", "rtic-common/testing"] diff --git a/rtic-channel/.gitignore b/rtic-channel/.gitignore deleted file mode 100644 index 1e7caa9ea8..0000000000 --- a/rtic-channel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -Cargo.lock -target/ diff --git a/rtic-channel/CHANGELOG.md b/rtic-channel/CHANGELOG.md deleted file mode 100644 index d3a9d846ee..0000000000 --- a/rtic-channel/CHANGELOG.md +++ /dev/null @@ -1,16 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -This project adheres to [Semantic Versioning](http://semver.org/). - -For each category, *Added*, *Changed*, *Fixed* add new entries at the top! - -## [Unreleased] - -### Added - -### Changed - -### Fixed - -## [v1.0.0] - 2023-xx-xx diff --git a/rtic-arbiter/.gitignore b/rtic-sync/.gitignore similarity index 100% rename from rtic-arbiter/.gitignore rename to rtic-sync/.gitignore diff --git a/rtic-arbiter/CHANGELOG.md b/rtic-sync/CHANGELOG.md similarity index 100% rename from rtic-arbiter/CHANGELOG.md rename to rtic-sync/CHANGELOG.md diff --git a/rtic-channel/Cargo.toml b/rtic-sync/Cargo.toml similarity index 89% rename from rtic-channel/Cargo.toml rename to rtic-sync/Cargo.toml index 900f972b1d..440a6bebbd 100644 --- a/rtic-channel/Cargo.toml +++ b/rtic-sync/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "rtic-channel" +name = "rtic-sync" version = "1.0.0-alpha.0" edition = "2021" @@ -11,7 +11,7 @@ authors = [ "Per Lindgren ", ] categories = ["concurrency", "embedded", "no-std", "asynchronous"] -description = "rtic-channel lib TODO" +description = "Synchronization primitives for asynchronous contexts" license = "MIT OR Apache-2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/rtic-arbiter/src/lib.rs b/rtic-sync/src/arbiter.rs similarity index 98% rename from rtic-arbiter/src/lib.rs rename to rtic-sync/src/arbiter.rs index c70fbf5715..d50b1ea9b5 100644 --- a/rtic-arbiter/src/lib.rs +++ b/rtic-sync/src/arbiter.rs @@ -1,9 +1,5 @@ //! Crate -#![no_std] -#![deny(missing_docs)] -//deny_warnings_placeholder_for_ci - use core::cell::UnsafeCell; use core::future::poll_fn; use core::ops::{Deref, DerefMut}; @@ -172,10 +168,6 @@ impl<'a, T> DerefMut for ExclusiveAccess<'a, T> { } } -#[cfg(test)] -#[macro_use] -extern crate std; - #[cfg(test)] mod tests { use super::*; diff --git a/rtic-channel/src/lib.rs b/rtic-sync/src/channel.rs similarity index 99% rename from rtic-channel/src/lib.rs rename to rtic-sync/src/channel.rs index a4e49358ac..8a817c81ba 100644 --- a/rtic-channel/src/lib.rs +++ b/rtic-sync/src/channel.rs @@ -1,9 +1,5 @@ //! Crate -#![no_std] -#![deny(missing_docs)] -//deny_warnings_placeholder_for_ci - use core::{ cell::UnsafeCell, future::poll_fn, @@ -463,10 +459,6 @@ impl<'a, T, const N: usize> Drop for Receiver<'a, T, N> { } } -#[cfg(test)] -#[macro_use] -extern crate std; - #[cfg(test)] mod tests { use super::*; diff --git a/rtic-sync/src/lib.rs b/rtic-sync/src/lib.rs new file mode 100644 index 0000000000..ac062205a8 --- /dev/null +++ b/rtic-sync/src/lib.rs @@ -0,0 +1,12 @@ +//! Synchronization primitives for asynchronous contexts. + +#![no_std] +#![deny(missing_docs)] +//deny_warnings_placeholder_for_ci + +pub mod arbiter; +pub mod channel; + +#[cfg(test)] +#[macro_use] +extern crate std; diff --git a/rtic/Cargo.toml b/rtic/Cargo.toml index 51a580e8df..20aa6de28e 100644 --- a/rtic/Cargo.toml +++ b/rtic/Cargo.toml @@ -47,7 +47,7 @@ heapless = "0.7.7" lm3s6965 = "0.1.3" cortex-m-semihosting = "0.5.0" rtic-time = { path = "../rtic-time" } -rtic-channel = { path = "../rtic-channel" } +rtic-sync = { path = "../rtic-sync" } rtic-monotonics = { path = "../rtic-monotonics", features = ["cortex_m_systick"] } [dev-dependencies.futures] diff --git a/rtic/examples/async-channel-done.rs b/rtic/examples/async-channel-done.rs index 04d94ff66a..62ed656c68 100644 --- a/rtic/examples/async-channel-done.rs +++ b/rtic/examples/async-channel-done.rs @@ -12,7 +12,7 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965, dispatchers = [SSI0])] mod app { use cortex_m_semihosting::{debug, hprintln}; - use rtic_channel::*; + use rtic_sync::{channel::*, make_channel}; #[shared] struct Shared {} diff --git a/rtic/examples/async-channel-no-receiver.rs b/rtic/examples/async-channel-no-receiver.rs index ccf0070361..ab590e6236 100644 --- a/rtic/examples/async-channel-no-receiver.rs +++ b/rtic/examples/async-channel-no-receiver.rs @@ -12,7 +12,7 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965, dispatchers = [SSI0])] mod app { use cortex_m_semihosting::{debug, hprintln}; - use rtic_channel::*; + use rtic_sync::{channel::*, make_channel}; #[shared] struct Shared {} diff --git a/rtic/examples/async-channel-no-sender.rs b/rtic/examples/async-channel-no-sender.rs index 0705ecdb26..852dc1d27f 100644 --- a/rtic/examples/async-channel-no-sender.rs +++ b/rtic/examples/async-channel-no-sender.rs @@ -12,7 +12,7 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965, dispatchers = [SSI0])] mod app { use cortex_m_semihosting::{debug, hprintln}; - use rtic_channel::*; + use rtic_sync::{channel::*, make_channel}; #[shared] struct Shared {} diff --git a/rtic/examples/async-channel-try.rs b/rtic/examples/async-channel-try.rs index 26c8a4fb37..54a51d9e84 100644 --- a/rtic/examples/async-channel-try.rs +++ b/rtic/examples/async-channel-try.rs @@ -12,7 +12,7 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965, dispatchers = [SSI0])] mod app { use cortex_m_semihosting::{debug, hprintln}; - use rtic_channel::*; + use rtic_sync::{channel::*, make_channel}; #[shared] struct Shared {} diff --git a/rtic/examples/async-channel.rs b/rtic/examples/async-channel.rs index d85b3b55a6..9798901a4d 100644 --- a/rtic/examples/async-channel.rs +++ b/rtic/examples/async-channel.rs @@ -12,7 +12,7 @@ use panic_semihosting as _; #[rtic::app(device = lm3s6965, dispatchers = [SSI0])] mod app { use cortex_m_semihosting::{debug, hprintln}; - use rtic_channel::*; + use rtic_sync::{channel::*, make_channel}; #[shared] struct Shared {}