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

Using comparator functions in Zephyr and NRF Connect

Although my Googling skills are not the best I have, so far, been unable to find any examples or driver documentation for the comparator peripheral of the nRF52840 for the nRF Connect SDK. Everything I have found is centred around the nRF5 SDK.

One example I looked at has a set of calls to configure it that are all missing a parameter, eg. 

Fullscreen
1
2
3
4
5
6
nrf_comp_ref_set(NRF_COMP_REF_Int1V8);
nrf_comp_main_mode_set(NRF_COMP_MAIN_MODE_SE);
nrf_comp_speed_mode_set(NRF_COMP_SP_MODE_High);
nrf_comp_hysteresis_set(NRF_COMP_HYST_NoHyst);
nrf_comp_input_select(NRF_COMP_INPUT_0);
nrf_comp_enable();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


It appears that each of these functions now requires a {NRF_COMP_Type *} parameter passed first. I have not found any example or description with this parameter supplied and have so far been unable to find out how I should obtain the relevant pointer address. I imagine this is the memory address for the registers for the comparator being configured but there must be a symbolic way to obtain this that I am just missing.

Where can I find an example of the comparator being used in a Zephyr nRF Connect SDK based application?