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;
3030// Must match temp register in bootloader
3131#define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0]
3232uint32_t bootloaderVersion = 0 ;
33+ static uint32_t _reset_reason = 0 ;
3334
3435void init ( void )
3536{
37+ _reset_reason = NRF_POWER -> RESETREAS ;
38+
3639 // clear reset reason: can save it for application usage if needed.
3740 NRF_POWER -> RESETREAS |= NRF_POWER -> RESETREAS ;
3841
@@ -66,6 +69,11 @@ void init( void )
6669#endif
6770}
6871
72+ uint32_t readResetReason (void )
73+ {
74+ return _reset_reason ;
75+ }
76+
6977void enterUf2Dfu (void )
7078{
7179 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;
2929
3030extern void init (void );
3131
32+ uint32_t readResetReason (void );
33+
3234void enterSerialDfu (void );
3335void enterOTADfu (void );
3436void enterUf2Dfu (void );
You can’t perform that action at this time.
0 commit comments