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:728722f45131, committed 2017-07-11
- Comitter:
- sgnezdov
- Date:
- Tue Jul 11 00:16:23 2017 +0000
- Child:
- 1:c049576bc37c
- Commit message:
- bare bones scheduler
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/JobScheduler.lib Tue Jul 11 00:16:23 2017 +0000 @@ -0,0 +1,1 @@ +JobScheduler#806403f3d0d1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Tue Jul 11 00:16:23 2017 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#8828635da469162cf2854b5287561c663fb96e72
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/source/main.cpp Tue Jul 11 00:16:23 2017 +0000
@@ -0,0 +1,51 @@
+#include "mbed.h"
+#include "scheduler.h"
+#include "LinkedList.h"
+#include "jobService.h"
+
+void job1()
+{
+ printf("Job 1\n");
+}
+
+void runScheduler()
+{
+ JobScheduler::JobService js;
+ JobScheduler::Scheduler scheduler(&js);
+
+ js.Register(1, job1);
+
+ scheduler.Start();
+ scheduler.JobAdd(1);
+ wait(5);
+ scheduler.Stop();
+ scheduler.WaitToStop();
+}
+
+void useTime()
+{
+ //set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37
+// while (true) {
+// time_t seconds = time(NULL);
+//
+// printf("Time as seconds since January 1, 1970 = %d\n", seconds);
+//
+// printf("Time as a basic string = %s", ctime(&seconds));
+//
+// char buffer[32];
+// strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
+// printf("Time as a custom formatted string = %s", buffer);
+//
+// wait(1);
+// }
+}
+
+int main()
+{
+ printf("\nJob Scheduler Demo\n");
+ runScheduler();
+ printf("done\n");
+
+ exit(0);
+}
+