How the ASYNC read API work in ADC with sample code

What is the difference between the Async Read ApI and the Normal Read API of the ADC ?How the ASYNC read API work ,can anybody explain with sample code. Specially thirds argument of API 

struct k_poll_signal *async) what exactly we need to set in this? Can we configure the multiple channel for the ADC Async read 
  • Hello,

    Thank you for your patience with this.

    What is the difference between the Async Read ApI and the Normal Read API of the ADC ?

    The difference between the two is whether or not the sampling will happen asynchronously or not.
    In essence, this means that completion of the sampling will be signaled with a polling event, you can read more about this in the polling API documentation.
    If you look into the adc_nrfx_saadc.c driver, you could see how the CONFIG_ADC_ASYNC kconfig option changes the sampling procedure.

    Specially thirds argument of API 

    struct k_poll_signal *async) what exactly we need to set in this?

    You will need to provide a k_poll_signal which is tied to a poll event.
    You could see how this could be done in the test_task_asynchronous_call function of the zephyr driver test.

    Can we configure the multiple channel for the ADC Async read 

    Yes, if multiple channels are enabled then the SAADC will enter scan mode and sample each enabled channel sequentially when a sampling is triggered.

    Best regards,
    Karl

Related