@@ -18,6 +18,9 @@ use rtic_common::{
18
18
wait_queue:: { Link , WaitQueue } ,
19
19
} ;
20
20
21
+ #[ cfg( feature = "defmt-03" ) ]
22
+ use crate :: defmt;
23
+
21
24
/// An MPSC channel for use in no-alloc systems. `N` sets the size of the queue.
22
25
///
23
26
/// This channel uses critical sections, however there are extremely small and all `memcpy`
@@ -127,9 +130,11 @@ macro_rules! make_channel {
127
130
// -------- Sender
128
131
129
132
/// Error state for when the receiver has been dropped.
133
+ #[ cfg_attr( feature = "defmt-03" , derive( defmt:: Format ) ) ]
130
134
pub struct NoReceiver < T > ( pub T ) ;
131
135
132
136
/// Errors that 'try_send` can have.
137
+ #[ cfg_attr( feature = "defmt-03" , derive( defmt:: Format ) ) ]
133
138
pub enum TrySendError < T > {
134
139
/// Error state for when the receiver has been dropped.
135
140
NoReceiver ( T ) ,
@@ -199,6 +204,13 @@ impl<'a, T, const N: usize> core::fmt::Debug for Sender<'a, T, N> {
199
204
}
200
205
}
201
206
207
+ #[ cfg( feature = "defmt-03" ) ]
208
+ impl < ' a , T , const N : usize > defmt:: Format for Sender < ' a , T , N > {
209
+ fn format ( & self , f : defmt:: Formatter ) {
210
+ defmt:: write!( f, "Sender" , )
211
+ }
212
+ }
213
+
202
214
impl < ' a , T , const N : usize > Sender < ' a , T , N > {
203
215
#[ inline( always) ]
204
216
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> {
382
394
}
383
395
}
384
396
397
+ #[ cfg( feature = "defmt-03" ) ]
398
+ impl < ' a , T , const N : usize > defmt:: Format for Receiver < ' a , T , N > {
399
+ fn format ( & self , f : defmt:: Formatter ) {
400
+ defmt:: write!( f, "Receiver" , )
401
+ }
402
+ }
403
+
385
404
/// Possible receive errors.
386
- #[ derive( Debug , PartialEq , Eq ) ]
405
+ #[ cfg_attr( feature = "defmt-03" , derive( defmt:: Format ) ) ]
406
+ #[ derive( Debug , PartialEq , Eq , Clone , Copy ) ]
387
407
pub enum ReceiveError {
388
408
/// Error state for when all senders has been dropped.
389
409
NoSender ,
0 commit comments