TI工程师您好。我现在正在调试WakeOnRadio,现在由WOR切换到直接接受模式是可以的,但是我现在还需要一个功能就是直接由RX切换到TX模式,使用预定的接受到数据后直接切换到TX,是可行的。我现在发现该方法还是不太适用于我的案例,也就是在接受到数据后,需要判断是否进行发送,也就是判断正确才会进行下发数据。请问该如何操作呢?谢谢!
/***** 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;
};
}
}
Viki Shi:
请参考置顶帖中的例程,包含RX TX切换: http://www.deyisupport.com/question_answer/wireless_connectivity/f/45/t/106253.aspx
user5093767:
您好,请问怎么从这个模式,切换到发送模式呢,看链接的程序,还是没有搞懂