app_switchimu.c 708 B

1234567891011121314151617181920212223242526272829303132333435
  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. //½ÓÊÕÊÖ»úÃüÁî
  12. void cb_BLE_Client_R_SWITCH_IMU(void* handle)
  13. {
  14. BLE_Client_Rx_t* target = handle;
  15. uint8_t cmd = target->pDat[0];
  16. BLE_Host_Tx_Send(0,BLE_SWITCH_IMU,&cmd,1);
  17. mBackup.RestartCnt =0;
  18. if(Flash_SaveBackup() != ZONE_OP_SUCCESS)Except_TxError(EXCEPT_Power,"app restart save backup fail");
  19. nrf_delay_ms(500);
  20. NVIC_SystemReset(); //¸´Î»ÖØÆô
  21. }
  22. void app_switchimu_Init(void)
  23. {
  24. BLE_Client_Rx_Regist(BLE_SWITCH_IMU,cb_BLE_Client_R_SWITCH_IMU);
  25. }