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

DOUBT IN ADC CONFIGURATION

HI ,

  •  I want to configure P0.02  as an adc channel .
  •  I also want to read the adc value from P0.02 at regular intervals.
  •  For regular intervals i will put a timer and inside the timer handler function i will call the function for reading adc value .

My doubts

  1. which  are function using to configure or initializing  the adc ?
  2. which function is using  for  read the the adc value?

SDK i am using "nRF5_SDK_14.2.0_17b948a".

I am configuring  adc for battery level detection .

Please answer to  1 and 2

Parents
  • SDK i am using "nRF5_SDK_14.2.0_17b948a

    Why are you using an old SDK ?

    Have you looked at the SAADC example in the SDK ?

  • HI,

        Actually our product is 2d-3d combinational mouse .

    • so we are using "ble_app_hids_mouse" application from  nRF5_SDK_14.2.0_17b948a
    • so i want to configure the adc to it.
      • Have you looked at the SAADC example in the SDK ?
    • yes i looked it 

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    void saadc_init(void)
    {
    ret_code_t err_code;
    nrf_saadc_channel_config_t channel_config =
    NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN0);

    err_code = nrf_drv_saadc_init(NULL, saadc_callback);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_channel_init(0, &channel_config);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[0], SAMPLES_IN_BUFFER);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[1], SAMPLES_IN_BUFFER);
    APP_ERROR_CHECK(err_code);

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    1. Is the above function if  enough for intilization?
    2. How we can read the adc value which function is using for it . I didn't saw any function which returns converted adc value . please help me.
  • i looked it

    Don't just look it - build it, run it, and see what it does!

    How to properly post source code:

Reply Children
Related