Skip to content

Commit 3c0895c

Browse files
committed
return pending frames with lower priority when the mailbox is full
1 parent afe2251 commit 3c0895c

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

embedded-can/src/asynch.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ pub trait CanTx {
1212

1313
/// Puts a frame in the transmit buffer or awaits until space is available
1414
/// in the transmit buffer.
15-
fn transmit(&mut self, frame: &Self::Frame) -> impl Future<Output = Result<(), Self::Error>>;
15+
///
16+
/// If the transmit buffer is full, this function will try to replace a
17+
/// pending lower priority frame and return the frame that was replaced. If
18+
/// no lower-priority frames can be replaced, this call should wait for a
19+
/// frame to be transmitted and then try again.
20+
fn transmit(
21+
&mut self,
22+
frame: &Self::Frame,
23+
) -> impl Future<Output = Result<Option<Self::Frame>, Self::Error>>;
1624
}
1725

1826
/// An async CAN interface that is able to receive frames.

0 commit comments

Comments
 (0)