/********************** Í·Îļþ *************************/ #include "usr.h" #include "hal_imu.h" #include "hal_step.h" #include "system.h" #include "bsp_time.h" #include "hal_ble_client.h" #include "hal_flash.h" #include "detect_step_by_mag.h" #if DEBUG_STEP extern uint16_t realStepAdd_R,mag_sqrt; void hal_step_matlib_Test(void) { static uint8_t buf[24] ={0}; uint8_t L =0; buf[L++] = (uint8_t)(mFlash.mStep.stepCur[0]>>8); buf[L++] = (uint8_t)(mFlash.mStep.stepCur[0]>>0); buf[L++] = (uint8_t)(mag_sqrt>>8); buf[L++] = (uint8_t)(mag_sqrt); buf[L++] = (uint8_t)(realStepAdd_R>>8); buf[L++] = (uint8_t)(realStepAdd_R>>0); BLE_Client_Tx_Send(0,BLE_Client_T_REALTIMESTEP,buf,L); } #endif static void hal_step_process(void){ if(hal_Realstep_GetState())return; if(1 == detect_step_by_mag(hal_Mag_GetXYZ(Mag_Front))){ mFlash.mStep.stepCur[0]++; // SEGGER_RTT_printf(0,">>>>>>>>current step:%d\r\n",mFlash.mStep.stepCur[0]); }else if(isLoader == 1){ load_cal++; if(load_cal >= (60000/50)){ isLoader =0; load_cal =0; SEGGER_RTT_printf(0,"isLoader:%d\r\n",isLoader); } } #if DEBUG_STEP hal_step_matlib_Test()£» #endif } //static void hal_stepSaveTest_process(void){ // mFlash.mStep.stepCur[0]++; // SEGGER_RTT_printf(0,"hal step Save one minute:step %d\r\n",mFlash.mStep.stepCur[0]); //} void hal_step_init(void){ Process_Start(50,"hal_step_process",hal_step_process); //if(mFlash.isHost)Process_Start(10000,"hal_stepSaveTest",hal_stepSaveTest_process); }