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.
Revision 0:3985faffb331, committed 2018-11-26
- Comitter:
- Wayne Roberts
- Date:
- Mon Nov 26 14:37:06 2018 -0800
- Commit message:
- initial commit
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TimeoutAbs.lib Mon Nov 26 14:37:06 2018 -0800 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/dudmuck/code/TimeoutAbs/#900163d530ae
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Nov 26 14:37:06 2018 -0800
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "LowPowerTimeoutAbs.h"
+
+volatile bool ev;
+Timer t;
+
+LowPowerTimeoutAbs tabs;
+
+void my_callback()
+{
+ ev = true;
+}
+
+us_timestamp_t tabs_started_at;
+
+int main()
+{
+ unsigned prev;
+ t.start();
+ tabs_started_at = tabs.read_us();
+ tabs.attach_us(my_callback, tabs_started_at + 100000);
+ prev = t.read_us();
+ printf("tabs_started_at:%llu prev:%u\r\n", tabs_started_at, prev);
+ for (;;) {
+ unsigned now;
+ if (ev) {
+ unsigned late;
+ now = t.read_us();
+ tabs_started_at += 1000000;
+ late = rand() % 200000;
+ printf("time %u\t", now - prev);
+ fflush(stdout);
+ wait_us(late);
+ printf("late:%u\r\n", late);
+ tabs.attach_us(my_callback, tabs_started_at);
+ prev = now;
+ ev = false;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Mon Nov 26 14:37:06 2018 -0800 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#2fd0c5cfbd83fce62da6308f9d64c0ab64e1f0d6