Skip to content

Commit

Permalink
[nrf fromlist] drivers: pwm: nrfx: Add idle output to PWM driver.
Browse files Browse the repository at this point in the history
Fast PWM120 prevents GPIO from driving pin with low/high
state when PWM duty is 0% or 100%. Idleout feature needs to
be used. It can be configured when PWM is disabled and works
while it is enabled.

Upstream PR #: 83652

Signed-off-by: Michał Stasiak <[email protected]>
  • Loading branch information
mstasiaknordic committed Jan 8, 2025
1 parent 1d687c4 commit 6c532a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/pwm/pwm_nrfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,13 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel,
out_level ^= 1;
}

#if NRF_PWM_HAS_IDLEOUT
nrfx_pwm_stop(&config->pwm, true);
nrfy_pwm_channel_idle_set(config->pwm.p_reg, channel, out_level);
nrfy_pwm_enable(config->pwm.p_reg);
#else
nrf_gpio_pin_write(psel, out_level);
#endif
}

data->pwm_needed &= ~BIT(channel);
Expand Down

0 comments on commit 6c532a1

Please sign in to comment.