I am programming a RAK4631 Board, which is of course based on the nrf52840 SoC. The BaseLine Device tree has no detail in the ADC Node so I have created an overlay. The RAK4631 documentation indicates that AIN2 (P0.04) is directly connected to the battery for voltage measurement. There are many Arduino examples out there but not many C code examples. Here is my overlay file contents:
00> [00:30:36.002,075] <err> ublox_gps: Failed to read ADC: -22