Skip to content

Commit 380f622

Browse files
committed
fixup! fixup! fixup! Utilize LDREX/STREX in GPIO configure functions
1 parent ad4f8cc commit 380f622

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

examples/dac_sine.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ fn main() -> ! {
2020

2121
// Set up pin PA4 as analog pin.
2222
let mut gpioa = dp.GPIOA.split(&mut rcc.ahb);
23-
let _dac1_out1 = gpioa.pa4.into_analog(&mut gpioa.moder, &mut gpioa.pupdr);
23+
let _dac1_out1 = gpioa.pa4.into_analog();
2424

2525
// set up led for blinking loop
26-
let mut ok_led = gpioa
27-
.pa15
28-
.into_push_pull_output(&mut gpioa.moder, &mut gpioa.otyper);
26+
let mut ok_led = gpioa.pa15.into_push_pull_output();
2927

3028
// set up dac1, data is twelve bits, aligned right
3129
let mut dac1 = Dac::new(dp.DAC1, &mut rcc.apb1);
@@ -38,10 +36,10 @@ fn main() -> ! {
3836
cortex_m::asm::delay(8_000);
3937
}
4038
if led {
41-
ok_led.set_low().unwrap();
39+
ok_led.set_low().ok();
4240
led = false;
4341
} else {
44-
ok_led.set_high().unwrap();
42+
ok_led.set_high().ok();
4543
led = true;
4644
}
4745
}

0 commit comments

Comments
 (0)