Skip to content

Commit 7ae621e

Browse files
authored
Merge pull request #12988 from jeromecoutant/PR_OS_TIMER
OS timer uses LPTICKER by default, then USTICKER
2 parents 0988e5d + a7c9601 commit 7ae621e

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

platform/source/mbed_os_timer.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "us_ticker_api.h"
2323
#include "lp_ticker_api.h"
2424
#include "mbed_critical.h"
25-
#include "mbed_assert.h"
25+
#include "mbed_error.h"
2626
#include <new>
2727

2828
/* This provides the marshalling point for a system global SysTimer, which
@@ -47,15 +47,13 @@ OsTimer *init_os_timer()
4747
// Locking not required as it will be first called during
4848
// OS init, or else we're a non-RTOS single-threaded setup.
4949
if (!os_timer) {
50-
#if MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER && DEVICE_USTICKER
51-
os_timer = new (os_timer_data) OsTimer(get_us_ticker_data());
52-
#elif !MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER && DEVICE_LPTICKER
50+
#if DEVICE_LPTICKER && !MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER
5351
os_timer = new (os_timer_data) OsTimer(get_lp_ticker_data());
52+
#elif DEVICE_USTICKER
53+
os_timer = new (os_timer_data) OsTimer(get_us_ticker_data());
5454
#else
55-
MBED_ASSERT("OS timer not available - check MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER" && false);
56-
return NULL;
55+
MBED_ERROR("OS timer not available");
5756
#endif
58-
//os_timer->setup_irq();
5957
}
6058

6159
return os_timer;

rtos/source/TARGET_CORTEX/mbed_rtx_idle.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ extern "C" {
4242

4343
#if MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER && !DEVICE_USTICKER
4444
#error Microsecond ticker required when MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER is true
45-
#endif
46-
47-
#if !MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER && !DEVICE_LPTICKER
48-
#error Low power ticker required when MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER is false
4945
#endif
5046

5147
// Setup OS Tick timer to generate periodic RTOS Kernel Ticks

0 commit comments

Comments
 (0)