请问,我想让广播休眠一段时间后自己唤醒,设置POWER SAVING后,怎么样设置睡眠的时间,
是 halSleep( uint32 osal_timeout )这个函数吗,但是没有效果呢。。。。
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.
不知道您的具体应用
貌似如果您使用协议栈提供的OASL源码,并且设置了POWER_SAVING的话
OASL会自动检查有无活动,如果后面有比较长的时间无活动的话会自动判断进入PM2,如果有较短时间无活动,也会自动判断进入PM0(PM1?忘了,应该 也可以设置)
这种情况是不是也可以适用于您的应用?只要设定一定时间后重复进行广播就可以了,其它系统会自动管理判断进入相应的最合适的低功耗模式的吧?
如果这样说的对,如果还是功耗较大,可能是否先看看有无其它外围设备在工作引起的?例如IO口
void osal_run_system( void )
{
uint8 idx = 0;
#ifndef HAL_BOARD_CC2538
osalTimeUpdate();
#endif
Hal_ProcessPoll();
do {
if (tasksEvents[idx]) // Task is highest priority that is ready.
{
break;
}
} while (++idx < tasksCnt);
if (idx < tasksCnt)
{
uint16 events;
halIntState_t intState;
HAL_ENTER_CRITICAL_SECTION(intState);
events = tasksEvents[idx];
tasksEvents[idx] = 0; // Clear the Events for this task.
HAL_EXIT_CRITICAL_SECTION(intState);
activeTaskID = idx;
events = (tasksArr[idx])( idx, events );
activeTaskID = TASK_NO_TASK;
HAL_ENTER_CRITICAL_SECTION(intState);
tasksEvents[idx] |= events; // Add back unprocessed events to the current task.
HAL_EXIT_CRITICAL_SECTION(intState);
}
#if defined( POWER_SAVING ) else // Complete pass through all task events with no activity? { osal_pwrmgr_powerconserve(); // Put the processor/system into sleep } #endif
/* Yield in case cooperative scheduling is being used. */
#if defined (configUSE_PREEMPTION) && (configUSE_PREEMPTION == 0)
{
osal_task_yield();
}
#endif
}
带颜色的是不是已经处理了?不需要你自己使用 halSleep( uint32 osal_timeout )这个函数了,查看osal_pwrmgr_powerconserve()这个函数,里面也有调用 halSleep( uint32 osal_timeout )这个函数的(不知道是否记错)