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.
44The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
55and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
66
7+ ## [ Unreleased]
8+ ### Added
9+ - Added a ` is_pending ` method to the ` gpio::Exti ` trait.
10+
711## [ 0.3.0] - 2021-12-20
812### Added
913- 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() -> ! {
1717
1818 let gpioc: PortC = PortC :: split ( dp. GPIOC , & mut dp. RCC ) ;
1919 let _c6: Input < pins:: C6 > = cortex_m:: interrupt:: free ( |cs| Input :: new ( gpioc. c6 , Pull :: Up , cs) ) ;
20+ defmt:: assert!( !pins:: C6 :: is_pending( ) ) ;
2021
2122 pins:: C6 :: setup_exti_c1 ( & mut dp. EXTI , & mut dp. SYSCFG , ExtiTrg :: Both ) ;
2223 unsafe { pins:: C6 :: unmask ( ) } ;
@@ -30,5 +31,6 @@ fn main() -> ! {
3031#[ allow( non_snake_case) ]
3132fn EXTI9_5 ( ) {
3233 defmt:: info!( "B3 pressed or released!" ) ;
34+ defmt:: assert!( pins:: C6 :: is_pending( ) ) ;
3335 pins:: C6 :: clear_exti ( ) ;
3436}
Original file line number Diff line number Diff line change @@ -370,6 +370,15 @@ pub trait Exti {
370370 /// [`gpio-button-irq.rs`]: https://github.com/stm32-rs/stm32wlxx-hal/blob/main/examples/examples/gpio-button-irq.rs
371371 fn clear_exti ( ) ;
372372
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+
373382 /// Setup an input pin as an EXTI interrupt source on core 1.
374383 ///
375384 /// This is a helper function that wraps:
@@ -757,6 +766,12 @@ pub mod pins {
757766 // safety: atomic write with no side effects
758767 unsafe { ( * pac:: EXTI :: PTR ) . pr1. write( |w| w. [ <pif $n>] ( ) . set_bit( ) ) }
759768 }
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+ }
760775 }
761776 }
762777 } ;
You can’t perform that action at this time.
0 commit comments