Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: DigitalCamera_OV5642_WIZwiki-W7500 BMC F746NG_TestAll Prelude_OV5642_dev
Revision 0:571ea8a1bbae, committed 2014-11-24
- Comitter:
- eduardoG26
- Date:
- Mon Nov 24 17:02:21 2014 +0000
- Child:
- 1:d1b960698e70
- Commit message:
- First Revision
Changed in this revision
| millis.cpp | Show annotated file Show diff for this revision Revisions of this file |
| millis.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/millis.cpp Mon Nov 24 17:02:21 2014 +0000
@@ -0,0 +1,25 @@
+// millis as in Arduino...
+
+#include "mbed.h"
+#include "millis.h"
+
+static volatile uint32_t MilliSeconds_u32;
+
+static Ticker MilliSecondsTicker;
+
+static void MilliSecondsTickerIRQ()
+{
+ MilliSeconds_u32 ++;
+}
+
+uint32_t millis ()
+{
+ return MilliSeconds_u32;
+}
+
+void StartMillis ()
+{
+ MilliSecondsTicker.attach_us (&MilliSecondsTickerIRQ, 1000);
+}
+
+// End of file
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/millis.h Mon Nov 24 17:02:21 2014 +0000 @@ -0,0 +1,15 @@ +// millis as in Arduino... + +#ifndef MILLIS_H_ +#define MILLIS_H_ + +#include "mbed.h" + +// Get millis value similar to arduino +uint32_t millis (); + +// Must be called to start milli seconds timer! +void StartMillis (); + +#endif // See #ifndef MILLIS_H_ +// End of file \ No newline at end of file