File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -435,6 +435,12 @@ where
435
435
}
436
436
}
437
437
438
+ /// Check if the interrupt is triggered
439
+ #[ inline]
440
+ pub fn has_interrupt ( & mut self , interrupt : Interrupt ) -> bool {
441
+ self . control . has_interrupt ( interrupt)
442
+ }
443
+
438
444
/// Clear specified interrupt
439
445
#[ inline]
440
446
pub fn clear_interrupt ( & mut self , interrupt : Interrupt ) {
@@ -1176,6 +1182,13 @@ where
1176
1182
self . registers ( ) . tscv . read ( ) . tsc ( ) . bits ( )
1177
1183
}
1178
1184
1185
+ /// Check if the interrupt is triggered
1186
+ #[ inline]
1187
+ pub fn has_interrupt ( & mut self , interrupt : Interrupt ) -> bool {
1188
+ let can = self . registers ( ) ;
1189
+ can. ir . read ( ) . bits ( ) & ( interrupt as u32 ) > 0
1190
+ }
1191
+
1179
1192
/// Clear specified interrupt
1180
1193
#[ inline]
1181
1194
pub fn clear_interrupt ( & mut self , interrupt : Interrupt ) {
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ impl StandardId {
41
41
42
42
/// Returns this CAN Identifier as a raw 16-bit integer.
43
43
#[ inline]
44
- pub ( crate ) fn as_raw ( & self ) -> u16 {
44
+ pub fn as_raw ( & self ) -> u16 {
45
45
self . 0
46
46
}
47
47
}
@@ -88,7 +88,7 @@ impl ExtendedId {
88
88
89
89
/// Returns this CAN Identifier as a raw 32-bit integer.
90
90
#[ inline]
91
- pub ( crate ) fn as_raw ( & self ) -> u32 {
91
+ pub fn as_raw ( & self ) -> u32 {
92
92
self . 0
93
93
}
94
94
@@ -212,10 +212,14 @@ impl IdReg {
212
212
/// Returns the identifier.
213
213
pub fn to_id ( self ) -> Id {
214
214
if self . is_extended ( ) {
215
- Id :: Extended ( unsafe { ExtendedId :: new_unchecked ( self . 0 >> Self :: EXTENDED_SHIFT ) } )
215
+ Id :: Extended ( unsafe {
216
+ ExtendedId :: new_unchecked ( ( self . 0 >> Self :: EXTENDED_SHIFT ) & Self :: EXTENDED_MASK )
217
+ } )
216
218
} else {
217
219
Id :: Standard ( unsafe {
218
- StandardId :: new_unchecked ( ( self . 0 >> Self :: STANDARD_SHIFT ) as u16 )
220
+ StandardId :: new_unchecked (
221
+ ( ( self . 0 >> Self :: STANDARD_SHIFT ) & Self :: STANDARD_MASK ) as u16 ,
222
+ )
219
223
} )
220
224
}
221
225
}
You can’t perform that action at this time.
0 commit comments