@@ -12,16 +12,15 @@ use crate::hal::prelude::*;
12
12
13
13
use cortex_m:: interrupt:: Mutex ;
14
14
use cortex_m:: peripheral:: Peripherals as c_m_Peripherals;
15
- use cortex_m_rt:: { entry, interrupt } ;
15
+ use cortex_m_rt:: entry;
16
16
17
- pub use crate :: hal:: stm32;
18
- pub use crate :: hal:: stm32:: * ;
17
+ use crate :: hal:: stm32:: { interrupt, Interrupt , Peripherals , EXTI } ;
19
18
20
19
use core:: cell:: RefCell ;
21
20
use core:: ops:: DerefMut ;
22
21
23
22
// Make our LED globally available
24
- static LED : Mutex < RefCell < Option < gpiob :: PB3 < Output < PushPull > > > > > = Mutex :: new ( RefCell :: new ( None ) ) ;
23
+ static LED : Mutex < RefCell < Option < gpioa :: PA1 < Output < PushPull > > > > > = Mutex :: new ( RefCell :: new ( None ) ) ;
25
24
26
25
// Make our delay provider globally available
27
26
static DELAY : Mutex < RefCell < Option < Delay > > > = Mutex :: new ( RefCell :: new ( None ) ) ;
@@ -32,6 +31,7 @@ static INT: Mutex<RefCell<Option<EXTI>>> = Mutex::new(RefCell::new(None));
32
31
#[ entry]
33
32
fn main ( ) -> ! {
34
33
if let ( Some ( p) , Some ( cp) ) = ( Peripherals :: take ( ) , c_m_Peripherals:: take ( ) ) {
34
+ let gpioa = p. GPIOA . split ( ) ;
35
35
let gpiob = p. GPIOB . split ( ) ;
36
36
let syscfg = p. SYSCFG_COMP ;
37
37
let exti = p. EXTI ;
@@ -43,8 +43,8 @@ fn main() -> ! {
43
43
// Configure PB1 as input (button)
44
44
let _ = gpiob. pb1 . into_pull_down_input ( ) ;
45
45
46
- // Configure PB3 as output (LED)
47
- let mut led = gpiob . pb3 . into_push_pull_output ( ) ;
46
+ // Configure PA1 as output (LED)
47
+ let mut led = gpioa . pa1 . into_push_pull_output ( ) ;
48
48
49
49
// Turn off LED
50
50
led. set_low ( ) ;
@@ -107,7 +107,7 @@ fn EXTI0_1() {
107
107
led. set_low ( ) ;
108
108
109
109
// Clear interrupt
110
- exti. pr . modify ( |_ , w| w. pif1 ( ) . set_bit ( ) ) ;
110
+ exti. pr . write ( | w| w. pif1 ( ) . set_bit ( ) ) ;
111
111
}
112
112
} ) ;
113
113
}
0 commit comments