| 1 | //! Blocking CAN API |
| 2 | |
| 3 | /// A blocking CAN interface that is able to transmit and receive frames. |
| 4 | pub trait Can { |
| 5 | /// Associated frame type. |
| 6 | type Frame: crate::Frame; |
| 7 | |
| 8 | /// Associated error type. |
| 9 | type Error: crate::Error; |
| 10 | |
| 11 | /// Puts a frame in the transmit buffer. Blocks until space is available in |
| 12 | /// the transmit buffer. |
| 13 | fn transmit(&mut self, frame: &Self::Frame) -> Result<(), Self::Error>; |
| 14 | |
| 15 | /// Blocks until a frame was received or an error occured. |
| 16 | fn receive(&mut self) -> Result<Self::Frame, Self::Error>; |
| 17 | } |
| 18 | |