File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change 3
3
#![ no_main]
4
4
#![ no_std]
5
5
6
- extern crate cortex_m;
7
- extern crate cortex_m_rt as rt;
8
- extern crate panic_halt;
9
- extern crate stm32g4xx_hal as hal;
10
-
11
6
use hal:: prelude:: * ;
12
7
use hal:: stm32;
13
- use rt:: entry;
8
+ use stm32g4xx_hal as hal;
9
+
10
+ use cortex_m_rt:: entry;
11
+ use log:: info;
12
+
13
+ #[ macro_use]
14
+ mod utils;
14
15
15
16
#[ entry]
16
17
fn main ( ) -> ! {
18
+ utils:: logger:: init ( ) ;
19
+
20
+ info ! ( "start" ) ;
17
21
let dp = stm32:: Peripherals :: take ( ) . expect ( "cannot take peripherals" ) ;
18
22
let mut rcc = dp. RCC . constrain ( ) ;
19
- let gpiob = dp. GPIOB . split ( & mut rcc) ;
20
- let mut led = gpiob. pb8 . into_push_pull_output ( ) ;
23
+
24
+ info ! ( "Init Led" ) ;
25
+ let gpioa = dp. GPIOA . split ( & mut rcc) ;
26
+ let mut led = gpioa. pa5 . into_push_pull_output ( ) ;
21
27
22
28
loop {
23
- for _ in 0 ..1_000_000 {
29
+ info ! ( "Set Led low" ) ;
30
+ for _ in 0 ..100_000 {
24
31
led. set_low ( ) . unwrap ( ) ;
25
32
}
26
- for _ in 0 ..1_000_000 {
33
+ info ! ( "Set Led High" ) ;
34
+ for _ in 0 ..100_000 {
27
35
led. set_high ( ) . unwrap ( ) ;
28
36
}
29
37
}
You can’t perform that action at this time.
0 commit comments