mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-18 05:45:19 +01:00
rtic-sync: Remove unstable flag, and add defmt derives (#889)
This commit is contained in:
parent
8b2465ba37
commit
4a23c8d6da
6 changed files with 39 additions and 13 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue