Skip to content

Commit fe5153f

Browse files
bors[bot]Gekkio
andauthored
Merge #150
150: Set mode correctly on C2 of 2-channel PWM r=newAM a=Gekkio When configuring a 2-channel PWM and setting up channel 2 mode, we accidentally set up channel 1 mode instead. I haven't actually verified the currently broken behaviour on hardware since I'm using 4-channel PWM where this configuration is done correctly, but this one looks like a simple copy-paste error which I spotted while studying the code 😅 Co-authored-by: Joonas Javanainen <joonas.javanainen@gmail.com>
2 parents 16c5fac + 0efbb24 commit fe5153f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Wrong mode when using PWM channel 2 of a two-channel timer
13+
1014
## [v0.18.0] - 2021-11-14
1115

1216
### Changed

src/pwm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ macro_rules! pwm_2_channels {
321321
tim.ccmr1_output().modify(|_, w| w.oc1pe().set_bit().oc1m().bits(6));
322322
}
323323
if PINS::C2 {
324-
tim.ccmr1_output().modify(|_, w| w.oc2pe().set_bit().oc1m().bits(6));
324+
tim.ccmr1_output().modify(|_, w| w.oc2pe().set_bit().oc2m().bits(6));
325325
}
326326

327327
// If pclk is prescaled from hclk, the frequency fed into the timers is doubled

0 commit comments

Comments
 (0)