Ai
7 Star 20 Fork 6

THEWON/rt_thread_repo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
hwtimerreload.h 1.51 KB
一键复制 编辑 原始数据 按行查看 历史
thewon 提交于 2022-03-21 16:08 +08:00 . add hwtimer_reload algorithm test
#ifndef HWTIMER_H
#define HWTIMER_H
//#include <qglobal.h>
#define HIGH_SPEED // 启用高速度低精度运算,将降低 calcTimerReload32 calcTimerReload64 两个算法的结束条件
#ifdef QT_VERSION
typedef qint32 rt_int32_t;
typedef quint32 rt_uint32_t;
typedef quint64 rt_uint64_t;
typedef quint8 rt_uint8_t;
#else
typedef signed int rt_int32_t;
typedef unsigned int rt_uint32_t;
typedef unsigned long long rt_uint64_t;
typedef unsigned char rt_uint8_t;
#endif
typedef struct rt_hwtimerval
{
rt_int32_t sec; /* second */
rt_int32_t usec; /* microsecond */
} rt_hwtimerval_t;
/* Timer Feature Information */
struct rt_hwtimer_info
{
rt_int32_t maxfreq; /* the maximum count frequency timer support */
rt_int32_t minfreq; /* the minimum count frequency timer support */
rt_uint8_t cntmode; /* count mode (inc/dec) */
};
typedef struct rt_hwtimer_device
{
rt_uint32_t maxcnt; /* counter maximum value */
rt_int32_t freq; /* counting frequency set by the user */
float period_sec;
rt_int32_t cycles; /* how many times will generate a timeout event after overflow */
rt_int32_t reload; /* reload cycles(using in period mode) */
rt_uint32_t counter;
} rt_hwtimer_t;
extern rt_uint32_t calcTimerReload1(rt_hwtimer_t *timer, rt_hwtimerval_t *tv);
extern rt_uint32_t calcTimerReload2(rt_hwtimer_t *timer, rt_hwtimerval_t *tv);
extern void presisionTest();
extern void speedTest();
extern void longTest();
#endif // HWTIMER_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/thewon/rt_thread_repo.git
git@gitee.com:thewon/rt_thread_repo.git
thewon
rt_thread_repo
rt_thread_repo
master

搜索帮助