Merge pull request #697 from lyusupov/master
add an interface to read Reset reason
This commit is contained in:
2 files changed
+10
No files matched your search
@@ -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 readResetReason(void)
|
||||
{
|
||||
return _reset_reason;
|
||||
}
|
||||
|
||||
void enterUf2Dfu(void)
|
||||
{
|
||||
NRF_POWER->GPREGRET = DFU_MAGIC_UF2_RESET;
|
||||
|
||||
@@ -29,6 +29,8 @@ extern uint32_t bootloaderVersion;
|
||||
|
||||
extern void init(void);
|
||||
|
||||
uint32_t readResetReason(void);
|
||||
|
||||
void enterSerialDfu(void);
|
||||
void enterOTADfu(void);
|
||||
void enterUf2Dfu(void);
|
||||
|
||||
Reference in new issue
Block a user