#include <zephyr/kernel.h>

int main(void)
{
	/* This is a dummy delay to see if the device resets */
	uint32_t delay = 0x100000;
	while (delay --);

    NRF_POWER->RAM[2].POWER = 0;
    NRF_POWER->RAM[3].POWER = 0;
    NRF_POWER->RAM[4].POWER = 0;
    NRF_POWER->RAM[5].POWER = 0;
    NRF_POWER->RAM[6].POWER = 0;
    NRF_POWER->RAM[7].POWER = 0;

	/* 1. Enable LFXO */
	#if 0
	NRF_CLOCK->LFCLK.SRC = 1; // LFXO
	NRF_CLOCK->TASKS_LFCLKSTART = 1;
	while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0);
	NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;

	/* 2. Start NRF_GRTC */
	NRF_GRTC->MODE |= 2; // bit 1: SYSCOUNTEREEN
	NRF_GRTC->CLKCFG = 0x00001; // LFXO
	NRF_GRTC->TASKS_START = 1;
	NRF_GRTC->TIMEOUT = 2;
	#endif

	while (1) {
		k_cpu_idle();
	}
	return 0;
}
