hello i am beginner in this,i am using example\ peripherals\ saadc for nrf 52832. This example code is done by using timer and i could not understand how to use timer. We need converted data direct from register without timer.
hello i am beginner in this,i am using example\ peripherals\ saadc for nrf 52832. This example code is done by using timer and i could not understand how to use timer. We need converted data direct from register without timer.
To work with the API without timer, you do a
nrf_drv_saadc_sample_convert(0, &adc_buf);
sorry, i am beginner in this please provide example code or more details about this.
Something like this. This is based on SDK 13. For SDK 15, replace nrf_drv_ with nrfx_
#include "nrf_drv_saadc.h" void saadc_event_handler(nrf_drv_saadc_evt_t const * p_event) { // Do nothing, as we use blocking mode } int saadc_init() { int ret = nrf_drv_saadc_init(NULL, saadc_event_handler); if (ret) return ret; nrf_saadc_channel_config_t config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN3); ret = nrf_drv_saadc_channel_init(0, &config); return ret; } int saadc_measure() { nrf_saadc_value_t value; nrf_drv_saadc_sample_convert(0, &value); return value; } int main() { saadc_init(); int measurement = saadc_measure(); }
Something like this. This is based on SDK 13. For SDK 15, replace nrf_drv_ with nrfx_
#include "nrf_drv_saadc.h" void saadc_event_handler(nrf_drv_saadc_evt_t const * p_event) { // Do nothing, as we use blocking mode } int saadc_init() { int ret = nrf_drv_saadc_init(NULL, saadc_event_handler); if (ret) return ret; nrf_saadc_channel_config_t config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN3); ret = nrf_drv_saadc_channel_init(0, &config); return ret; } int saadc_measure() { nrf_saadc_value_t value; nrf_drv_saadc_sample_convert(0, &value); return value; } int main() { saadc_init(); int measurement = saadc_measure(); }
Thank u Andre