IBL LoRaWAN implementation

Dependents:   Simple-LoRaWAN

Fork of LMiC by Semtech

Files at this revision

API Documentation at this revision

Comitter:
sillevl
Date:
Thu Jun 30 17:31:55 2016 +0000
Parent:
5:6cd8f10759c2
Commit message:
add os_loop_once() function

Changed in this revision

oslmic.cpp Show annotated file Show diff for this revision Revisions of this file
oslmic.h Show annotated file Show diff for this revision Revisions of this file
diff -r 6cd8f10759c2 -r 59bd35cd865a oslmic.cpp
--- a/oslmic.cpp	Wed Jun 29 14:25:38 2016 +0000
+++ b/oslmic.cpp	Thu Jun 30 17:31:55 2016 +0000
@@ -85,21 +85,25 @@
 // execute jobs from timer and from run queue
 void os_runloop () {
     while(1) {
-        osjob_t* j = NULL;
-        hal_disableIRQs();
-        // check for runnable jobs
-        if(OS.runnablejobs) {
-            j = OS.runnablejobs;
-            OS.runnablejobs = j->next;
-        } else if(OS.scheduledjobs && hal_checkTimer(OS.scheduledjobs->deadline)) { // check for expired timed jobs
-            j = OS.scheduledjobs;
-            OS.scheduledjobs = j->next;
-        } else { // nothing pending
-            hal_sleep(); // wake by irq (timer already restarted)
-        }
-        hal_enableIRQs();
-        if(j) { // run job callback
-            j->func(j);
-        }
+        os_runloop_once();
     }
 }
+
+void os_runloop_once() {
+    osjob_t* j = NULL;
+    hal_disableIRQs();
+    // check for runnable jobs
+    if(OS.runnablejobs) {
+        j = OS.runnablejobs;
+        OS.runnablejobs = j->next;
+    } else if(OS.scheduledjobs && hal_checkTimer(OS.scheduledjobs->deadline)) { // check for expired timed jobs
+        j = OS.scheduledjobs;
+        OS.scheduledjobs = j->next;
+    } else { // nothing pending
+        hal_sleep(); // wake by irq (timer already restarted)
+    }
+    hal_enableIRQs();
+    if(j) { // run job callback
+        j->func(j);
+    }
+}
diff -r 6cd8f10759c2 -r 59bd35cd865a oslmic.h
--- a/oslmic.h	Wed Jun 29 14:25:38 2016 +0000
+++ b/oslmic.h	Thu Jun 30 17:31:55 2016 +0000
@@ -81,6 +81,7 @@
 void radio_irq_handler (u1_t dio);
 void os_init (void);
 void os_runloop (void);
+void os_runloop_once (void);
 
 //================================================================================