We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a91344a commit a437421Copy full SHA for a437421
src/can.rs
@@ -57,9 +57,9 @@ cfg_if! {
57
///
58
/// See [`bxcan::Instance`] for more information on how to use the CAN interface.
59
pub struct Can<Tx, Rx> {
60
- _can: pac::CAN,
61
- _tx: TX,
62
- _rx: RX,
+ can: pac::CAN,
+ tx: Tx,
+ rx: Rx,
63
}
64
65
impl<Tx, Rx> Can<Tx, Rx>
@@ -79,11 +79,16 @@ where
79
apb1.rstr().modify(|_, w| w.canrst().clear_bit());
80
81
bxcan::Can::new(Can {
82
- _can: can,
83
- _tx: tx,
84
- _rx: rx,
+ can,
+ tx,
+ rx,
85
})
86
87
+
88
+ /// Releases the CAN peripheral and associated pins
89
+ pub fn free(self) -> (pac::CAN, Tx, Rx) {
90
+ (self.can, self.tx, self.rx)
91
+ }
92
93
94
unsafe impl<Tx, Rx> bxcan::Instance for Can<Tx, Rx> {
0 commit comments