mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #6418 from amq/poll-lowpowertimer
Add an option to use LowPowerTimer for pollpull/6625/head
commit
339283b3b8
|
@ -34,6 +34,11 @@
|
||||||
"force-non-copyable-error": {
|
"force-non-copyable-error": {
|
||||||
"help": "Force compile time error when a NonCopyable object is copied",
|
"help": "Force compile time error when a NonCopyable object is copied",
|
||||||
"value": false
|
"value": false
|
||||||
|
},
|
||||||
|
|
||||||
|
"poll-use-lowpower-timer": {
|
||||||
|
"help": "Enable use of low power timer class for poll(). May cause missing events.",
|
||||||
|
"value": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"target_overrides": {
|
"target_overrides": {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "mbed_poll.h"
|
#include "mbed_poll.h"
|
||||||
#include "FileHandle.h"
|
#include "FileHandle.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
#include "LowPowerTimer.h"
|
||||||
#ifdef MBED_CONF_RTOS_PRESENT
|
#ifdef MBED_CONF_RTOS_PRESENT
|
||||||
#include "rtos/Thread.h"
|
#include "rtos/Thread.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,7 +35,11 @@ int poll(pollfh fhs[], unsigned nfhs, int timeout)
|
||||||
* interested in. In future, his spinning behaviour will be replaced with
|
* interested in. In future, his spinning behaviour will be replaced with
|
||||||
* condition variables.
|
* condition variables.
|
||||||
*/
|
*/
|
||||||
|
#if MBED_CONF_PLATFORM_POLL_USE_LOWPOWER_TIMER
|
||||||
|
LowPowerTimer timer;
|
||||||
|
#else
|
||||||
Timer timer;
|
Timer timer;
|
||||||
|
#endif
|
||||||
if (timeout > 0) {
|
if (timeout > 0) {
|
||||||
timer.start();
|
timer.start();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue