Sergei G / Mbed OS JobSchedulerDemo

Dependencies:   JobScheduler

Files at this revision

API Documentation at this revision

Comitter:
sgnezdov
Date:
Tue Jul 11 00:16:23 2017 +0000
Child:
1:c049576bc37c
Commit message:
bare bones scheduler

Changed in this revision

JobScheduler.lib Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
source/main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /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);
+}
+