1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #include "app_math.h"
- #include "bsp_time.h"
- #include "system.h"
- #include "math.h"
- #include "ble_comm.h"
- #include "app_flash.h"
- #include "detect_zero_vel.h"
- #include "tool.h"
- #include "app_switchimu.h"
- #include "detect_step_by_mag.h"
- #include "pdrStatus.h"
- #include "detect_step_by_mag.h"
- #include "app_client_step.h"
- #include "hal_mt.h"
- #include "hal_led.h"
- #include "bll_imu.h"
- #include "app_game.h"
- static uint32_t timeCNT = 0;
- //校准时间
- void app_math_calit_time(uint8_t appminute){
- timeCNT = (appminute)*60*32768;
- }
- //一小时计时
- static void app_math_Hour_process(void){
- static uint8_t Halfhour_cnt =0;
- uint32_t sec = 0;
- static uint32_t cnt_b=0;
- uint32_t cnt = NRF_RTC0->COUNTER;
- if(cnt<cnt_b) cnt += 16777216;
- timeCNT += cnt - cnt_b;
- sec = (timeCNT)/32768;
-
- if(cnt >16777216)cnt_b = cnt - 16777216;
- else cnt_b = cnt;
-
- if(sec >=1800){//半小时
- if(1 != Halfhour_cnt){
- Halfhour_cnt =1;
- }
- }
-
- if(sec >= 3600){//一小时
- timeCNT =0;
- app_client_step_SetIsScan();
- Halfhour_cnt =0;
- DEBUG_LOG("timeCNT(%d)(%d)\n",timeCNT,sec);
- }
- }
- void app_math_Init(void)
- {
- Process_Start(1000,"math_Hour",app_math_Hour_process);
- }
|