drivers: pwm: stm32: fix polarity setting

PWM polarity was not being set correctly because flags were not checked
correctly.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2020-07-06 19:57:34 +02:00 committed by Carles Cufí
commit 2ece951c1b

View file

@ -94,7 +94,7 @@ static inline const struct pwm_stm32_config *to_config(struct device *dev)
*/ */
static uint32_t get_polarity(pwm_flags_t flags) static uint32_t get_polarity(pwm_flags_t flags)
{ {
if (flags & PWM_POLARITY_NORMAL) { if ((flags & PWM_POLARITY_MASK) == PWM_POLARITY_NORMAL) {
return LL_TIM_OCPOLARITY_HIGH; return LL_TIM_OCPOLARITY_HIGH;
} }