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.
Dependents: DISCO-L072CZ-LRWAN1_LoRa_PingPong DISCO-L072CZ-LRWAN1_LoRa_PingPong DISCO-L072CZ-LRWAN1_LoRa_PingPong DISCO-L072CZ-LRWAN1_LoRa_USB_Rx ... more
Fork of SX1276Lib by
Revision 79:8ae448a3c1fd, committed 2017-08-03
- Comitter:
- Helmut Tschemernjak
- Date:
- Thu Aug 03 11:59:54 2017 +0200
- Parent:
- 78:9d2cc07d9525
- Child:
- 80:62f0b027efff
- Commit message:
- Fixed a restart-timer problem that the existing timer stop was not re-used.
Fixed a dprintf timestamp problem, we need to limit the u-seconds to 6 digits
Block the dprintf function if it is busy.
Changed in this revision
--- a/Arduino-mbed-APIs/arduino-mbed.cpp Wed Aug 02 10:34:14 2017 +0200
+++ b/Arduino-mbed-APIs/arduino-mbed.cpp Thu Aug 03 11:59:54 2017 +0200
@@ -241,6 +241,8 @@
noInterrupts();
for (int i = 0; i < MAX_TIMEOUTS-1; i++) {
struct TimeoutVector *tvp = &TimeOuts[i];
+ if (tvp->timer == this) // already here, timer has been restartet.
+ break;
if (tvp->timer == NULL) {
tvp->timer = this;
break;
--- a/Arduino-mbed-APIs/arduino-util.cpp Wed Aug 02 10:34:14 2017 +0200
+++ b/Arduino-mbed-APIs/arduino-util.cpp Thu Aug 03 11:59:54 2017 +0200
@@ -14,11 +14,18 @@
void
dprintf(const char *format, ...)
{
+ static volatile bool busy;
+ if (busy)
+ return;
+ busy = true;
+
int secs = s_getTicker();
int s = secs % 60;
int m = secs / 60;
int h = secs / 3600;
- int us = us_getTicker() & ((1000000)-1);
+ int us = us_getTicker();
+ while(us > 999999)
+ us /= 10; // get it to 6 digits only
snprintf(tmpbuf, sizeof(tmpbuf)-1, "%02d:%02d:%02d.%.06d ", h, m, s, us);
ser->write(tmpbuf, (int) sizeof "00:00:34.3436868 " -1);
@@ -31,6 +38,7 @@
tmpbuf[len+2] = 0;
ser->write(tmpbuf, len+3);
va_end(arg);
+ busy = false;
}
void

