Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_saadc_channel_input_set() called twice

This is almost certainly a benign bug, but it doesn't hurt to point it out.

In nRF5_SDK_15.0.0_a53641a, nrf_drv_saadc_channel_init() is a macro that expands into a call to nrfx_saadc_channel_init() as follows:

nrfx_err_t nrfx_saadc_channel_init(uint8_t channel,
                                   nrf_saadc_channel_config_t const * const p_config)
{
    ...
    nrf_saadc_channel_init(channel, p_config);
    nrf_saadc_channel_input_set(channel, p_config->pin_p, p_config->pin_n);
    ...
    return err_code;
}

However, inside nrf_saadc_channel_init(), we have the following:

__STATIC_INLINE void nrf_saadc_channel_init(uint8_t channel,
                                            nrf_saadc_channel_config_t const * const config)
{
    ...
    nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n);
}

... with the result that nrf_saadc_channel_input_set() is called twice.

As I mentioned, this is probably benign, and likely just a holdover from the legacy SDK.  But I thought it's worth pointing out.

Parents Reply Children
No Data
Related