@@ -68,13 +68,21 @@ pub trait Can {
68
68
/// Associated error type.
69
69
type Error ;
70
70
71
- /// Puts a frame in the transmit buffer.
71
+ /// Puts a frame in the transmit buffer to be sent on the bus .
72
72
///
73
- /// If the buffer is full, this function will try to replace a lower priority frame
74
- /// and return it. This is to avoid the priority inversion problem.
75
- /// Transmits frames of equal identifier in FIFO fashion.
76
- fn transmit ( & mut self , frame : & Self :: Frame ) -> nb:: Result < Option < Self :: Frame > , Self :: Error > ;
73
+ /// If the transmit buffer is full, this function will try to replace a pending
74
+ /// lower priority frame and return the frame that was replaced.
75
+ /// Returns `Err(WouldBlock)` if the transmit buffer is full and no frame can be
76
+ /// replaced.
77
+ ///
78
+ /// # Notes for implementers
79
+ ///
80
+ /// * Frames of equal identifier shall be transmited in FIFO fashion when more
81
+ /// than one transmit buffer is available.
82
+ /// * When replacing pending frames make sure the frame is not in the process of
83
+ /// being send to the bus.
84
+ fn try_transmit ( & mut self , frame : & Self :: Frame ) -> nb:: Result < Option < Self :: Frame > , Self :: Error > ;
77
85
78
86
/// Returns a received frame if available.
79
- fn receive ( & mut self ) -> nb:: Result < Self :: Frame , Self :: Error > ;
87
+ fn try_receive ( & mut self ) -> nb:: Result < Self :: Frame , Self :: Error > ;
80
88
}
0 commit comments