Skip to content

Add support for PORTENTA C33 #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 22, 2023
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 src/AIoTC_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
#define HAS_TCP
#endif

#if defined(ARDUINO_NICLA_VISION)
#if defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_PORTENTA_C33)
#define BOARD_HAS_SE050
#define HAS_TCP
#endif
Expand Down
3 changes: 3 additions & 0 deletions src/ArduinoIoTCloudTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,

#if defined(BOARD_HAS_ECCX08)
_sslClient.setClient(_connection->getClient());
#elif defined(ARDUINO_PORTENTA_C33)
_sslClient.setClient(_connection->getClient());
_sslClient.setCACert(AIoTSSCert);
#elif defined(BOARD_HAS_SE050)
_sslClient.appendCustomCACert(AIoTSSCert);
#elif defined(BOARD_ESP)
Expand Down
7 changes: 7 additions & 0 deletions src/ArduinoIoTCloudTCP.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
#include "tls/utility/CryptoUtil.h"
#elif defined(BOARD_ESP)
#include <WiFiClientSecure.h>
#elif defined(ARDUINO_PORTENTA_C33)
#include "tls/utility/CryptoUtil.h"
#include <SSLClient.h>
#elif defined(BOARD_HAS_SE050)
#include "tls/utility/CryptoUtil.h"
#include <WiFiSSLSE050Client.h>
Expand Down Expand Up @@ -146,6 +149,10 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
#elif defined(BOARD_ESP)
WiFiClientSecure _sslClient;
String _password;
#elif defined(ARDUINO_PORTENTA_C33)
ArduinoIoTCloudCertClass _cert;
SSLClient _sslClient;
CryptoUtil _crypto;
#elif defined(BOARD_HAS_SE050)
ArduinoIoTCloudCertClass _cert;
WiFiSSLSE050Client _sslClient;
Expand Down
42 changes: 39 additions & 3 deletions src/utility/time/TimeService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#include "RTCMillis.h"
#endif

#ifdef ARDUINO_ARCH_RENESAS
#include "RTC.h"
#endif

/**************************************************************************************
* GLOBAL VARIABLES
**************************************************************************************/
Expand Down Expand Up @@ -86,6 +90,12 @@ void esp8266_setRTC(unsigned long time);
unsigned long esp8266_getRTC();
#endif

#ifdef ARDUINO_ARCH_RENESAS
void renesas_initRTC();
void renesas_setRTC(unsigned long time);
unsigned long renesas_getRTC();
#endif

/**************************************************************************************
* CONSTANTS
**************************************************************************************/
Expand Down Expand Up @@ -330,8 +340,10 @@ void TimeServiceClass::initRTC()
stm32h7_initRTC();
#elif defined (ARDUINO_ARCH_ESP32)
esp32_initRTC();
#elif ARDUINO_ARCH_ESP8266
#elif defined (ARDUINO_ARCH_ESP8266)
esp8266_initRTC();
#elif defined (ARDUINO_ARCH_RENESAS)
renesas_initRTC();
#else
#error "RTC not available for this architecture"
#endif
Expand All @@ -347,8 +359,10 @@ void TimeServiceClass::setRTC(unsigned long time)
stm32h7_setRTC(time);
#elif defined (ARDUINO_ARCH_ESP32)
esp32_setRTC(time);
#elif ARDUINO_ARCH_ESP8266
#elif defined (ARDUINO_ARCH_ESP8266)
esp8266_setRTC(time);
#elif defined (ARDUINO_ARCH_RENESAS)
renesas_setRTC(time);
#else
#error "RTC not available for this architecture"
#endif
Expand All @@ -364,8 +378,10 @@ unsigned long TimeServiceClass::getRTC()
return stm32h7_getRTC();
#elif defined (ARDUINO_ARCH_ESP32)
return esp32_getRTC();
#elif ARDUINO_ARCH_ESP8266
#elif defined (ARDUINO_ARCH_ESP8266)
return esp8266_getRTC();
#elif defined (ARDUINO_ARCH_RENESAS)
return renesas_getRTC();
#else
#error "RTC not available for this architecture"
#endif
Expand Down Expand Up @@ -491,6 +507,26 @@ unsigned long esp8266_getRTC()
}
#endif

#ifdef ARDUINO_ARCH_RENESAS
void renesas_initRTC()
{
RTC.begin();
}

void renesas_setRTC(unsigned long time)
{
RTCTime t(time);
RTC.setTime(t);
}

unsigned long renesas_getRTC()
{
RTCTime t;
RTC.getTime(t);
return t.getUnixTime();
}
#endif

/******************************************************************************
* EXTERN DEFINITION
******************************************************************************/
Expand Down