-
Notifications
You must be signed in to change notification settings - Fork 3k
mbed_wait_api: add comments to warn the func will lock deep sleep #6645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor grammer nits.
platform/mbed_wait_api.h
Outdated
@@ -53,18 +53,27 @@ extern "C" { | |||
* the accuracy of single precision floating point). | |||
* | |||
* @param s number of seconds to wait | |||
* | |||
* @note | |||
* This func will lock the deep sleep, if you want device entry deep sleep mode, please use Thread::wait() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor grammer nits.
"This func will lock deep sleep. If you want device entry deep sleep mode, please use Thread::wait()"
I'd still rather we fixed this than documented it. If documenting it, I'd want the other feature documented, which is that |
…to get an exact number of microseconds, potentially impacting power and multi-thread performance. Again, avoided by Thread::wait()".
Thanks @woodsking2 for the update @AnotherButler Please review the docs update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a few changes. Also, should we leave a note here: https://os-doc-builder.test.mbed.com/docs/development/reference/wait.html?
platform/mbed_wait_api.h
Outdated
*/ | ||
void wait_ms(int ms); | ||
|
||
/** Waits a number of microseconds. | ||
* | ||
* @param us the whole number of microseconds to wait | ||
* | ||
* @note | ||
* This func always spin to get an exact number of microseconds, potentially |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change to "This function always spins to get the exact number of microseconds, which potentially affects power (such as preventing deep sleep) and multithread performance."
platform/mbed_wait_api.h
Outdated
*/ | ||
void wait(float s); | ||
|
||
/** Waits a number of milliseconds. | ||
* | ||
* @param ms the whole number of milliseconds to wait | ||
* | ||
* @note | ||
* This func always spin to get an exact number of microseconds, potentially |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change to "This function always spins to get the exact number of microseconds, which potentially affects power (such as preventing deep sleep) and multithread performance. You can avoid it by using Thread::wait()."
platform/mbed_wait_api.h
Outdated
@@ -53,18 +53,32 @@ extern "C" { | |||
* the accuracy of single precision floating point). | |||
* | |||
* @param s number of seconds to wait | |||
* | |||
* @note | |||
* This func always spin to get an exact number of microseconds, potentially |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change to "This function always spins to get the exact number of microseconds, which potentially affects power (such as preventing deep sleep) and multithread performance. You can avoid it by using Thread::wait()."
…to get the exact number of microseconds, which potentially affects power (such as preventing deep sleep) and multithread performance. You can avoid it by using Thread::wait()."
Yes, we should update. @woodsking2 Can you send a patch to docs to update this once this is integrated? Testing now /morph build |
I already see a note:
That's not 100% accurate - it will sleep in the RTOS for the whole number of milliseconds, then spin as needed to make the necessary fraction of a millisecond. But it blocks the platform deep sleep for the entire duration. |
Build : SUCCESSBuild number : 1783 Triggering tests/morph test |
@0xc0170 Sorry, I don't know how send a patch and I can't open https://os-doc-builder.test.mbed.com |
@orenc17 CAn you please review last 10 runs in uvisor (one device failed few times there) /morph uvisor-test |
Exporter Build : ABORTEDBuild number : 1428 |
Test : SUCCESSBuild number : 1593 |
/morph export-build |
Exporter Build : SUCCESSBuild number : 1442 |
@AnotherButler Can you update it based on this ? This one - approved or changes required? |
@woodsking2 Please do not modify the structure of the PR body. I have edited it to put it back to how it should be. Thanks |
@AnotherButler Could you please address @0xc0170 comments above? Thanks |
So, if I'm understanding correctly, I should change the Handbook Wait page warning from: "When you call wait, your board's CPU is in a loop waiting for the required time to pass. Using the Arm Mbed RTOS, you can make a call to Thread::wait instead." to: "When you call wait, your board's CPU will sleep in the RTOS for the whole number of milliseconds and then spin to make the necessary fraction of a millisecond. However, it blocks the platform deep sleep for the entire duration." Is that right? |
That's accurate for the current RTOS implementation. |
@bulislaw / @SenRamakri Please review the latest update. |
platform/mbed_wait_api.h
Outdated
* @note | ||
* This function always spins to get the exact number of microseconds, | ||
* which potentially affects power (such as preventing deep sleep) and multithread performance. | ||
* You can avoid it by using Thread::wait(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @woodsking2 - The rtos based implementation of this function does call Thread::wait. So this comment is not broadly applicable.
@SenRamakri |
/morph build |
Build : SUCCESSBuild number : 1941 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 1588 |
Test : SUCCESSBuild number : 1763 |
/morph mbed2-build |
Description
Add some comments to warn the wait() will lock deep sleep.
Pull request type
[X] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change
discuss: #6574