加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
xtimer.h 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
eric 提交于 2022-04-30 20:03 . [修改]:修改宏定义
/**
* @file xtimer.h
* @author eric
* @brief
* @version 0.1
* @date 2022-04-16
*
* @copyright Copyright (c) 2022
*
*/
#ifndef _XTIMER_H
#define _XTIMER_H
#include "dlist.h"
#include <stdint.h>
enum option
{
XTIMER_SINGLE = 0,
XTIMER_REPEAT,
};
typedef struct list_node
{
const char *name;
uint32_t timout;
uint32_t start;
void *arg;
void (*callback)(void *arg);
int opt;
struct list_head list;
} list_node_t, xtimer_t;
/**
* @brief start or restart a xtimer
*
* @param timer
* @return int
*/
int xtimer_start(xtimer_t *timer);
/**
* @brief stop a xtimer
*
* @param timer
* @return int 0:ok other:err
*/
int xtimer_stop(xtimer_t *timer);
/**
* @brief Query timer is valid???
*
* @param timer
* @return int 0:vaild, other:invalid
*/
int xtimer_isvalid(xtimer_t *timer);
/**
* @brief get the timer remain ticks
*
* @param timer
* @return int -1:err, other:remain ticks
*/
int xtimer_remain(xtimer_t *timer);
/**
* @brief put to main while(1)
*
*/
void xtimer_loop(void);
/* Get current tick, eg.HAL_GetTicks() */
#ifndef xtimer_get_tick
#define xtimer_get_tick() HAL_GetTick()
#endif // !xtimer_get_tick
#endif // !_XTIMER_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化