File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
11
11
12
12
- Reexport PAC as ` pac ` for consistency with other crates, consider ` stm32 ` virtually deprecated
13
13
- Added external interrupt (EXTI) support for output pins
14
+ - Added ` check_interrupt ` method for GPIO pins
14
15
15
16
## [ v0.8.3] - 2020-06-12
16
17
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ pub trait ExtiPin {
90
90
fn enable_interrupt ( & mut self , exti : & mut EXTI ) ;
91
91
fn disable_interrupt ( & mut self , exti : & mut EXTI ) ;
92
92
fn clear_interrupt_pending_bit ( & mut self ) ;
93
+ fn check_interrupt ( & self ) -> bool ;
93
94
}
94
95
95
96
macro_rules! exti_erased {
@@ -163,6 +164,11 @@ macro_rules! exti_erased {
163
164
fn clear_interrupt_pending_bit( & mut self ) {
164
165
unsafe { ( * EXTI :: ptr( ) ) . pr. write( |w| w. bits( 1 << self . i) ) } ;
165
166
}
167
+
168
+ /// Reads the interrupt pending bit for this pin
169
+ fn check_interrupt( & self ) -> bool {
170
+ unsafe { ( ( * EXTI :: ptr( ) ) . pr. read( ) . bits( ) & ( 1 << self . i) ) != 0 }
171
+ }
166
172
}
167
173
} ;
168
174
}
@@ -220,6 +226,11 @@ macro_rules! exti {
220
226
fn clear_interrupt_pending_bit( & mut self ) {
221
227
unsafe { ( * EXTI :: ptr( ) ) . pr. write( |w| w. bits( 1 << $i) ) } ;
222
228
}
229
+
230
+ /// Reads the interrupt pending bit for this pin
231
+ fn check_interrupt( & self ) -> bool {
232
+ unsafe { ( ( * EXTI :: ptr( ) ) . pr. read( ) . bits( ) & ( 1 << $i) ) != 0 }
233
+ }
223
234
}
224
235
} ;
225
236
}
You can’t perform that action at this time.
0 commit comments