Skip to content

Commit e95f8c4

Browse files
committed
enforce limit of tcdo to maximum of 127
1 parent 666b589 commit e95f8c4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,8 @@ where
750750

751751
let can = self.registers();
752752
if btr.tdc() {
753-
let tcdo = btr.dtseg1() * btr.dbrp();
753+
let tcdo = btr.dtseg1().saturating_mul(btr.dbrp());
754+
let tcdo = core::cmp::min(tcdo, 127);
754755
can.tdcr.write(|w| unsafe { w.tdco().bits(tcdo) });
755756
}
756757
can.dbtp.write(|w| unsafe {

0 commit comments

Comments
 (0)