add an interface to read Reset reason

This commit is contained in:
Linar Yusupov committed 2021-10-13 09:38:47 +03:00
1 parent 7770246e25
commit 9722dda24a
2 files changed
+10

No files matched your search

+8
View File
@@ -30,9 +30,12 @@ nrf_nvic_state_t nrf_nvic_state;
// Must match temp register in bootloader
#define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0]
uint32_t bootloaderVersion = 0;
static uint32_t _reset_reason = 0;
void init( void )
{
_reset_reason = NRF_POWER->RESETREAS;
// clear reset reason: can save it for application usage if needed.
NRF_POWER->RESETREAS |= NRF_POWER->RESETREAS;
@@ -66,6 +69,11 @@ void init( void )
#endif
}
uint32_t getResetReason(void)
{
return _reset_reason;
}
void enterUf2Dfu(void)
{
NRF_POWER->GPREGRET = DFU_MAGIC_UF2_RESET;
+2
View File
@@ -29,6 +29,8 @@ extern uint32_t bootloaderVersion;
extern void init(void);
uint32_t getResetReason(void);
void enterSerialDfu(void);
void enterOTADfu(void);
void enterUf2Dfu(void);