Skip to content

Commit d8cf5a0

Browse files
committed
cpu/stm32/periph_pwm: add doc for complementary timer channels
1 parent 6221030 commit d8cf5a0

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cpu/stm32/include/periph/cpu_pwm.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,21 @@ extern "C" {
3333

3434
/**
3535
* @brief PWM channel
36+
*
37+
* When using a general-purpose timer for a PWM device, the outputs OC<n> of
38+
* each of the four capture/compare channels can be used as PWM channel.
39+
* The respective capture/compare channel is then specified with 0...3 in
40+
* `cc_chan` for the outputs OC1...OC4.
41+
*
42+
* Advanced timers like TIM1 and TIM8 have additionally three complementary
43+
* outputs OC<n>N of the capture/compare channels, which can also be used
44+
* as PWM channels. These complementary outputs are defined with an offset
45+
* of 4, i.e. they are specified in `cc_chan` with 4...6 for OC1N...OC3N.
3646
*/
3747
typedef struct {
3848
gpio_t pin; /**< GPIO pin mapped to this channel */
39-
uint8_t cc_chan; /**< capture compare channel used */
49+
uint8_t cc_chan; /**< Capture/compare channel used: 0..3 for OC1..OC4
50+
or 4..6 for OC1N..OC3N for advanced timers */
4051
} pwm_chan_t;
4152

4253
/**

0 commit comments

Comments
 (0)