nrfx_pwm: Fix multiple pwm_stopped_check calling

After receiving NRF_PWM_EVENT_STOPPED event,
driver state should be changed to NRFX_DRV_STATE_INITIALIZED
as in irq_handler function.

Signed-off-by: Witold Lukasik <witold.lukasik@nordicsemi.no>
Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
This commit is contained in:
Witold Lukasik 2023-07-05 10:58:07 +02:00 committed by Adam Wojasinski
parent 20ae0a7be9
commit d3d6ba1afb
No known key found for this signature in database
GPG Key ID: C0B3128A64ED5CA5
1 changed files with 8 additions and 8 deletions

View File

@ -171,16 +171,16 @@ static bool pwm_stopped_check(nrfx_pwm_t const * p_instance)
{
pwm_control_block_t * p_cb = &m_cb[p_instance->instance_id];
if (p_cb->handler)
if (!p_cb->handler)
{
return (p_cb->state == NRFX_DRV_STATE_POWERED_ON ? false : true);
}
else
{
return ((p_cb->state != NRFX_DRV_STATE_POWERED_ON) ||
(nrfy_pwm_events_process(p_instance->p_reg,
NRFY_EVENT_TO_INT_BITMASK(NRF_PWM_EVENT_STOPPED))));
if (nrfy_pwm_events_process(p_instance->p_reg,
NRFY_EVENT_TO_INT_BITMASK(NRF_PWM_EVENT_STOPPED)))
{
p_cb->state = NRFX_DRV_STATE_INITIALIZED;
}
}
return p_cb->state != NRFX_DRV_STATE_POWERED_ON;
}
nrfx_err_t nrfx_pwm_init(nrfx_pwm_t const * p_instance,