mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 12:12:50 +01:00
rtic-sync: Remove unstable flag, and add defmt derives
This commit is contained in:
parent
7a2f605b52
commit
6df390fcdc
6 changed files with 39 additions and 13 deletions
|
@ -7,6 +7,14 @@ For each category, _Added_, _Changed_, _Fixed_ add new entries at the top!
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- Unstable features are now stable, the feature flag `unstable` is removed.
|
||||
|
||||
### Added
|
||||
|
||||
- `defmt v0.3` derives added and forwarded to `embedded-hal(-x)` crates.
|
||||
|
||||
## v1.2.0 - 2024-01-10
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "rtic-sync"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
|
||||
edition = "2021"
|
||||
authors = [
|
||||
|
@ -17,23 +17,21 @@ repository = "https://github.com/rtic-rs/rtic"
|
|||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
features = ["unstable"]
|
||||
|
||||
[dependencies]
|
||||
heapless = "0.8"
|
||||
critical-section = "1"
|
||||
rtic-common = { version = "1.0.0", path = "../rtic-common" }
|
||||
portable-atomic = { version = "1", default-features = false }
|
||||
embedded-hal = { version = "1.0", optional = true }
|
||||
embedded-hal-async = { version = "1.0", optional = true }
|
||||
embedded-hal-bus = { version = "0.1.0", optional = true, features = ["async"] }
|
||||
embedded-hal = { version = "1.0.0" }
|
||||
embedded-hal-async = { version = "1.0.0" }
|
||||
embedded-hal-bus = { version = "0.1.0", features = ["async"] }
|
||||
|
||||
defmt-03 = { package = "defmt", version = "0.3", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1", features = ["rt", "macros", "time"] }
|
||||
|
||||
|
||||
[features]
|
||||
default = []
|
||||
testing = ["critical-section/std", "rtic-common/testing"]
|
||||
unstable = ["embedded-hal", "embedded-hal-async", "embedded-hal-bus"]
|
||||
defmt-03 = ["dep:defmt-03", "embedded-hal/defmt-03", "embedded-hal-async/defmt-03", "embedded-hal-bus/defmt-03"]
|
|
@ -191,7 +191,6 @@ impl<'a, T> DerefMut for ExclusiveAccess<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
/// SPI bus sharing using [`Arbiter`]
|
||||
pub mod spi {
|
||||
use super::Arbiter;
|
||||
|
@ -274,7 +273,6 @@ pub mod spi {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
/// I2C bus sharing using [`Arbiter`]
|
||||
///
|
||||
/// An Example how to use it in RTIC application:
|
||||
|
|
|
@ -18,6 +18,9 @@ use rtic_common::{
|
|||
wait_queue::{Link, WaitQueue},
|
||||
};
|
||||
|
||||
#[cfg(feature = "defmt-03")]
|
||||
use crate::defmt;
|
||||
|
||||
/// An MPSC channel for use in no-alloc systems. `N` sets the size of the queue.
|
||||
///
|
||||
/// This channel uses critical sections, however there are extremely small and all `memcpy`
|
||||
|
@ -127,9 +130,11 @@ macro_rules! make_channel {
|
|||
// -------- Sender
|
||||
|
||||
/// Error state for when the receiver has been dropped.
|
||||
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
|
||||
pub struct NoReceiver<T>(pub T);
|
||||
|
||||
/// Errors that 'try_send` can have.
|
||||
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
|
||||
pub enum TrySendError<T> {
|
||||
/// Error state for when the receiver has been dropped.
|
||||
NoReceiver(T),
|
||||
|
@ -199,6 +204,13 @@ impl<'a, T, const N: usize> core::fmt::Debug for Sender<'a, T, N> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "defmt-03")]
|
||||
impl<'a, T, const N: usize> defmt::Format for Sender<'a, T, N> {
|
||||
fn format(&self, f: defmt::Formatter) {
|
||||
defmt::write!(f, "Sender",)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T, const N: usize> Sender<'a, T, N> {
|
||||
#[inline(always)]
|
||||
fn send_footer(&mut self, idx: u8, val: T) {
|
||||
|
@ -382,8 +394,16 @@ impl<'a, T, const N: usize> core::fmt::Debug for Receiver<'a, T, N> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "defmt-03")]
|
||||
impl<'a, T, const N: usize> defmt::Format for Receiver<'a, T, N> {
|
||||
fn format(&self, f: defmt::Formatter) {
|
||||
defmt::write!(f, "Receiver",)
|
||||
}
|
||||
}
|
||||
|
||||
/// Possible receive errors.
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum ReceiveError {
|
||||
/// Error state for when all senders has been dropped.
|
||||
NoSender,
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#![no_std]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#[cfg(feature = "defmt-03")]
|
||||
use defmt_03 as defmt;
|
||||
|
||||
pub mod arbiter;
|
||||
pub mod channel;
|
||||
pub use portable_atomic;
|
||||
|
|
|
@ -90,7 +90,6 @@ impl Package {
|
|||
.chain(std::iter::once(None))
|
||||
.collect()
|
||||
}
|
||||
Package::RticSync => vec![Some("unstable".to_string()), None],
|
||||
_ => vec![None],
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue