示例#1
0
/*--------------------------- ble mode operate -------------------------*/
void system_ble_work_mode_operate(void)
{
    if(BL.E.TIME_OUT_STATE == true || BL.E.END_TRANS_STATE == true)  // time out
    {
        ble_close();
    }
    else
    {
        ble_rec_handle();
    }

    // ble_data_operate;
}
示例#2
0
文件: main.c 项目: CorBiNO/Atomwear
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();            
        }
    }

    
}