File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ //! Async CAN API
2+
3+ /// An async 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.
12+ /// Awaits until space is available in the transmit buffer.
13+ async fn transmit ( & mut self , frame : & Self :: Frame ) -> Result < ( ) , Self :: Error > ;
14+
15+ /// Tries to put a frame in the transmit buffer.
16+ /// If no space is available in the transmit buffer `None` is returned.
17+ fn try_transmit ( & mut self , frame : & Self :: Frame ) -> Option < Result < ( ) , Self :: Error > > ;
18+
19+ /// Awaits until a frame was received or an error occurred.
20+ async fn receive ( & mut self ) -> Result < Self :: Frame , Self :: Error > ;
21+
22+ /// Tries to receive a frame from the receive buffer.
23+ /// If no frame is available `None` is returned.
24+ fn try_receive ( & mut self ) -> Option < Result < Self :: Frame , Self :: Error > > ;
25+ }
Original file line number Diff line number Diff line change 22
33#![ warn( missing_docs) ]
44#![ no_std]
5+ #![ allow( async_fn_in_trait) ]
56
7+ pub mod asynch;
68pub mod blocking;
79pub mod nb;
810
You can’t perform that action at this time.
0 commit comments