在main函数中开启了两个线程,txThread和rxThread,当发出一个数据包后,进入rx线程等待数据包,收到数据包后进入tx线程,当再次进入tx线程RF_runCmd发数据包时,无法执行命令,请问每次使用完RF_runCmd函数后,是否需要关闭RF驱动,如下三个函数都有什么区别吗?
RF_yield(rfHandle);
RF_close(rfHandle);
RF_cancelCmd(rfHandle, ch, 0);
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
在main函数中开启了两个线程,txThread和rxThread,当发出一个数据包后,进入rx线程等待数据包,收到数据包后进入tx线程,当再次进入tx线程RF_runCmd发数据包时,无法执行命令,请问每次使用完RF_runCmd函数后,是否需要关闭RF驱动,如下三个函数都有什么区别吗?
RF_yield(rfHandle);
RF_close(rfHandle);
RF_cancelCmd(rfHandle, ch, 0);
请问每次使用完RF_runCmd函数后,是否需要关闭RF驱动
没有要求每次都要关闭
区别查看下面的注释说明
/** * @brief Signal that radio client is not going to issue more commands in a while. <br> * * Hint to RF driver that, irrespective of inactivity timeout, no new further * commands will be issued for a while and thus the radio can be powered down at * the earliest convenience. In case the RF_yield() is called within a callback, * the callback will need to finish and return before the power down sequence is * initiated. Posting new commands to the queue will cancel any pending RF_yield() * request. <br> * * @note Calling context : Task * * @param h Handle previously returned by RF_open() */ extern void RF_yield(RF_Handle h); /** * @brief Close client connection to RF driver * * Allows a RF client (high-level driver or application) to close its connection * to the RF driver. * RF_close pends on all commands in the command queue before closing the connection. * If a client has access to the radio by using RF_RequestAccess API, and the same client calls RF_close, * then the connection to the RF driver is closed immediately without waiting for the access duration to be over. * * @note Calling context : Task * * @param h Handle previously returned by RF_open() */ extern void RF_close(RF_Handle h); ** * @brief Abort/stop/cancel single command in command queue. * * If command is running, aborts/stops it and posts callback for the * aborted/stopped command. <br> * If command has not yet run, cancels it it and posts callback for the * canceled command. <br> * If command has already run or been aborted/stopped/canceled, has no effect.<br> * If RF_cancelCmd is called from a Swi context with same or higher priority * than RF Driver Swi, when the RF core is powered OFF -> the cancel callback will be delayed * until the next power-up cycle.<br> * * @note Calling context : Task/SWI * * @param h Handle previously returned by RF_open() * @param ch Command handle previously returned by RF_postCmd(). * @param mode 1: Stop gracefully, 0: abort abruptly * @return RF_Stat indicates if command was successfully completed */ extern RF_Stat RF_cancelCmd(RF_Handle h, RF_CmdHandle ch, uint8_t mode);