From dbc989ac1d0cb69e462c78ef87151e006fcdba26 Mon Sep 17 00:00:00 2001 From: ladyada Date: Wed, 11 Nov 2015 10:22:26 -0500 Subject: [PATCH] essentially, add Zero support by shimming in the missing functions --- Adafruit_MQTT.cpp | 8 ++++++++ Adafruit_MQTT.h | 10 ++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Adafruit_MQTT.cpp b/Adafruit_MQTT.cpp index 7a87f16..2cd1d1c 100644 --- a/Adafruit_MQTT.cpp +++ b/Adafruit_MQTT.cpp @@ -21,6 +21,14 @@ // SOFTWARE. #include "Adafruit_MQTT.h" +#ifndef dtostrf +static char *dtostrf (double val, signed char width, unsigned char prec, char *sout) { + char fmt[20]; + sprintf(fmt, "%%%d.%df", width, prec); + sprintf(sout, fmt, val); + return sout; +} +#endif void printBuffer(uint8_t *buffer, uint8_t len) { for (uint8_t i=0; i= 100 - #include "Arduino.h" -#else - #include "WProgram.h" +#include "Arduino.h" + +#ifdef ARDUINO_SAMD_ZERO +#define strncpy_P(dest, src, len) strncpy((dest), (src), (len)) +#define strncasecmp_P(f1, f2, len) strncasecmp((f1), (f2), (len)) #endif // Uncomment/comment to turn on/off debug output messages. @@ -33,6 +34,7 @@ // Set where debug messages will be printed. #define DEBUG_PRINTER Serial +// If using something like Zero or Due, change the above to SerialUSB // Define actual debug output functions when necessary. #ifdef MQTT_DEBUG