diff --git a/SPP.cpp b/SPP.cpp index 0c133830..f0a83927 100644 --- a/SPP.cpp +++ b/SPP.cpp @@ -756,17 +756,29 @@ bool SPP::checkFcs(uint8_t *data, uint8_t fcs) { } /* Serial commands */ +#if defined(ARDUINO) && ARDUINO >=100 size_t SPP::write(uint8_t data) { - return write(&data,1); + return write(&data, 1); } +#else +void SPP::write(uint8_t data) { + write(&data, 1); +} +#endif +#if defined(ARDUINO) && ARDUINO >=100 size_t SPP::write(const uint8_t *data, size_t size) { +#else +void SPP::write(const uint8_t *data, size_t size) { +#endif for(uint8_t i = 0; i < size; i++) { if(sppIndex >= sizeof(sppOutputBuffer)/sizeof(sppOutputBuffer[0])) send(); // Send the current data in the buffer sppOutputBuffer[sppIndex++] = data[i]; // All the bytes are put into a buffer and then send using the send() function } +#if defined(ARDUINO) && ARDUINO >=100 return size; +#endif } void SPP::send() { diff --git a/SPP.h b/SPP.h index 81b83829..201fb77b 100644 --- a/SPP.h +++ b/SPP.h @@ -147,6 +147,8 @@ public: * @return Return the byte. Will return -1 if no bytes are available. */ virtual int read(void); + +#if defined(ARDUINO) && ARDUINO >=100 /** * Writes the byte to send to a buffer. The message is send when either send() or after Usb.Task() is called. * @param data The byte to write. @@ -162,6 +164,20 @@ public: virtual size_t write(const uint8_t* data, size_t size); /** Pull in write(const char *str) from Print */ using Print::write; +#else + /** + * Writes the byte to send to a buffer. The message is send when either send() or after Usb.Task() is called. + * @param data The byte to write. + */ + virtual void write(uint8_t data); + /** + * Writes the bytes to send to a buffer. The message is send when either send() or after Usb.Task() is called. + * @param data The data array to send. + * @param size Size of the data. + */ + virtual void write(const uint8_t* data, size_t size); +#endif + /** Discard all the bytes in the buffer. */ void discard(void); /** diff --git a/settings.h b/settings.h index bd64ff3f..bc8878ee 100644 --- a/settings.h +++ b/settings.h @@ -75,6 +75,7 @@ #include #include #include +#define F(str) (str) #endif #if USE_XMEM_SPI_LOCK | defined(USE_MULTIPLE_APP_API)