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 SX1276GenericLib by
Diff: Arduino-mbed-APIs/arduino-mbed.h
- Revision:
- 97:3d5d489206aa
- Parent:
- 92:ee3de1d353cd
- Child:
- 101:50377edb21c6
--- a/Arduino-mbed-APIs/arduino-mbed.h Tue Nov 14 14:52:01 2017 +0100
+++ b/Arduino-mbed-APIs/arduino-mbed.h Sat Nov 18 13:54:15 2017 +0100
@@ -27,21 +27,27 @@
#define MYdigitalPinToInterrupt(x) (x)
#endif
+#ifdef ARDUINO_ARCH_ESP32
+typedef int TIMER_REF;
+#elif ARDUINO_SAMD_ZERO
+typedef Tcc TIMER_REF;
+#else
+#error "unkown platform"
+#endif
+
class DigitalOut;
void InitSerial(Stream *serial, int timeout_ms, DigitalOut *led, bool waitForSerial);
extern Stream *ser;
extern bool SerialUSB_active;
/*
- * Arduino_d21.cpp
+ * Arduino_d21.cpp Arduino_ESP32.cpp
*/
-extern void startTimer(Tcc *t, uint64_t delay_ns);
-extern void stopTimer(Tcc *t);
+extern void startTimer(TIMER_REF *t, uint64_t delay_ns);
+extern void stopTimer(TIMER_REF *t);
+extern TIMER_REF *getTimeoutTimer(void);
extern uint64_t ns_getTicker(void);
-extern Tcc *getTimeout_tcc(void);
extern int CPUID(uint8_t *buf, int maxSize, uint32_t xorval);
-
-
extern void sleep(void);
extern void deepsleep(void);
@@ -148,6 +154,10 @@
_mosi = mosi;
_miso = miso;
_sclk = sclk;
+#ifdef ARDUINO_ARCH_ESP32 // TODO
+ if (1)
+ _spi = &SPI;
+#elif defined (ARDUINO_SAMD_ZERO)
if (mosi == PIN_SPI_MOSI && miso == PIN_SPI_MISO && sclk == PIN_SPI_SCK)
_spi = &SPI;
#if SPI_INTERFACES_COUNT > 1
@@ -158,6 +168,7 @@
else if (mosi == PIN_SPI2_MOSI && miso == PIN_SPI2_MISO && sclk == PIN_SPI2_SCK)
_spi = &SPI2;
#endif
+#endif
else {
_spi = NULL;
return;
