19 #include "app_error.h"
23 #include "bootloader_types.h"
24 #include "bootloader_util.h"
28 #define MAX_RTC_COUNTER_VAL 0x00FFFFFF
41 uint32_t interrupt_setting_mask;
45 interrupt_setting_mask = NVIC->ISER[0];
49 if (interrupt_setting_mask & (0x01 << irq))
52 NVIC_DisableIRQ((IRQn_Type)irq);
67 uint32_t err_code = sd_app_evt_wait();
68 APP_ERROR_CHECK(err_code);
74 uint32_t err_code = sd_power_system_off();
75 APP_ERROR_CHECK(err_code);
78 uint32_t
ticks_diff(uint32_t ticks_now, uint32_t ticks_old)
80 if(ticks_old>ticks_now)
95 uint32_t err_code = sd_power_gpregret_set(BOOTLOADER_DFU_START);
96 APP_ERROR_CHECK(err_code);
98 err_code = sd_softdevice_disable();
99 APP_ERROR_CHECK(err_code);
101 err_code = sd_softdevice_vector_table_base_set(NRF_UICR->NRFFW[0]);
102 APP_ERROR_CHECK(err_code);
104 NVIC_ClearPendingIRQ(SWI2_IRQn);
106 bootloader_util_app_start(NRF_UICR->NRFFW[0]);
108 #endif // DFU_SUPPORT
void power_manage(void)
Power manager.
uint32_t ticks_diff(uint32_t ticks_now, uint32_t ticks_old)
#define MAX_RTC_COUNTER_VAL
void dfu_start(void)
Starts DFU mode. The function writes a special value to retention register to tell bootloader to star...
void system_off(void)
Function to put system in SYSTEMOFF mode.
static void interrupts_disable(void)
Function for disabling all interrupts before jumping from bootloader to application.