请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:CC1310 大家好、
Task_sleep ()和 usleep ()之间的功耗有何差异?
我知道睡眠和 usleep 之间的功耗没有区别,但我不知道 Task_sleep ()和 usleep ()。
此致、
银河
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.
大家好、
Task_sleep ()和 usleep ()之间的功耗有何差异?
我知道睡眠和 usleep 之间的功耗没有区别,但我不知道 Task_sleep ()和 usleep ()。
此致、
银河
您好、Galaxy、
Task_sleep()以系统时钟节拍数作为计时参数。 您可以在此处阅读完整文档:
usleep()将需要几微秒作为计时参数。 如果你看看 sleep.c 中的执行、你将看到它最终会调用 Task_sleep。
/*
* ======== usleep ========
*/
int usleep(useconds_t usec)
{
UInt32 timeout;
/* usec must be less than 1000000 */
if (usec >= 1000000) {
errno = EINVAL;
return (-1);
}
/* Implementations may place limitations on the granularity of timer
* values. For each interval timer, if the requested timer value requires
* a finer granularity than the implementation supports, the actual timer
* value shall be rounded up to the next supported value.
*/
/* Clock_tickPeriod is the Clock period in microseconds */
timeout = (UInt32)((usec + Clock_tickPeriod - 1) / Clock_tickPeriod);
/* must add one tick to ensure a full duration of timeout ticks */
Task_sleep(timeout + 1);
return (0);
}
谢谢、
M·H