Skip to content

Commit 89f67b2

Browse files
committed
NFC: Convert to Chrono
1 parent d1ae0d5 commit 89f67b2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

features/nfc/source/nfc/NFCController.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
#include "stack/transceiver/transceiver.h"
2222

23+
using std::milli;
24+
using namespace std::chrono;
2325
using namespace mbed;
2426
using namespace mbed::nfc;
2527

@@ -181,12 +183,9 @@ void NFCController::scheduler_process(bool hw_interrupt)
181183
_timeout.detach(); // Cancel timeout - if it triggers, it's ok as we'll have an "early" iteration which will likely be a no-op
182184

183185
// Process stack events
184-
uint32_t timeout_ms = nfc_scheduler_iteration(_scheduler, hw_interrupt ? EVENT_HW_INTERRUPT : EVENT_NONE);
186+
duration<uint32_t, milli> timeout{nfc_scheduler_iteration(_scheduler, hw_interrupt ? EVENT_HW_INTERRUPT : EVENT_NONE)};
185187

186-
_timeout.attach_us(
187-
callback(this, &NFCController::on_timeout),
188-
timeout_ms * (us_timestamp_t) 1000
189-
);
188+
_timeout.attach(callback(this, &NFCController::on_timeout), timeout);
190189
}
191190

192191
void NFCController::on_hw_interrupt()

0 commit comments

Comments
 (0)