You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
590 B
21 lines
590 B
#pragma once
|
|
#include <stdint.h> //定义布尔
|
|
|
|
#define DO_IT_EACH_MS(time) \
|
|
{ \
|
|
static uint32_t __ticket = 0; \
|
|
if (systicket_haspassedms(__ticket) > (time)) { \
|
|
__ticket = systicket_get_now_ms();
|
|
|
|
#define END() \
|
|
} \
|
|
}
|
|
|
|
// 初始化
|
|
void systicket_init(void);
|
|
// 获取当前ticket
|
|
uint32_t systicket_get_now_ms(void);
|
|
// 计算距离上一个ticket过去了多久
|
|
uint32_t systicket_haspassedms(uint32_t ticket);
|
|
// 延时
|
|
void systicket_delay_ms(uint32_t nTime);
|