#include "app_organ.h" #include "nrf_gpio.h" #include "usr_config.h" #include "bsp_time.h" #include "system.h" #include "hal_mt.h" #include "app_host.h" #include "app_charge.h" #include "hal_ble_client.h" #include "hal_ble_host.h" #include "nrf_delay.h" #include "hal_flash.h" #include "ble_comm.h" #include "hal_imu.h" #if LASER_ENABLE static uint8_t OrganIs_open = 0; void cb_BLE_CLient_R_SET_ORGAN(void* handle) { BLE_Client_Rx_t* target = handle; OrganIs_open = target->pDat[0]; DEBUG_LOG("cb_BLE_CLient_R_SET_ORGAN...%d\n",OrganIs_open); IMU_SwitchOrgan(OrganIs_open); BLE_Host_Tx_Send(0,BLE_Host_T_SET_ORGAN,&OrganIs_open,1); } //void app_oragan_Process(void) //{ // static uint32_t tim=0; // if(TIME_GetTicks()-tim>=1000){ tim = TIME_GetTicks(); // // } //} /*********************** 接收从机命令 ************************/ void cb_Host_R_SET_ORGAN(void* handle) { uint8_t data =0; BLE_Host_Rx_t* target = handle; data = (*target->pDat+IMU_GetOrgan()); DEBUG_LOG("Host_R_SET_ORGA...%d\n",data); BLE_Client_Tx_Send(0,BLE_CLient_T_SET_ORGAN,&data,1); //从机应答 } void app_organ_Init(void) { //AA 06 F9 A9 01 53 BLE_Client_Rx_Regist(BLE_CLient_R_SET_ORGAN,cb_BLE_CLient_R_SET_ORGAN); // Process_Start(" ",app_oragan_Process); BLE_Host_Rx_Regist(BLE_Host_R_SET_ORGAN,cb_Host_R_SET_ORGAN); } #endif