@@ -23,18 +23,18 @@ use stm32f1xx_hal::gpio::*;
23
23
// After enabling the interrupt, main() may not have any references to these objects any more.
24
24
// For the sake of minimalism, we do not use RTFM here, which would be the better way.
25
25
static mut LED : MaybeUninit < stm32f1xx_hal:: gpio:: gpioc:: PC13 < Output < PushPull > > > = MaybeUninit :: uninit ( ) ;
26
- static mut EXTI : MaybeUninit < stm32f1xx_hal:: gpio:: gpioa:: PA7 < Input < Floating > > > = MaybeUninit :: uninit ( ) ;
26
+ static mut INT_PIN : MaybeUninit < stm32f1xx_hal:: gpio:: gpioa:: PA7 < Input < Floating > > > = MaybeUninit :: uninit ( ) ;
27
27
28
28
#[ interrupt]
29
29
fn EXTI9_5 ( ) {
30
30
let led = unsafe { & mut * LED . as_mut_ptr ( ) } ;
31
- let exti = unsafe { & mut * EXTI . as_mut_ptr ( ) } ;
31
+ let int_pin = unsafe { & mut * INT_PIN . as_mut_ptr ( ) } ;
32
32
33
- if exti . check_interrupt ( ) {
33
+ if int_pin . check_interrupt ( ) {
34
34
led. toggle ( ) ;
35
35
36
36
// if we don't clear this bit, the ISR would trigger indefinitely
37
- exti . clear_interrupt_pending_bit ( ) ;
37
+ int_pin . clear_interrupt_pending_bit ( ) ;
38
38
}
39
39
}
40
40
@@ -44,7 +44,7 @@ fn main() -> ! {
44
44
let p = pac:: Peripherals :: take ( ) . unwrap ( ) ;
45
45
let cp = cortex_m:: peripheral:: Peripherals :: take ( ) . unwrap ( ) ;
46
46
{
47
- // the scope ensures that the exti reference is dropped before the first ISR can be executed.
47
+ // the scope ensures that the int_pin reference is dropped before the first ISR can be executed.
48
48
49
49
let mut rcc = p. RCC . constrain ( ) ;
50
50
let mut gpioa = p. GPIOA . split ( & mut rcc. apb2 ) ;
@@ -54,11 +54,11 @@ fn main() -> ! {
54
54
let led = unsafe { & mut * LED . as_mut_ptr ( ) } ;
55
55
* led = gpioc. pc13 . into_push_pull_output ( & mut gpioc. crh ) ;
56
56
57
- let exti = unsafe { & mut * EXTI . as_mut_ptr ( ) } ;
58
- * exti = gpioa. pa7 . into_floating_input ( & mut gpioa. crl ) ;
59
- exti . make_interrupt_source ( & mut afio) ;
60
- exti . trigger_on_edge ( & p. EXTI , Edge :: RISING_FALLING ) ;
61
- exti . enable_interrupt ( & p. EXTI ) ;
57
+ let int_pin = unsafe { & mut * INT_PIN . as_mut_ptr ( ) } ;
58
+ * int_pin = gpioa. pa7 . into_floating_input ( & mut gpioa. crl ) ;
59
+ int_pin . make_interrupt_source ( & mut afio) ;
60
+ int_pin . trigger_on_edge ( & p. EXTI , Edge :: RISING_FALLING ) ;
61
+ int_pin . enable_interrupt ( & p. EXTI ) ;
62
62
} // initialization ends here
63
63
64
64
let mut nvic = cp. NVIC ;
0 commit comments