File tree 2 files changed +10
-6
lines changed 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -78,12 +78,10 @@ pub struct DataBitTiming {
78
78
pub sync_jump_width : NonZeroU8 ,
79
79
}
80
80
impl DataBitTiming {
81
- // #[inline]
82
- // fn tdc(&self) -> u8 {
83
- // let tsd = self.transceiver_delay_compensation as u8;
84
- // //TODO: stm32g4 does not export the TDC field
85
- // todo!()
86
- // }
81
+ #[ inline]
82
+ pub ( crate ) fn tdc ( & self ) -> bool {
83
+ self . transceiver_delay_compensation
84
+ }
87
85
#[ inline]
88
86
pub ( crate ) fn dbrp ( & self ) -> u8 {
89
87
u8:: from ( self . prescaler ) & 0x1F
Original file line number Diff line number Diff line change @@ -755,6 +755,10 @@ where
755
755
self . control . config . dbtr = btr;
756
756
757
757
let can = self . registers ( ) ;
758
+ if btr. tdc ( ) {
759
+ let tcdo = btr. dtseg1 ( ) * btr. dbrp ( ) ;
760
+ can. tdcr . write ( |w| unsafe { w. tdco ( ) . bits ( tcdo) } ) ;
761
+ }
758
762
can. dbtp . write ( |w| unsafe {
759
763
w. dbrp ( )
760
764
. bits ( btr. dbrp ( ) - 1 )
@@ -764,6 +768,8 @@ where
764
768
. bits ( btr. dtseg2 ( ) - 1 )
765
769
. dsjw ( )
766
770
. bits ( btr. dsjw ( ) - 1 )
771
+ . tdc ( )
772
+ . bit ( btr. tdc ( ) )
767
773
} ) ;
768
774
}
769
775
You can’t perform that action at this time.
0 commit comments