app_organ.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #include "hal_laser.h"
  16. #if LASER_ENABLE
  17. static uint8_t OrganIs_open = 0;
  18. void cb_BLE_CLient_R_SET_ORGAN(void* handle)
  19. {
  20. BLE_Client_Rx_t* target = handle;
  21. OrganIs_open = target->pDat[0];
  22. SEGGER_RTT_printf(0,"cb_BLE_CLient_R_SET_ORGAN...%d\n",OrganIs_open);
  23. hal_laser_Enable(OrganIs_open);
  24. BLE_Host_Tx_Send(0,BLE_Host_T_SET_ORGAN,&OrganIs_open,1);
  25. }
  26. //void app_oragan_Process(void)
  27. //{
  28. // static uint32_t tim=0;
  29. // if(TIME_GetTicks()-tim>=1000){ tim = TIME_GetTicks();
  30. //
  31. // }
  32. //}
  33. /*********************** ½ÓÊÕ´Ó»úÃüÁî ************************/
  34. void cb_Host_R_SET_ORGAN(void* handle)
  35. {
  36. uint8_t data =0;
  37. BLE_Host_Rx_t* target = handle;
  38. data = (*target->pDat+hal_laser_Getstate());
  39. SEGGER_RTT_printf(0,"Host_R_SET_ORGA...%d\n",data);
  40. BLE_Client_Tx_Send(0,BLE_CLient_T_SET_ORGAN,&data,1); //´Ó»úÓ¦´ð
  41. }
  42. void app_organ_Init(void)
  43. {
  44. //AA 06 F9 A9 01 53
  45. BLE_Client_Rx_Regist(BLE_CLient_R_SET_ORGAN,cb_BLE_CLient_R_SET_ORGAN);
  46. // Process_Start(" ",app_oragan_Process);
  47. BLE_Host_Rx_Regist(BLE_Host_R_SET_ORGAN,cb_Host_R_SET_ORGAN);
  48. }
  49. #endif