I wonder if it is OK to change the lpcomp ref input on the fly, without any other stop task or disable/enable. Just like this:
//--------------------
static void lpcomp_set_ref(int hl)
{
if (hl == 1)
NRF_LPCOMP->REFSEL = (NRF_LPCOMP_REF_SUPPLY_7_8 << LPCOMP_REFSEL_REFSEL_Pos) & LPCOMP_REFSEL_REFSEL_Msk;
else
NRF_LPCOMP->REFSEL = (NRF_LPCOMP_REF_SUPPLY_1_8 << LPCOMP_REFSEL_REFSEL_Pos) & LPCOMP_REFSEL_REFSEL_Msk;
}
//---------------------------------
Thanks