@@ -395,14 +395,14 @@ def recreate_with_f_clock(self, f_clock: int) -> "BitTiming":
395
395
396
396
def __str__ (self ) -> str :
397
397
segments = [
398
- f"BR { self .bitrate } bit/s" ,
398
+ f"BR: { self .bitrate :_ } bit/s" ,
399
399
f"SP: { self .sample_point :.2f} %" ,
400
400
f"BRP: { self .brp } " ,
401
401
f"TSEG1: { self .tseg1 } " ,
402
402
f"TSEG2: { self .tseg2 } " ,
403
403
f"SJW: { self .sjw } " ,
404
404
f"BTR: { self .btr0 :02X} { self .btr1 :02X} h" ,
405
- f"f_clock : { self .f_clock / 1e6 :.0f} MHz" ,
405
+ f"CLK : { self .f_clock / 1e6 :.0f} MHz" ,
406
406
]
407
407
return ", " .join (segments )
408
408
@@ -425,6 +425,9 @@ def __eq__(self, other: object) -> bool:
425
425
426
426
return self ._data == other ._data
427
427
428
+ def __hash__ (self ) -> int :
429
+ return tuple (self ._data .values ()).__hash__ ()
430
+
428
431
429
432
class BitTimingFd (Mapping ):
430
433
"""Representation of a bit timing configuration for a CAN FD bus.
@@ -999,19 +1002,19 @@ def recreate_with_f_clock(self, f_clock: int) -> "BitTimingFd":
999
1002
1000
1003
def __str__ (self ) -> str :
1001
1004
segments = [
1002
- f"NBR: { self .nom_bitrate } bit/s" ,
1005
+ f"NBR: { self .nom_bitrate :_ } bit/s" ,
1003
1006
f"NSP: { self .nom_sample_point :.2f} %" ,
1004
1007
f"NBRP: { self .nom_brp } " ,
1005
1008
f"NTSEG1: { self .nom_tseg1 } " ,
1006
1009
f"NTSEG2: { self .nom_tseg2 } " ,
1007
1010
f"NSJW: { self .nom_sjw } " ,
1008
- f"DBR: { self .data_bitrate } bit/s" ,
1011
+ f"DBR: { self .data_bitrate :_ } bit/s" ,
1009
1012
f"DSP: { self .data_sample_point :.2f} %" ,
1010
1013
f"DBRP: { self .data_brp } " ,
1011
1014
f"DTSEG1: { self .data_tseg1 } " ,
1012
1015
f"DTSEG2: { self .data_tseg2 } " ,
1013
1016
f"DSJW: { self .data_sjw } " ,
1014
- f"f_clock : { self .f_clock / 1e6 :.0f} MHz" ,
1017
+ f"CLK : { self .f_clock / 1e6 :.0f} MHz" ,
1015
1018
]
1016
1019
return ", " .join (segments )
1017
1020
@@ -1034,6 +1037,9 @@ def __eq__(self, other: object) -> bool:
1034
1037
1035
1038
return self ._data == other ._data
1036
1039
1040
+ def __hash__ (self ) -> int :
1041
+ return tuple (self ._data .values ()).__hash__ ()
1042
+
1037
1043
1038
1044
def _oscillator_tolerance_condition_1 (nom_sjw : int , nbt : int ) -> float :
1039
1045
"""Arbitration phase - resynchronization"""
0 commit comments