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.
Fork of LMiC by
Revision 6:59bd35cd865a, committed 2016-06-30
- 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 |
--- 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);
+ }
+}
--- 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); //================================================================================
