Situation: We are building BLE device that have GATT service showing a analog sensor value. AIN2 is connected to the sensor. AIN4 is connected to battery. We would like to stop BLE advertising while the sensor value continue to be low, and restart when the value raise. So, we switch to LPCOMP peripheral for AIN2 when the sensor value become low.
We are using nrf51822 on SDK 8.0.0.
Problem: The switching between ADC and LPCOMP itself works well. However, while LPCOMP is on, AIN4 do not measure battery value correctly. And it seems to be the sensor value.
I read this article. But I think it is a little bit different situation. It does not switch the functions on the same pin.
We are happy if you have any advice. If you need sample code, I am preparing simple version for this situation.