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:
parent
20ae0a7be9
commit
d3d6ba1afb
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue