app_organ.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "app_organ.h"
  2. #include "nrf_gpio.h"
  3. #include "usr_config.h"
  4. #include "bsp_time.h"
  5. #include "system.h"
  6. #include "hal_mt.h"
  7. #include "app_host.h"
  8. #include "app_charge.h"
  9. #include "hal_ble_client.h"
  10. #include "hal_ble_host.h"
  11. #include "nrf_delay.h"
  12. #include "hal_flash.h"
  13. #include "ble_comm.h"
  14. #include "hal_imu.h"
  15. #if LASER_ENABLE
  16. static uint8_t OrganIs_open = 0;
  17. void cb_BLE_CLient_R_SET_ORGAN(void* handle)
  18. {
  19. BLE_Client_Rx_t* target = handle;
  20. OrganIs_open = target->pDat[0];
  21. SEGGER_RTT_printf(0,"cb_BLE_CLient_R_SET_ORGAN...%d\n",OrganIs_open);
  22. IMU_SwitchOrgan(OrganIs_open);
  23. BLE_Host_Tx_Send(0,BLE_Host_T_SET_ORGAN,&OrganIs_open,1);
  24. }
  25. //void app_oragan_Process(void)
  26. //{
  27. // static uint32_t tim=0;
  28. // if(TIME_GetTicks()-tim>=1000){ tim = TIME_GetTicks();
  29. //
  30. // }
  31. //}
  32. /*********************** ½ÓÊÕ´Ó»úÃüÁî ************************/
  33. void cb_Host_R_SET_ORGAN(void* handle)
  34. {
  35. uint8_t data =0;
  36. BLE_Host_Rx_t* target = handle;
  37. data = (*target->pDat+IMU_GetOrgan());
  38. SEGGER_RTT_printf(0,"Host_R_SET_ORGA...%d\n",data);
  39. BLE_Client_Tx_Send(0,BLE_CLient_T_SET_ORGAN,&data,1); //´Ó»úÓ¦´ð
  40. }
  41. void app_organ_Init(void)
  42. {
  43. //AA 06 F9 A9 01 53
  44. BLE_Client_Rx_Regist(BLE_CLient_R_SET_ORGAN,cb_BLE_CLient_R_SET_ORGAN);
  45. // Process_Start(" ",app_oragan_Process);
  46. BLE_Host_Rx_Regist(BLE_Host_R_SET_ORGAN,cb_Host_R_SET_ORGAN);
  47. }
  48. #endif