put 方法會將訊息新增至訊息佇列的結尾。
RiCOSResult RiCOSMessageQueue_put(
RiCOSMessageQueue *const me, gen_ptr message,
RiCBoolean fromISR);
me
要將訊息新增至的 RiCOSMessageQueue
訊息
要新增至佇列的訊息
fromISR
布林值,判定要新增的訊息是否是從岔斷服務常式 (ISR) 產生的
RiCOSResult 物件,如 RiCOS*.h 檔案所定義
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);
}