xTimerPendFunctionCall()
[定时器 API]
timers.h
BaseType_t xTimerPendFunctionCall(
PendedFunction_t xFunctionToPend,
void *pvParameter1,
uint32_t ulParameter2,
TickType_t xTicksToWait );
用于将函数的执行挂起到 RTOS 守护进程任务(定时器
服务任务,因此此函数前缀为“Timer”)。
可延迟到 RTOS 守护进程任务的函数必须具有以下
原型:
void vPendableFunction( void * pvParameter1, uint32_t ulParameter2 );
pvParameter1 和 ulParameter2 供
应用程序代码使用。
INCLUDE_xTimerPendFunctionCall() 和 configUSE_TIMERS 必须同时设置为
1,xTimerPendFunctionCall() 才可用。
-
参数:
-
xFunctionToPend
|
要从定时器服务/
守护进程任务执行的函数。 函数必须符合上面所示的 PendedFunction_t
如上所示的 PendedFunction_t 原型。
|
pvParameter1
|
回调函数的第一个参数的值。
该参数为 void * 类型,可用于传递任何类型。
例如,整数类型可转换为 void *,
或者可使用 void * 指向结构体。
|
ulParameter2
|
回调函数的第二个参数的值。
|
xTicksToWait
|
调用此函数将导致
向队列中的定时器守护进程任务发送一条消息。 xTicksToWait
是指在队列已满的情况下,需要阻塞调用任务
(不使用任何处理时间)以等待定时器队列
释放可用空间的时间。 队列的长度由
FreeRTOSConfig.h 中的 configTIMER_QUEUE_LENGTH 值设置。
|
-
返回:
-
如果消息成功发送到 RTOS 定时器守护进程任务,
则返回 pdPASS,否则返回 pdFALSE。
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.