Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't overwrite other bits when enabling a PWM timer #453

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `Serial::usart1/2/3` -> `Serial::new`.
- `Serial` implements `Write<WORD>` and `Read<WORD>` for `WORD` simultaneously as u8 and u16.
- Bump bxcan version to [v0.7.0](https://github.com/stm32-rs/bxcan/releases/tag/v0.7.0)
- PWM timer auto reload value is now preloaded/buffered

### Added

Expand Down
8 changes: 4 additions & 4 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ macro_rules! hal {
}
#[inline(always)]
fn start_one_pulse(&mut self) {
self.cr1.write(|w| unsafe { w.bits(1 << 3) }.cen().set_bit());
self.cr1.modify(|_, w| w.opm().set_bit().cen().set_bit());
}
#[inline(always)]
fn cr1_reset(&mut self) {
Expand Down Expand Up @@ -460,7 +460,7 @@ macro_rules! with_pwm {

#[inline(always)]
fn start_pwm(&mut self) {
self.cr1.write(|w| w.cen().set_bit());
self.cr1.modify(|_, w| w.cen().set_bit());
}

#[inline(always)]
Expand Down Expand Up @@ -512,7 +512,7 @@ macro_rules! with_pwm {

#[inline(always)]
fn start_pwm(&mut self) {
self.cr1.write(|w| w.cen().set_bit());
self.cr1.modify(|_, w| w.cen().set_bit());
}

#[inline(always)]
Expand Down Expand Up @@ -565,7 +565,7 @@ macro_rules! with_pwm {
#[inline(always)]
fn start_pwm(&mut self) {
$(let $aoe = self.bdtr.modify(|_, w| w.aoe().set_bit());)?
self.cr1.write(|w| w.cen().set_bit());
self.cr1.modify(|_, w| w.cen().set_bit());
}

#[inline(always)]
Expand Down
Loading