下载 FreeRTOS
 

出色的 RTOS & 嵌入式软件

内核
最新资讯
简化任何设备的身份验证云连接。
利用 CoAP 设计节能型云连接 IoT 解决方案。
11.0.0 版 FreeRTOS 内核简介:
FreeRTOS 路线图和代码贡献流程。
使用 FreeRTOS 实现 OPC-UA over TSN。

xTimerGetExpiryTime
[定时器 API]

timers.h
 TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer );

返回软件定时器到期的时间, 即执行定时器回调函数的时间。

如果 xTimerGetExpiryTime() 返回的值小于当前时间, 则定时器会在 tick 计数溢出并归 0 后到期。 计数溢出在 RTOS 实现中进行处理, 因此定时器的回调函数会在正确时间执行, 无论是在 tick 计数溢出之前还是之后。

参数:
xTimer   被查询的定时器。
返回:
如果 xTimer 引用的定时器处于活动状态, 则返回定时器下一次到期的时间 (可能是在当前 tick 计数溢出之后, 请参阅上方注释)。

如果 xTimer 引用的定时器未处于活动状态, 则未定义返回值。

用法示例:

static void prvAFunction( TimerHandle_t xTimer )
{
TickType_t xRemainingTime;

    /* Calculate the time that remains before the timer referenced by xTimer
    expires.  TickType_t is an unsigned type, so the subtraction will result in
    the correct answer even if the timer will not expire until after the tick
    count has overflowed. */
    xRemainingTime = xTimerGetExpiryTime( xTimer ) - xTaskGetTickCount();
}





Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.