Skip to content

Commit de6e5e8

Browse files
committed
Initial support for Uno WiFi rev2
Need to add a patch to Arduino_ConnectionHandler: diff --git a/src/Arduino_ConnectionHandler.h b/src/Arduino_ConnectionHandler.h index 195ab13..8d80f2e 100644 --- a/src/Arduino_ConnectionHandler.h +++ b/src/Arduino_ConnectionHandler.h @@ -29,7 +29,8 @@ #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_REQUIRED #endif -#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) +#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) || \ + defined(ARDUINO_AVR_UNO_WIFI_REV2) #include <WiFiNINA.h> #include <WiFiUdp.h>
1 parent aff9ebd commit de6e5e8

File tree

9 files changed

+48
-3
lines changed

9 files changed

+48
-3
lines changed

src/AIoTC_Config.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@
7979
#define HAS_TCP
8080
#endif
8181

82-
#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT)
82+
#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) || \
83+
defined(ARDUINO_AVR_UNO_WIFI_REV2)
8384
#define BOARD_HAS_OFFLOADED_ECCX08
8485
#define HAS_TCP
8586
#undef OTA_ENABLED

src/cbor/CBORDecoder.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
/******************************************************************************
2222
INCLUDE
2323
******************************************************************************/
24+
#ifdef __AVR__
25+
#include <Arduino.h>
26+
#include <ArduinoSTL.h>
27+
#endif
2428

2529
#undef max
2630
#undef min

src/cbor/CBOREncoder.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
* INCLUDE
2323
******************************************************************************/
2424

25+
#ifdef __AVR__
26+
#include <Arduino.h>
27+
#include <ArduinoSTL.h>
28+
#endif
29+
2530
#include "../property/PropertyContainer.h"
2631

2732
/******************************************************************************

src/cbor/lib/tinycbor/src/cbor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
#ifndef CBOR_H
2626
#define CBOR_H
2727

28+
#ifdef __AVR__
29+
#define FP_NAN NAN
30+
#define FP_INFINITE INFINITY
31+
#endif
32+
2833
#ifndef assert
2934
#include <assert.h>
3035
#endif

src/cbor/lib/tinycbor/src/cborpretty.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
# define __STDC_LIMIT_MACROS 1
2929
#endif
3030

31+
#ifndef __AVR__
32+
3133
#include "cbor.h"
3234
#include "cborinternal_p.h"
3335
#include "compilersupport_p.h"
@@ -580,4 +582,6 @@ CborError cbor_value_to_pretty_stream(CborStreamFunction streamFunction, void *t
580582

581583
#pragma GCC diagnostic pop
582584

585+
#endif // __AVR__
586+
583587
/** @} */

src/cbor/lib/tinycbor/src/cbortojson.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
# define __STDC_LIMIT_MACROS 1
3131
#endif
3232

33+
#ifndef __AVR__
34+
3335
#include "cbor.h"
3436
#include "cborjson.h"
3537
#include "cborinternal_p.h"
@@ -701,4 +703,6 @@ CborError cbor_value_to_json_advance(FILE *out, CborValue *value, int flags)
701703

702704
#pragma GCC diagnostic pop
703705

706+
#endif // __AVR__
707+
704708
/** @} */

src/cbor/lib/tinycbor/src/open_memstream.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434

3535
#include <unistd.h>
3636

37+
#ifdef __AVR__
38+
typedef size_t ssize_t;
39+
#endif
40+
3741
typedef ssize_t RetType;
3842
typedef size_t LenType;
3943

src/property/Property.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,12 @@ CborError Property::appendAttributeReal(String value, String attributeName, Cbor
189189
}, encoder);
190190
}
191191

192-
CborError Property::appendAttributeName(String attributeName, std::function<CborError (CborEncoder& mapEncoder)>appendValue, CborEncoder *encoder) {
192+
#ifdef __AVR__
193+
CborError Property::appendAttributeName(String attributeName, nonstd::function<CborError (CborEncoder& mapEncoder)>appendValue, CborEncoder *encoder)
194+
#else
195+
CborError Property::appendAttributeName(String attributeName, std::function<CborError (CborEncoder& mapEncoder)>appendValue, CborEncoder *encoder)
196+
#endif
197+
{
193198
if (attributeName != "") {
194199
// when the attribute name string is not empty, the attribute identifier is incremented in order to be encoded in the message if the _lightPayload flag is set
195200
_attributeIdentifier++;
@@ -271,7 +276,11 @@ void Property::setAttributeReal(String& value, String attributeName) {
271276
});
272277
}
273278

279+
#ifdef __AVR__
280+
void Property::setAttributeReal(String attributeName, nonstd::function<void (CborMapData & md)>setValue)
281+
#else
274282
void Property::setAttributeReal(String attributeName, std::function<void (CborMapData & md)>setValue)
283+
#endif
275284
{
276285
if (attributeName != "") {
277286
_attributeIdentifier++;

src/property/Property.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ typedef void(*OnSyncCallbackFunc)(Property &);
133133
CLASS DECLARATION
134134
******************************************************************************/
135135

136+
#ifdef __AVR__
137+
#include "nonstd/nonstd.h"
138+
#endif
139+
136140
class Property
137141
{
138142
public:
@@ -177,13 +181,18 @@ class Property
177181
CborError appendAttributeReal(int value, String attributeName = "", CborEncoder *encoder = nullptr);
178182
CborError appendAttributeReal(float value, String attributeName = "", CborEncoder *encoder = nullptr);
179183
CborError appendAttributeReal(String value, String attributeName = "", CborEncoder *encoder = nullptr);
184+
#ifndef __AVR__
180185
CborError appendAttributeName(String attributeName, std::function<CborError (CborEncoder& mapEncoder)>f, CborEncoder *encoder);
186+
void setAttributeReal(String attributeName, std::function<void (CborMapData & md)>setValue);
187+
#else
188+
CborError appendAttributeName(String attributeName, nonstd::function<CborError (CborEncoder& mapEncoder)>f, CborEncoder *encoder);
189+
void setAttributeReal(String attributeName, nonstd::function<void (CborMapData & md)>setValue);
190+
#endif
181191
void setAttributesFromCloud(std::list<CborMapData> * map_data_list);
182192
void setAttributeReal(bool& value, String attributeName = "");
183193
void setAttributeReal(int& value, String attributeName = "");
184194
void setAttributeReal(float& value, String attributeName = "");
185195
void setAttributeReal(String& value, String attributeName = "");
186-
void setAttributeReal(String attributeName, std::function<void (CborMapData & md)>setValue);
187196
String getAttributeName(String propertyName, char separator);
188197

189198
virtual bool isDifferentFromCloud() = 0;

0 commit comments

Comments
 (0)