We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8ad482d commit 3d3a38eCopy full SHA for 3d3a38e
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>
@@ -78,11 +78,12 @@ where
78
apb1.rstr().modify(|_, w| w.canrst().set_bit());
79
apb1.rstr().modify(|_, w| w.canrst().clear_bit());
80
81
- bxcan::Can::new(Can {
82
- _can: can,
83
- _tx: tx,
84
- _rx: rx,
85
- })
+ bxcan::Can::new(Can { can, tx, rx })
+ }
+
+ /// Releases the CAN peripheral and associated pins
+ pub fn free(self) -> (pac::CAN, Tx, Rx) {
86
+ (self.can, self.tx, self.rx)
87
88
89
0 commit comments