代码拉取完成,页面将自动刷新
/******************************************************************************
* @brief 软件定时器<依赖于b_list模块>
* Change Logs:
* Date Author Email Notes
* 2023-06-06 子恒 3393018959@qq.com NULL
* 2023-06-13 子恒 3393018959@qq.com 初版完成
******************************************************************************/
#ifndef __B_TIMER_H__
#define __B_TIMER_H__
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include "b_list.h"
#define TIMER_TICKCNT_MAX 0xFFFFFFFF
//#define TIMER_MEASURE_MAX 10
#define B_CONCAT(p1, p2) LIST_CONCAT(p1, p2)
typedef enum
{
B_TIMER_MODE_SINGLE_SHOT,
B_TIMER_MODE_REPEATED
} b_timer_mode_t;
typedef void (*b_timerout_handler_t)(void);
typedef struct{
void * list_next;
uint32_t end_val;
uint32_t repeat_period;
b_timerout_handler_t handler;
uint8_t active;
}b_timer_t;
typedef b_timer_t * b_timer_id_t;
#define _B_TIMER_DEF(timer_id) \
static b_timer_t B_CONCAT(timer_id,_data) = { \
.active = 0, \
}; \
const b_timer_id_t timer_id = &B_CONCAT(timer_id,_data)
extern uint32_t b_get_sys_timer(void);
extern void timer_update(void);
extern uint8_t b_timer_create(b_timer_id_t const * p_timer,
b_timer_mode_t mode,
b_timerout_handler_t timeout_handler);
extern uint8_t b_timer_start(b_timer_id_t const * p_timer, uint32_t timeout_ticks);
extern uint8_t b_timer_stop(b_timer_id_t const * p_timer);
#ifdef TIMER_MEASURE_MAX
extern void b_measure_start(void);
extern uint8_t b_measure_stop(uint8_t id);
extern uint32_t b_measure_get(uint8_t id);
#endif
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。