Files
checker_slave/source/elec_det/hardware/timer_cfg.h
ranchuan bff9b1b774 V2.05
重写延时等待函数,解决与模块之间通信间隔有可能过短的问题
    修改硬件版本号时自动修改can波特率
2023-11-13 17:34:05 +08:00

74 lines
1.7 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef TIMER_CFG_H_
#include "base/define.h"
#include "stm32f10x_tim.h"
typedef void (*Timerupdatefunc)(void );
typedef void (*TimerTriger)(uint8_t );
//停止超时定时器计数
void RunTimeoutStop(void);
/*
@brief 发送时钟校准波形
@param pre_us 发送的周期
@param count 发送周期的个数
*/
void FireBus_ClkAmend(uint16_t pre_us,uint16_t trigger_us,uint16_t count,void *p_fun);
/*
@brief 超时定时器,单位0.1ms
@param ms 最大可设置6553。
@param pfunc 超时回调函数,注意回调函数中不能做长延时任务
*/
void RunTimeOut_Timer(uint16_t ms,Timerupdatefunc pfunc );
//获取超时定时器计数值
uint16_t GetRunTimeOutCount(void);
/*
延时定时器初始化,单次向上计数
*/
void DelayTimer_Init(void);
/*
延时定时器初始化,单次向上计数
*/
void TimerCount_Init(void);
/*
@breif 等待定时器计数值大于设定值
@param 等待定时器的结束值单位0.1ms
*/
void WaitDelayEnd(uint16_t wait_time);
/*
@brief 重启延时定时器
*/
void StartDelayTime(void);
#define GET_COUNTTIM_VAL() (TIM2->CNT)
/*
@brief 获取当前定时器计数值单位1us。并重启计数
@rtv 返回上次的计数值
*/
uint16_t Get1usCount(void);
/*
@brief 获取当前定时器计数值单位10us。并重启计数
@rtv 返回上次的计数值
*/
uint16_t Get10usCount(void);
/*
@brief 获取当前定时器计数值单位0.1ms。并重启计数
@rtv 返回上次的计数值
*/
uint16_t Get100usCount(void);
/*
@brief 直接获取定时器的值
*/
uint16_t GetCountTimerCnt(void);
/*
使用轮询的方式检测校准结束
*/
void FireBus_ClkAmendCycle(void);
// 复位并关闭定时器
void TimerCount_Off(void);
#endif