put

put 方法用于将消息添加到消息队列末尾。

特征符
RiCOSResult RiCOSMessageQueue_put(
   RiCOSMessageQueue *const me, gen_ptr message,
   RiCBoolean fromISR);
参数
me

这是要将消息添加至的 RiCOSMessageQueue

message

这是要添加至队列的消息

fromISR

这是一个布尔值,用于确定所添加的消息是否是中断服务例程 (ISR) 生成的

返回

RiCOS*.h 文件中定义的 RiCOSResult 对象

示例
RiCOSResult RiCOSMessageQueue_put(
   RiCOSMessageQueue * const me, gen_ptr message,
   RiCBoolean fromISR)
{
   static gen_ptr NULL_VAL = NULL;
   int timeout = WAIT_FOREVER;
   int priority = MSG_PRI_NORMAL;

   if (message == NULL) message = NULL_VAL;

   if (fromISR) {
      timeout = NO_WAIT;
      priority = MSG_PRI_URGENT;
   }
   return (msgQSend(me->hVxMQ, (char*)&message,
      sizeof(message), timeout, priority) == OK);
}

反馈