This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PWM Can't Stop


AfterIi stop pwm and uninit pwm, I can't disable a pin left high by the PWM. I am using sdk16 with softdevice 6.0.0 proximity example.

Parents Reply
  • ret_code_t err_code;

    app_pwm_disable(&PWM1);

    err_code = app_pwm_uninit(&PWM1);
    APP_ERROR_CHECK(err_code);


    nrf_gpio_cfg_output(BUZZER);
    nrf_gpio_pin_clear(BUZZER);

    ret_code_t app_pwm_uninit(app_pwm_t const * const p_instance)
    {
    app_pwm_cb_t * p_cb = p_instance->p_cb;

    if (p_cb->state == NRFX_DRV_STATE_POWERED_ON)
    {
    app_pwm_disable(p_instance);
    }
    else if (p_cb->state == NRFX_DRV_STATE_UNINITIALIZED)
    {
    return NRF_ERROR_INVALID_STATE;
    }
    pwm_dealloc(p_instance);

    p_cb->state = NRFX_DRV_STATE_UNINITIALIZED;
    return NRF_SUCCESS;
    }

Children
No Data
Related