Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=AzureIoTUtility
version=1.5.0
version=1.6.0
author=Microsoft
maintainer=Microsoft <[email protected]>
sentence=Azure C shared utility library for Arduino. For the Arduino MKR1000 or Zero and WiFi Shield 101, Adafruit Huzzah and Feather M0, or SparkFun Thing.
Expand Down
2 changes: 1 addition & 1 deletion src/AzureIoTUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
#include "azure_c_shared_utility/tlsio.h"
#include "azure_c_shared_utility/xlogging.h"

#define AzureIoTUtilityVersion "1.5.0"
#define AzureIoTUtilityVersion "1.6.0"

#endif //AZUREIOTUTILITY_H
4 changes: 4 additions & 0 deletions src/adapters/sslClient_arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ static BearSSL::X509List cert(certificates);
#include "WiFi.h"
#include "WiFiClientSecure.h"
static WiFiClientSecure sslClient; // for ESP32
#elif WIO_TERMINAL
#include "WiFi.h"
#include "WiFiClientSecure.h"
static WiFiClientSecure sslClient; // for Wio Terminal variant of SAMD
#else
#include "WiFi101.h"
#include "WiFiSSLClient.h"
Expand Down
6 changes: 6 additions & 0 deletions src/samd/NTPClientAz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ void NTPClientAz::prepareRequest()
void NTPClientAz::sendRequest(const char* host, int port)
{
_udp.beginPacket(host, port);

#if WIO_TERMINAL
_udp.write((const uint8_t*)_buffer, NTP_PACKET_SIZE);
#else
_udp.write(_buffer, NTP_PACKET_SIZE);
#endif

_udp.endPacket();
}

Expand Down
5 changes: 5 additions & 0 deletions src/samd/NTPClientAz.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
#ifndef NTPCLIENT_AZ_H
#define NTPCLIENT_AZ_H

#if WIO_TERMINAL
#include <WiFi.h>
#else
#include <WiFi101.h>
#endif

#include <WiFiUdp.h>

#define NTP_PACKET_SIZE 48
Expand Down
17 changes: 17 additions & 0 deletions src/samd/sample_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@
#include <time.h>
#include <sys/time.h>
#include <SPI.h>

#if WIO_TERMINAL
#include <WiFi.h>
#include "WiFiClientSecure.h"
static WiFiClientSecure sslClient; // for Wio Terminal variant of SAMD
#else
#include <WiFi101.h>
static WiFiSSLClient sslClient;
#endif

#include <WiFiUdp.h>
#include "NTPClientAz.h"

Expand Down Expand Up @@ -79,7 +88,15 @@ static void initTime() {
delay(2000);
} else {
Serial.print("Fetched NTP epoch time is: ");

#if WIO_TERMINAL
char buff[32];
sprintf(buff, "%.f", difftime(epochTime, (time_t) 0));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always just use the WIO version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could possibly but I went with the idea of least amount of change to other environments to not cause unintended issues.

Serial.println(buff);
#else
Serial.println(epochTime);
#endif

break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/samd/time.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if defined(ARDUINO_ARCH_SAMD)
#if defined(ARDUINO_ARCH_SAMD) && !defined(WIO_TERMINAL)
#include <time.h>
#include <sys/time.h>

Expand Down