#include "app_switchimu.h"
#include "usr_config.h"
#include "bsp_time.h"
#include "system.h"
#include "hal_ble_client.h"
#include "hal_ble_host.h"
#include "hal_mt.h"
#include "nrf_delay.h"
#include "app_flash.h"
#include "hal_led.h"

static uint8_t switch_front_or_center_lsm = USED_FRONT_LSM;

uint8_t app_switchimu_GetGameModeLsm(void)
{
	return switch_front_or_center_lsm;
}

//接收手机命令
void cb_BLE_Client_R_SWITCH_IMU(void* handle)
{
	BLE_Client_Rx_t* target = handle;
	uint8_t cmd = target->pDat[0];
	
	BLE_Host_Tx_Send(0,BLE_SWITCH_IMU,&cmd,1);
	mBackup.RestartCnt =0;
	if(Flash_SaveBackup() != ZONE_OP_SUCCESS)Except_TxError(EXCEPT_Power,"app restart save backup fail");
  
	
	nrf_delay_ms(500);
	NVIC_SystemReset();				//复位重启		
	
}

void app_switchimu_Init(void)
{
	BLE_Client_Rx_Regist(BLE_SWITCH_IMU,cb_BLE_Client_R_SWITCH_IMU);
}





