Skip to content

Commit 0eb802f

Browse files
zklapowSh3Rm4n
authored andcommitted
use LBKM enum
1 parent d24402b commit 0eb802f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/can.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use crate::stm32;
2020
use nb::{self, Error};
2121

2222
use core::sync::atomic::{AtomicU8, Ordering};
23+
use stm32::can::btr::LBKM_A;
2324

2425
const EXID_MASK: u32 = 0b1_1111_1111_1100_0000_0000_0000_0000;
2526
const MAX_EXTENDED_ID: u32 = 0x1FFF_FFFF;
@@ -33,7 +34,7 @@ pub struct CanOpts {
3334
pub sjw: u8,
3435
pub ts1: u8,
3536
pub ts2: u8,
36-
pub lbkm: bool,
37+
pub lbkm: LBKM_A,
3738
}
3839

3940
impl CanOpts {
@@ -61,7 +62,7 @@ impl CanOpts {
6162
self
6263
}
6364

64-
pub fn lbkm(mut self, lbkm: bool) -> Self {
65+
pub fn lbkm(mut self, lbkm: LBKM_A) -> Self {
6566
self.lbkm = lbkm;
6667
self
6768
}
@@ -74,7 +75,7 @@ impl Default for CanOpts {
7475
sjw: 0,
7576
ts1: 10,
7677
ts2: 3,
77-
lbkm: false,
78+
lbkm: LBKM_A::DISABLED,
7879
}
7980
}
8081
}
@@ -338,7 +339,7 @@ impl Can {
338339
.ts2()
339340
.bits(ts2)
340341
.lbkm()
341-
.bit(lbkm)
342+
.variant(lbkm)
342343
});
343344

344345
// Leave initialization mode by clearing INRQ and switch to normal mode

0 commit comments

Comments
 (0)