TI工程师,您好!我在打开无线设备后,想重新初始化一下速率和频率,也就是重新初始化一次无线设备,请问该如何操作呢?谢谢!
RF_Params rfParams;
RF_Params_init(&rfParams);
/* Open LED pins */
ledPinHandle = PIN_open(&ledPinState, pinTable);
if (ledPinHandle == NULL)
{
while(1);
}
//sleep(5);
/* Route out LNA active pin to LED1 */
PINCC26XX_setMux(ledPinHandle, Board_PIN_LED1, 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);
while(1)
{
}
其实我的应用是这样的,无线唤醒时,由于数据量小,故而用一个速率比较快的方式,当真正在通信时,需要提高通信的灵敏度和成功率,所以需要一个速率较低的方式进行。我尝试过在wakeOnRadio下修改,每次接受到数据之间RF_close(),再重新初始化,发现根本不能关闭,仿真时,之间死在RF_close里面。所以需要问下,RF_open和RF_close到底是如何操作的?另外,我的速率参数修改是否一定需要close后再重新初始化。