From 9b2fecfb12975f2145f87c1ad1f43f2dc4cfb767 Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Thu, 5 Jan 2017 10:04:43 +0100 Subject: [PATCH] [ion] Add Ion::usleep Change-Id: Ife70133410e55c3f0af9a838543042a3da618119 --- ion/include/ion.h | 1 + ion/src/device/device.cpp | 5 +++++ ion/src/simulator/init.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ion/include/ion.h b/ion/include/ion.h index da2313b55..33039e69f 100644 --- a/ion/include/ion.h +++ b/ion/include/ion.h @@ -20,6 +20,7 @@ void ion_app(); namespace Ion { void msleep(long ms); +void usleep(long us); /* CAUTION: This is a complete reset! */ void reset(); diff --git a/ion/src/device/device.cpp b/ion/src/device/device.cpp index 0d7c5bb82..cfe69f9ab 100644 --- a/ion/src/device/device.cpp +++ b/ion/src/device/device.cpp @@ -19,6 +19,11 @@ void Ion::msleep(long ms) { __asm volatile("nop"); } } +void Ion::usleep(long us) { + for (volatile long i=0; irequestReset(); diff --git a/ion/src/simulator/init.cpp b/ion/src/simulator/init.cpp index c2027a13c..e9fda54b0 100644 --- a/ion/src/simulator/init.cpp +++ b/ion/src/simulator/init.cpp @@ -63,7 +63,7 @@ bool Ion::Keyboard::keyDown(Ion::Keyboard::Key key) { } void Ion::msleep(long ms) { - usleep(1000*ms); + ::usleep(1000*ms); sDisplay->redraw(); Fl::wait(); }