Dear sir,
I have a light sensor connected to P0.04/AIN2 on 52820. How can i get the change of voltage?
I use the COMP, and has enabled COMP_ENABLED in sdk_config.h, compiled successfully and can run on board, but comp_event_handler does not be called when light changed.
The code like follow. Does any wrong? Thank you!
#include "nrf_drv_comp.h"
void comp_event_handler(nrf_comp_event_t evt)
{
NRF_LOG_INFO("#############comp_event_handler#####");
}
void COMP_TEST()
{
uint32_t err_code;
nrf_drv_comp_config_t comp_config = NRF_DRV_COMP_DEFAULT_CONFIG(NRF_COMP_INPUT_2);
err_code = nrf_drv_comp_init(&comp_config, comp_event_handler);
nrf_drv_comp_start(NRF_DRV_COMP_EVT_EN_CROSS_MASK ,NRFX_COMP_SHORT_STOP_AFTER_CROSS_EVT);
while (true)
{
idle_state_handle();
}
}