File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
5
5
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
6
6
7
+ ## [ Unreleased]
8
+ ### Added
9
+ - Added a ` is_pending ` method to the ` gpio::Exti ` trait.
10
+
7
11
## [ 0.3.0] - 2021-12-20
8
12
### Added
9
13
- Added ` info::Core::CT ` to get the CPU core at compile time.
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ fn main() -> ! {
17
17
18
18
let gpioc: PortC = PortC :: split ( dp. GPIOC , & mut dp. RCC ) ;
19
19
let _c6: Input < pins:: C6 > = cortex_m:: interrupt:: free ( |cs| Input :: new ( gpioc. c6 , Pull :: Up , cs) ) ;
20
+ defmt:: assert!( !pins:: C6 :: is_pending( ) ) ;
20
21
21
22
pins:: C6 :: setup_exti_c1 ( & mut dp. EXTI , & mut dp. SYSCFG , ExtiTrg :: Both ) ;
22
23
unsafe { pins:: C6 :: unmask ( ) } ;
@@ -30,5 +31,6 @@ fn main() -> ! {
30
31
#[ allow( non_snake_case) ]
31
32
fn EXTI9_5 ( ) {
32
33
defmt:: info!( "B3 pressed or released!" ) ;
34
+ defmt:: assert!( pins:: C6 :: is_pending( ) ) ;
33
35
pins:: C6 :: clear_exti ( ) ;
34
36
}
Original file line number Diff line number Diff line change @@ -370,6 +370,15 @@ pub trait Exti {
370
370
/// [`gpio-button-irq.rs`]: https://github.com/stm32-rs/stm32wlxx-hal/blob/main/examples/examples/gpio-button-irq.rs
371
371
fn clear_exti ( ) ;
372
372
373
+ /// Returns true if a trigger request occured.
374
+ ///
375
+ /// # Example
376
+ ///
377
+ /// See [`gpio-button-irq.rs`].
378
+ ///
379
+ /// [`gpio-button-irq.rs`]: https://github.com/stm32-rs/stm32wlxx-hal/blob/main/examples/examples/gpio-button-irq.rs
380
+ fn is_pending ( ) -> bool ;
381
+
373
382
/// Setup an input pin as an EXTI interrupt source on core 1.
374
383
///
375
384
/// This is a helper function that wraps:
@@ -757,6 +766,12 @@ pub mod pins {
757
766
// safety: atomic write with no side effects
758
767
unsafe { ( * pac:: EXTI :: PTR ) . pr1. write( |w| w. [ <pif $n>] ( ) . set_bit( ) ) }
759
768
}
769
+
770
+ #[ inline]
771
+ fn is_pending( ) -> bool {
772
+ // safety: atomic read with no side effects
773
+ unsafe { ( * pac:: EXTI :: PTR ) . pr1. read( ) . [ <pif $n>] ( ) . bit_is_set( ) }
774
+ }
760
775
}
761
776
}
762
777
} ;
You can’t perform that action at this time.
0 commit comments