WakeOnRadioRX模式切换到TX模式
TI工程师您好。我现在正在调试WakeOnRadio,现在由WOR切换到直接接受模式是可以的,但是我现在还需要一个功能就是直接由RX切换到TX模式,请问该如何操作呢?是否是修改RF_cmdPropRxSniff的commandNo呢?谢谢!
/***** Function definitions *****/
/* RX task function. Executed in Task context by TI-RTOS when the scheduler starts. */
void *mainThread(void *arg0)
{
RF_Params rfParams;
RF_Params_init(&rfParams);
/* Open LED pins */
ledPinHandle = PIN_open(&ledPinState, pinTable);
if (ledPinHandle == NULL)
{
while(1);
}
/* Route out LNA active pin to LED1 */
PINCC26XX_setMux(ledPinHandle, Board_PIN_LED0, PINCC26XX_MUX_RFC_GPO0);
/* Create queue and data entries */
if (RFQueue_defineQueue(&dataQueue,
rxDataEntryBuffer,
sizeof(rxDataEntryBuffer),
NUM_DATA_ENTRIES,
MAX_LENGTH + NUM_APPENDED_BYTES))
{
/* Failed to allocate space for all data entries */
while(1);
}
/* Copy all RX options from the SmartRF Studio exported RX command to the RX Sniff command */
initializeSniffCmdFromRxCmd(&RF_cmdPropRxSniff, &RF_cmdPropRx);
/* Configure RX part of RX_SNIFF command */
RF_cmdPropRxSniff.pQueue = &dataQueue;
RF_cmdPropRxSniff.pOutput = (uint8_t*)&rxStatistics;
RF_cmdPropRxSniff.maxPktLen = MAX_LENGTH;
/* Discard ignored packets and CRC errors from Rx queue */
RF_cmdPropRxSniff.rxConf.bAutoFlushIgnored = 1;
RF_cmdPropRxSniff.rxConf.bAutoFlushCrcErr = 1;
/* Calculate datarate from prescaler and rate word */
uint32_t datarate = calculateSymbolRate(RF_cmdPropRadioDivSetup.symbolRate.preScale,
RF_cmdPropRadioDivSetup.symbolRate.rateWord);
/* Configure Sniff-mode part of the RX_SNIFF command */
configureSniffCmd(&RF_cmdPropRxSniff, WOR_MODE, datarate, WOR_WAKEUPS_PER_SECOND);
/* Request access to the radio */
rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams);
/* Set frequency */
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, &callback, 0);
/* Save the current radio time */
RF_cmdPropRxSniff.startTime = RF_getCurrentTime();
/* Enter main loop */
while(1)
{
/* Set next wakeup time in the future */
RF_cmdPropRxSniff.startTime += WOR_WAKE_UP_INTERVAL_RAT_TICKS(WOR_WAKEUPS_PER_SECOND);
/* Schedule RX */
RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropRxSniff, RF_PriorityNormal, &callback, RF_EventRxEntryDone);
/* Log RX_SNIFF status */
switch(RF_cmdPropRxSniff.status) {
case PROP_DONE_IDLE:
/* Idle based on RSSI */
worStatistics.doneIdle++;
break;
case PROP_DONE_IDLETIMEOUT:
/* Idle based on PQT */
worStatistics.doneIdleTimeout++;
break;
case PROP_DONE_RXTIMEOUT:
/* Got valid preamble on the air, but did not find sync word */
worStatistics.doneRxTimeout++;
break;
case PROP_DONE_OK:
/* Received packet */
worStatistics.doneOk++;
//进入发送模式,烦请指点下
.......
break;
default:
/* Unhandled status */
break;
};
}
}
你可以使用command chain操作
在TRM文档的23.3.2.5 Command Scheduling中有关于command chain介绍
比如
你可以设置RF_cmdPropRxSniff.bRepeatOk = 0(End operation after receiving a packet correctly)
并且,设置RF_cmdPropRxSniff.pNextOp = (rfc_radioOp_t *)&RF_cmdPropTx;
这样,可以在成功接收一个正确的数据包后结束RF_cmdPropRxSniff命令,并且继续执行下一个命令,即RF_cmdPropTx
再请教下,切换到sleep或者standby模式呢?