@@ -14,7 +14,7 @@ use cortex_m::asm;
14
14
use nb:: block;
15
15
16
16
use cortex_m_rt:: entry;
17
- use stm32f1xx_hal:: { pac, prelude:: * , serial :: Config } ;
17
+ use stm32f1xx_hal:: { pac, prelude:: * } ;
18
18
19
19
#[ entry]
20
20
fn main ( ) -> ! {
@@ -34,33 +34,31 @@ fn main() -> ! {
34
34
let mut afio = p. AFIO . constrain ( ) ;
35
35
36
36
// Prepare the GPIOB peripheral
37
- let mut gpiob = p. GPIOB . split ( ) ;
37
+ let gpiob = p. GPIOB . split ( ) ;
38
38
39
39
// USART1
40
- // let tx = gpioa.pa9.into_alternate_push_pull(&mut gpioa.crh) ;
40
+ // let tx = gpioa.pa9;
41
41
// let rx = gpioa.pa10;
42
42
43
43
// USART1
44
- // let tx = gpiob.pb6.into_alternate_push_pull(&mut gpiob.crl) ;
44
+ // let tx = gpiob.pb6;
45
45
// let rx = gpiob.pb7;
46
46
47
47
// USART2
48
- // let tx = gpioa.pa2.into_alternate_push_pull(&mut gpioa.crl) ;
48
+ // let tx = gpioa.pa2;
49
49
// let rx = gpioa.pa3;
50
50
51
51
// USART3
52
52
// Configure pb10 as a push_pull output, this will be the tx pin
53
- let tx = gpiob. pb10 . into_alternate_push_pull ( & mut gpiob . crh ) ;
53
+ let tx = gpiob. pb10 ;
54
54
// Take ownership over pb11
55
55
let rx = gpiob. pb11 ;
56
56
57
57
// Set up the usart device. Take ownership over the USART register and tx/rx pins. The rest of
58
58
// the registers are used to enable and configure the device.
59
- let mut serial = p. USART3 . serial (
60
- ( tx, rx, & mut afio. mapr ) ,
61
- Config :: default ( ) . baudrate ( 9600 . bps ( ) ) ,
62
- & clocks,
63
- ) ;
59
+ let mut serial = p
60
+ . USART3
61
+ . serial ( ( tx, rx, & mut afio. mapr ) , 9600 . bps ( ) , & clocks) ;
64
62
65
63
// Loopback test. Write `X` and wait until the write is successful.
66
64
let sent = b'X' ;
0 commit comments