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
Fork of SX1276GenericLib by
Revision 80:62f0b027efff, committed 2017-08-03
- Comitter:
- Helmut Tschemernjak
- Date:
- Thu Aug 03 13:43:35 2017 +0200
- Parent:
- 79:8ae448a3c1fd
- Child:
- 81:d288917af0ce
- Commit message:
- Added proper wait_ms function which uses our timers
Changed in this revision
--- a/Arduino-mbed-APIs/arduino-mbed.cpp Thu Aug 03 11:59:54 2017 +0200
+++ b/Arduino-mbed-APIs/arduino-mbed.cpp Thu Aug 03 13:43:35 2017 +0200
@@ -175,6 +175,19 @@
static void pinInt47(void) { InterruptIn::_irq_handler(intPtrTable[47].context); }
+void wait_ms(uint32_t ms)
+{
+ uint32_t start = ms_getTicker();
+
+ while (true) {
+ uint32_t t = ms_getTicker();
+ if (t < start) // warp.
+ start = 0;
+ if (t > (start + ms))
+ break;
+ }
+}
+
struct TimeoutVector TimeOuts[MAX_TIMEOUTS];
void
--- a/Arduino-mbed-APIs/arduino-mbed.h Thu Aug 03 11:59:54 2017 +0200
+++ b/Arduino-mbed-APIs/arduino-mbed.h Thu Aug 03 13:43:35 2017 +0200
@@ -19,7 +19,6 @@
typedef int PinName;
#define NC -1
-#define wait_ms delay
/* we need to redefine out dprintf because stdio.h uses the same name */
#define dprint dxprintf
#if ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606
@@ -58,6 +57,7 @@
extern uint32_t s_getTicker(void);
extern uint32_t ms_getTicker(void);
extern uint32_t us_getTicker(void);
+extern void wait_ms(uint32_t ms);
enum PinMode {
