essentially, add Zero support by shimming in the missing functions

This commit is contained in:
ladyada 2015-11-11 10:22:26 -05:00
parent 03c1a2d07b
commit dbc989ac1d
2 changed files with 14 additions and 4 deletions

View File

@ -21,6 +21,14 @@
// SOFTWARE. // SOFTWARE.
#include "Adafruit_MQTT.h" #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) { void printBuffer(uint8_t *buffer, uint8_t len) {
for (uint8_t i=0; i<len; i++) { for (uint8_t i=0; i<len; i++) {

View File

@ -22,10 +22,11 @@
#ifndef _ADAFRUIT_MQTT_H_ #ifndef _ADAFRUIT_MQTT_H_
#define _ADAFRUIT_MQTT_H_ #define _ADAFRUIT_MQTT_H_
#if ARDUINO >= 100 #include "Arduino.h"
#include "Arduino.h"
#else #ifdef ARDUINO_SAMD_ZERO
#include "WProgram.h" #define strncpy_P(dest, src, len) strncpy((dest), (src), (len))
#define strncasecmp_P(f1, f2, len) strncasecmp((f1), (f2), (len))
#endif #endif
// Uncomment/comment to turn on/off debug output messages. // Uncomment/comment to turn on/off debug output messages.
@ -33,6 +34,7 @@
// Set where debug messages will be printed. // Set where debug messages will be printed.
#define DEBUG_PRINTER Serial #define DEBUG_PRINTER Serial
// If using something like Zero or Due, change the above to SerialUSB
// Define actual debug output functions when necessary. // Define actual debug output functions when necessary.
#ifdef MQTT_DEBUG #ifdef MQTT_DEBUG