IBL LoRaWAN implementation

Dependents:   Simple-LoRaWAN

Fork of LMiC by Semtech

Revision:
6:59bd35cd865a
Parent:
1:d3b7bde3995c
--- 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);
+    }
+}