Пример #1
0
int main()
{
    simple_uart_config(RTS_PIN_NUMBER, TX_PIN_NUMBER, CTS_PIN_NUMBER, RX_PIN_NUMBER, 0);
    xprintf("\n\n\n\n\n\r\n region2 start..\r\n");
       
    if(region1_is_valid())
    {
        xprintf("dump to region11111\r\n");
        bootloader_app_start();
    }
    
    system_app_pages_erase(CODE_REGION_1_START, CODE_REGION_1_SIZE);
    xprintf(" app area has eased..\r\n");

    ble_start(); 
  
    for( ; ;)
    {
        ble_rec_handle();       
        
        if(get_dfu_state() == SYSTEM_UPDATE_END)
        {            
            xprintf("system update end.\r\n");
            sd_softdevice_disable();
            
            flash_specword_write((uint32_t*)BOOTLOADER_SETTINGS_ADDRESS, SYSTEM_APP_VALID_OFFSET, SYSTEM_APP_VALID); 
            NVIC_SystemReset();  
        }
       
        if(get_dfu_state() == SYSTEM_UPDATE_FAILURE)
        {
            xprintf("system update failed.\r\n");
            NVIC_SystemReset();            
        }
    }

    
}
Пример #2
0
/*--------------------------- ble work init -------------------------*/
void system_ble_work_mode_init(void)
{
    ble_prepare();
    ble_start();
}