From 89f67b29856b44e303e7d8992437eaa477bd1e3b Mon Sep 17 00:00:00 2001 From: Kevin Bracey Date: Thu, 13 Feb 2020 16:44:56 +0200 Subject: [PATCH] NFC: Convert to Chrono --- features/nfc/source/nfc/NFCController.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/features/nfc/source/nfc/NFCController.cpp b/features/nfc/source/nfc/NFCController.cpp index 0f20f15000..0e22ff4103 100644 --- a/features/nfc/source/nfc/NFCController.cpp +++ b/features/nfc/source/nfc/NFCController.cpp @@ -20,6 +20,8 @@ #include "stack/transceiver/transceiver.h" +using std::milli; +using namespace std::chrono; using namespace mbed; using namespace mbed::nfc; @@ -181,12 +183,9 @@ void NFCController::scheduler_process(bool hw_interrupt) _timeout.detach(); // Cancel timeout - if it triggers, it's ok as we'll have an "early" iteration which will likely be a no-op // Process stack events - uint32_t timeout_ms = nfc_scheduler_iteration(_scheduler, hw_interrupt ? EVENT_HW_INTERRUPT : EVENT_NONE); + duration timeout{nfc_scheduler_iteration(_scheduler, hw_interrupt ? EVENT_HW_INTERRUPT : EVENT_NONE)}; - _timeout.attach_us( - callback(this, &NFCController::on_timeout), - timeout_ms * (us_timestamp_t) 1000 - ); + _timeout.attach(callback(this, &NFCController::on_timeout), timeout); } void NFCController::on_hw_interrupt()