Skip to content

Commit 449b801

Browse files
committed
can: Merge Transmitter and Receiver traits
1 parent c5b4816 commit 449b801

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/can.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ pub trait Frame: Sized {
4242
fn data(&self) -> &[u8];
4343
}
4444

45-
/// A CAN interface that is able to transmit frames.
46-
pub trait Transmitter {
45+
/// A CAN interface that is able to transmit and receive frames.
46+
pub trait Can {
4747
/// Associated frame type.
4848
type Frame: Frame;
4949

@@ -54,16 +54,8 @@ pub trait Transmitter {
5454
///
5555
/// If the buffer is full, this function will try to replace a lower priority frame
5656
/// and return it. This is to avoid the priority inversion problem.
57+
/// Transmits frames of equal identifier in FIFO fashion.
5758
fn transmit(&mut self, frame: &Self::Frame) -> nb::Result<Option<Self::Frame>, Self::Error>;
58-
}
59-
60-
/// A CAN interface that is able to receive frames.
61-
pub trait Receiver {
62-
/// Associated frame type.
63-
type Frame: Frame;
64-
65-
/// Associated error type.
66-
type Error;
6759

6860
/// Returns a received frame if available.
6961
fn receive(&mut self) -> nb::Result<Self::Frame, Self::Error>;

0 commit comments

Comments
 (0)