Skip to content

Commit a1ef7d2

Browse files
committed
enforce limit of tcdo to maximum of 127
1 parent 7bfa914 commit a1ef7d2

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
@@ -756,7 +756,8 @@ where
756756

757757
let can = self.registers();
758758
if btr.tdc() {
759-
let tcdo = btr.dtseg1() * btr.dbrp();
759+
let tcdo = btr.dtseg1().saturating_mul(btr.dbrp());
760+
let tcdo = core::cmp::min(tcdo, 127);
760761
can.tdcr.write(|w| unsafe { w.tdco().bits(tcdo) });
761762
}
762763
can.dbtp.write(|w| unsafe {

0 commit comments

Comments
 (0)