File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,12 @@ nrf_nvic_state_t nrf_nvic_state;
30
30
// Must match temp register in bootloader
31
31
#define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0]
32
32
uint32_t bootloaderVersion = 0 ;
33
+ static uint32_t _reset_reason = 0 ;
33
34
34
35
void init ( void )
35
36
{
37
+ _reset_reason = NRF_POWER -> RESETREAS ;
38
+
36
39
// clear reset reason: can save it for application usage if needed.
37
40
NRF_POWER -> RESETREAS |= NRF_POWER -> RESETREAS ;
38
41
@@ -66,6 +69,11 @@ void init( void )
66
69
#endif
67
70
}
68
71
72
+ uint32_t getResetReason (void )
73
+ {
74
+ return _reset_reason ;
75
+ }
76
+
69
77
void enterUf2Dfu (void )
70
78
{
71
79
NRF_POWER -> GPREGRET = DFU_MAGIC_UF2_RESET ;
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ extern uint32_t bootloaderVersion;
29
29
30
30
extern void init (void );
31
31
32
+ uint32_t getResetReason (void );
33
+
32
34
void enterSerialDfu (void );
33
35
void enterOTADfu (void );
34
36
void enterUf2Dfu (void );
You can’t perform that action at this time.
0 commit comments