app_switchimu.c 818 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. static uint8_t switch_front_or_center_lsm = USED_FRONT_LSM;
  10. uint8_t app_switchimu_GetGameModeLsm(void)
  11. {
  12. return switch_front_or_center_lsm;
  13. }
  14. //½ÓÊÕÊÖ»úÃüÁî
  15. void cb_BLE_Client_R_SWITCH_IMU(void* handle)
  16. {
  17. BLE_Client_Rx_t* target = handle;
  18. uint8_t cmd = target->pDat[0];
  19. switch(cmd)
  20. {
  21. case 0:
  22. switch_front_or_center_lsm = USED_FRONT_LSM;
  23. MT_Run(1000);
  24. break;
  25. case 1:
  26. switch_front_or_center_lsm = USED_CENTER_LSM;
  27. MT_Run(1000);
  28. break;
  29. }
  30. BLE_Host_Tx_Send(0,BLE_SWITCH_IMU,&cmd,1);
  31. }
  32. void app_switchimu_Init(void)
  33. {
  34. BLE_Client_Rx_Regist(BLE_SWITCH_IMU,cb_BLE_Client_R_SWITCH_IMU);
  35. }