diff --git a/drivers/LowPowerClock.h b/drivers/LowPowerClock.h index e9e66a6a20..4160e89f98 100644 --- a/drivers/LowPowerClock.h +++ b/drivers/LowPowerClock.h @@ -18,6 +18,7 @@ #define MBED_LOWPOWERCLOCK_H #include +#if DEVICE_LPTICKER #include "hal/lp_ticker_api.h" namespace mbed { @@ -63,4 +64,5 @@ public: /** @}*/ } +#endif /* DEVICE_LPTICKER */ #endif /* MBED_LOWPOWERCLOCK_H */ diff --git a/drivers/source/Timeout.cpp b/drivers/source/Timeout.cpp index daed37e6ea..4b7746809b 100644 --- a/drivers/source/Timeout.cpp +++ b/drivers/source/Timeout.cpp @@ -44,7 +44,9 @@ Timeout::Timeout() : TimeoutBase(get_us_ticker_data(), true) * (In C++17 could avoid the need for this by making the members inline). */ const bool HighResClock::is_steady; +#if DEVICE_LPTICKER const bool LowPowerClock::is_steady; +#endif const bool RealTimeClock::is_steady; #if DEVICE_LPTICKER diff --git a/platform/mbed_chrono.h b/platform/mbed_chrono.h index 1ee2f49390..a051588c71 100644 --- a/platform/mbed_chrono.h +++ b/platform/mbed_chrono.h @@ -85,7 +85,10 @@ inline namespace chrono_literals { constexpr chrono::deciseconds operator "" _ds(unsigned long long x) { chrono::deciseconds::rep val = static_cast(x); - assert(val >= 0 && static_cast(val) == x); + if (val < 0) { + assert(false); + } + assert(static_cast(val) == x); return chrono::deciseconds(val); } @@ -103,7 +106,10 @@ constexpr chrono::deciseconds operator "" _ds(unsigned long long x) constexpr chrono::centiseconds operator "" _cs(unsigned long long x) { chrono::centiseconds::rep val = static_cast(x); - assert(val >= 0 && static_cast(val) == x); + if (val < 0) { + assert(false); + } + assert(static_cast(val) == x); return chrono::centiseconds(val); }