diff --git a/connectivity/mbedtls/platform/src/timing_mbed.cpp b/connectivity/mbedtls/platform/src/timing_mbed.cpp index 17acf6c..dd35cb4 100644 --- a/connectivity/mbedtls/platform/src/timing_mbed.cpp +++ b/connectivity/mbedtls/platform/src/timing_mbed.cpp @@ -29,6 +29,7 @@ #include "mbedtls/timing.h" #include "drivers/Timeout.h" +#include "drivers/LowPowerTimeout.h" #include "drivers/Timer.h" #include "drivers/LowPowerTimer.h" #include @@ -44,7 +45,14 @@ extern "C" void mbedtls_set_alarm(int seconds) { +#if DEVICE_LPTICKER + static mbed::LowPowerTimeout t; +#elif DEVICE_USTICKER static mbed::Timeout t; +#else +#error "MBEDTLS_TIMING_C requires either LPTICKER or USTICKER" +#endif + mbedtls_timing_alarmed = 0; t.attach(handle_alarm, std::chrono::seconds(seconds));