Skip to content

Commit 0db12eb

Browse files
Merge #513
513: Addressing issue #501 with start_pwm r=burrbull a=ganzalt Second try to get issue #501 fixed. Co-authored-by: ganzalt <torsten.strunk@gmx.de>
2 parents 16567c7 + e999df9 commit 0db12eb

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2020
### Removed
2121
- `i2s-audio-out-dma.rs` example, too difficult to fix.
2222

23+
### Fixed
24+
- use register.modify instead of register.write to start PWM [#501]
25+
2326
### Added
2427

2528
- Implementation of From trait for Pin-to-PartiallyErasedPin [#507]
@@ -31,6 +34,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3134
[#489]: https://github.com/stm32-rs/stm32f4xx-hal/pull/489
3235
[#490]: https://github.com/stm32-rs/stm32f4xx-hal/pull/490
3336
[#497]: https://github.com/stm32-rs/stm32f4xx-hal/pull/497
37+
[#501]: https://github.com/stm32-rs/stm32f4xx-hal/issues/501
3438
[#507]: https://github.com/stm32-rs/stm32f4xx-hal/pull/507
3539
[#508]: https://github.com/stm32-rs/stm32f4xx-hal/pull/508
3640
[#510]: https://github.com/stm32-rs/stm32f4xx-hal/pull/510

src/timer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,11 @@ macro_rules! hal {
365365
}
366366
#[inline(always)]
367367
fn start_one_pulse(&mut self) {
368-
self.cr1.write(|w| unsafe { w.bits(1 << 3) }.cen().set_bit());
368+
self.cr1.modify(|_, w| unsafe { w.bits(1 << 3) }.cen().set_bit());
369369
}
370370
#[inline(always)]
371371
fn start_no_update(&mut self) {
372-
self.cr1.write(|w| w.cen().set_bit().udis().set_bit());
372+
self.cr1.modify(|_, w| w.cen().set_bit().udis().set_bit());
373373
}
374374
#[inline(always)]
375375
fn cr1_reset(&mut self) {
@@ -445,7 +445,7 @@ macro_rules! with_pwm {
445445

446446
#[inline(always)]
447447
fn start_pwm(&mut self) {
448-
self.cr1.write(|w| w.cen().set_bit());
448+
self.cr1.modify(|_, w| w.cen().set_bit());
449449
}
450450

451451
#[inline(always)]
@@ -495,7 +495,7 @@ macro_rules! with_pwm {
495495

496496
#[inline(always)]
497497
fn start_pwm(&mut self) {
498-
self.cr1.write(|w| w.cen().set_bit());
498+
self.cr1.modify(|_, w| w.cen().set_bit());
499499
}
500500

501501
#[inline(always)]
@@ -553,7 +553,7 @@ macro_rules! with_pwm {
553553
#[inline(always)]
554554
fn start_pwm(&mut self) {
555555
$(let $aoe = self.bdtr.modify(|_, w| w.aoe().set_bit());)?
556-
self.cr1.write(|w| w.cen().set_bit());
556+
self.cr1.modify(|_, w| w.cen().set_bit());
557557
}
558558

559559
#[inline(always)]

0 commit comments

Comments
 (0)