Using one ADC, the current can be reduced to about 40uA after the ADC value is taken.
Using a two-channel ADC, after the ADC value is taken, the current stops at about 0.4 mA and cannot reach about 40 uA.
How can I reduce the current to about 40uA with two ADCs?
void device_adc_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);
nrf_saadc_channel_config_t channe2_config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN1);
err_code = nrf_drv_saadc_init(NULL, adc_event_handler);
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_channel_init(1, &channe2_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);
}
void adc_event_handler(nrf_drv_saadc_evt_t const * p_event)
{
ret_code_t err_code;
float battery = 0,sun = 0;//
if (p_event->type == NRF_DRV_SAADC_EVT_DONE)
{
err_code = nrf_drv_saadc_buffer_convert(p_event->data.done.p_buffer, SAMPLES_IN_BUFFER);
APP_ERROR_CHECK(err_code);
battery = p_event->data.done.p_buffer[0] + p_event->data.done.p_buffer[2] + p_event->data.done.p_buffer[4] + p_event->data.done.p_buffer[6] + p_event->data.done.p_buffer[8];
UserSetting.battery_voltage = (int16_t)(((battery/(5*1024))*0.6*11)*1000);
sun = p_event->data.done.p_buffer[1] + p_event->data.done.p_buffer[3] + p_event->data.done.p_buffer[5] + p_event->data.done.p_buffer[7] + p_event->data.done.p_buffer[9];
if(sun < 100)
{
UserSetting.mainboard_voltage = 0;
}
else
{
UserSetting.mainboard_voltage = (int16_t)(((sun/(5*1024))*0.6*11)*1000);
}
}
}