本帖最后由 右岸 于 2015-10-27 14:58 编辑
本人新手,刚玩CC2541,想实现一个1500微秒的延时,发现OSAL下有下面的定时函数,但是毫秒级的:
/*********************************************************************
* @fn osal_start_timerEx
*
* @brief
*
* This function is called to start a timer to expire in n mSecs.
* When the timer expires, the calling task will get the specified event.
*
* @param uint8 taskID - task id to set timer for
* @param uint16 event_id - event to be notified with
* @param uint32 timeout_value - in milliseconds.
*
* [url=home.php?mod=space&uid=266161]@return[/url] SUCCESS, or NO_TIMER_AVAIL.
*/
uint8 osal_start_timerEx( uint8 taskID, uint16 event_id, uint32 timeout_value )
{
halIntState_t intState;
osalTimerRec_t *newTimer;
HAL_ENTER_CRITICAL_SECTION( intState ); // Hold off interrupts.
// Add timer
newTimer = osalAddTimer( taskID, event_id, timeout_value );
HAL_EXIT_CRITICAL_SECTION( intState ); // Re-enable interrupts.
return ( (newTimer != NULL) ? SUCCESS : NO_TIMER_AVAIL );
}
/*********************************************************************
希望前辈们指点一二,是不是我没有找到微秒的延时函数??该怎样使用OSAL库函数写出微秒的延时函数??
|