Skip to content

Commit

Permalink
Fix #254: Add API for checking if any time-critical jobs are pending
Browse files Browse the repository at this point in the history
  • Loading branch information
terrillmoore committed Mar 18, 2019
1 parent 1c6a8d5 commit 456d2ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lmic/oslmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,11 @@ void os_runloop_once() {
j->func(j);
}
}

bit_t os_queryTimeCriticalJobs(ostime_t time) {
if (OS.scheduledjobs &&
OS.scheduledjobs->deadline - os_getTime() < time)
return 1;
else
return 0;
}
3 changes: 3 additions & 0 deletions src/lmic/oslmic.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ void os_radio (u1_t mode);
#ifndef os_getBattLevel
u1_t os_getBattLevel (void);
#endif
#ifndef os_queryTimeCriticalJobs
bit_t os_queryTimeCriticalJobs(ostime_t time);
#endif

#ifndef os_rlsbf4
//! Read 32-bit quantity from given pointer in little endian byte order.
Expand Down

0 comments on commit 456d2ce

Please sign in to comment.