Commit 10fd652d authored by Tavish Naruka's avatar Tavish Naruka Committed by Sandeep Mistry

set a reset pin if RESET_PIN is defined in variant.h (#212)

* set a reset pin if RESET_PIN is defined in variant.h

* move setting of reset pin to wiring.c

* remove leftover code
parent d91502da
......@@ -44,6 +44,21 @@ void init( void )
NRF_RTC1->INTENSET = RTC_INTENSET_OVRFLW_Msk;
NRF_RTC1->EVTENSET = RTC_EVTEN_OVRFLW_Msk;
NRF_RTC1->TASKS_START = 1;
#if defined(RESET_PIN)
if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) ||
((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_UICR->PSELRESET[0] = RESET_PIN;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_UICR->PSELRESET[1] = RESET_PIN;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NVIC_SystemReset();
}
#endif
}
#ifdef __cplusplus
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment