This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can I detect the state of an LPCOMP input?

I am programming a device with a NF52 that uses a hall effect switch o enter/exit sleep mode when BLE is in advertising mode. When connected, It will generate a separate BLE notification for the condition that a magnet is present or not.

I have the LPCOMP set to generate an interrupt on a CROSS event. My handler has code for the cases of an UP or DOWN event, but this doesn't seem to work.

if (event == NRF_LPCOMP_EVENT_DOWN) { ...do something }

if (event == NRF_LPCOMP_EVENT_UP) { ...do something }

I've also tried configuring the pin as an output and reading its state, but this does not work either. How can test if a pin is low or high when set to trigger an LPCOMP interrupt when the state changes?

Related