123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- #include "soft_timer.h"
- #include "main.h"
- #include "stdbool.h"
- #include "soft_flow.h"
- #include "soft_can.h"
- #include "tim.h"
- #include "can_debug.h"
- #include "soft_p_2_c.h"
- extern uint32_t user_timer_cnt;
- /**
- * @file timer_function
- * @brief 发送给控制的定时器
- * @param
- * @details
- * @author Zhang Sir
- **/
- bool vol_flag = false, devtype_flag = false, engine_flag = false,
- can_debug_flag = false, dev_version_flag = false, mimo360_radar_flag = false,DM_radar_flag = false,
- pmu_heart_flag = false;
- Dev_timer devinfo_time;
- void timer_function()
- {
- static uint32_t time_1hz = 0;
- static uint32_t time_2hz = 0;
- static uint32_t time_5hz = 0;
- static uint32_t time_10hz = 0;
- static uint32_t time_20hz = 0;
- static uint32_t time_50hz = 0;
- static uint32_t time_100hz = 0;
- static uint32_t time_200hz = 0;
- if ( Check_Timer_Ready(&time_1hz,_1_HZ_) )
- {
- devinfo_time.arm = true;
- }
- if ( Check_Timer_Ready(&time_2hz,_2_HZ_) )
- {
- devinfo_time.pump = true;
- devinfo_time.nozzle = true;
- devinfo_time.seed = true;
- devinfo_time.checklow = true;
- devinfo_time.current = true;
- dev_version_flag = true;
- }
- if ( Check_Timer_Ready(&time_5hz,_5_HZ_))
- {
- engine_flag = true;
- devinfo_time.bms = true;
- if(planep.Candebug_flag == true)
- {
- can_debug_flag = true;
- }
- else
- {
- can_debug_flag = false;
- }
- }
- if ( Check_Timer_Ready(&time_10hz,_10_HZ_) )
- {
- }
- if ( Check_Timer_Ready(&time_20hz,_20_HZ_) )
- {
- vol_flag = true;
- mimo360_radar_flag = true;
- DM_radar_flag = true;
- devinfo_time.weight = true;
- devinfo_time.L_pump1 = true;
- devinfo_time.L_pump2 = true;
- devinfo_time.radar = true;
- devinfo_time.part_radar = true;
- devinfo_time.flow = true;
- }
- if ( Check_Timer_Ready(&time_50hz,_50_HZ_) )
- {
-
- }
- if(Check_Timer_Ready(&time_100hz,_100_HZ_))
- {
- }
- if(Check_Timer_Ready(&time_200hz,_200_HZ_))
- {
- devtype_flag = true;
- }
- }
- /**
- * @file Get_Systimer_Us
- * @brief 获取系统当前时间us
- * @param
- * @details
- * @author Zhang Sir
- **/
- uint32_t Get_Systimer_Us(void)
- {
- //return htim4.Instance->CNT + user_timer_cnt * 0xffff;
- return htim4.Instance->CNT + user_timer_cnt * 20000;
- }
|