app_switchimu.c 855 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "app_switchimu.h"
  2. #include "usr_config.h"
  3. #include "bsp_time.h"
  4. #include "system.h"
  5. #include "hal_ble_client.h"
  6. #include "hal_ble_host.h"
  7. #include "hal_mt.h"
  8. #include "nrf_delay.h"
  9. #include "app_flash.h"
  10. #include "hal_led.h"
  11. static uint8_t switch_front_or_center_lsm = USED_FRONT_LSM;
  12. uint8_t app_switchimu_GetGameModeLsm(void)
  13. {
  14. return switch_front_or_center_lsm;
  15. }
  16. //½ÓÊÕÊÖ»úÃüÁî
  17. void cb_BLE_Client_R_SWITCH_IMU(void* handle)
  18. {
  19. BLE_Client_Rx_t* target = handle;
  20. uint8_t cmd = target->pDat[0];
  21. BLE_Host_Tx_Send(0,BLE_SWITCH_IMU,&cmd,1);
  22. mBackup.RestartCnt =0;
  23. if(Flash_SaveBackup() != ZONE_OP_SUCCESS)Except_TxError(EXCEPT_Power,"app restart save backup fail");
  24. nrf_delay_ms(500);
  25. NVIC_SystemReset(); //¸´Î»ÖØÆô
  26. }
  27. void app_switchimu_Init(void)
  28. {
  29. BLE_Client_Rx_Regist(BLE_SWITCH_IMU,cb_BLE_Client_R_SWITCH_IMU);
  30. }