Skip to content
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

Add support to Raspberry Pi Pico W #503

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ jobs:
- fqbn: arduino:mbed_edge:edge_control
type: mbed_edge
artifact-name-suffix: arduino-mbed_edge-edge_control
- fqbn: "rp2040:rp2040:rpipicow"
type: rp2040
artifact-name-suffix: rp2040-rp2040-rpipicow


# make board type-specific customizations to the matrix jobs
Expand Down Expand Up @@ -256,6 +259,13 @@ jobs:
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
sketch-paths: |
- examples/ArduinoIoTCloud-DeferredOTA
# PicoW
- board:
type: rp2040
platforms: |
# Install rp2040 platform via Boards Manager
- name: rp2040:rp2040
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

steps:
- name: Checkout
Expand Down
5 changes: 5 additions & 0 deletions src/AIoTC_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
#define HAS_TCP
#endif

#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
#define BOARD_HAS_SECRET_KEY
#define HAS_TCP
#endif

#if defined(BOARD_HAS_SOFTSE) || defined(BOARD_HAS_OFFLOADED_ECCX08) || defined(BOARD_HAS_ECCX08) || defined(BOARD_HAS_SE050)
#define BOARD_HAS_SECURE_ELEMENT
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/tls/AIoTCUPCert.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ static const unsigned char x509_crt_bundle[] = {
0x00, 0x01
};

#elif defined (ARDUINO_EDGE_CONTROL)
#elif defined (ARDUINO_EDGE_CONTROL) || defined (ARDUINO_RASPBERRY_PI_PICO_W)
/*
* https://www.amazontrust.com/repository/AmazonRootCA1.pem
* https://www.amazontrust.com/repository/AmazonRootCA2.pem
Expand Down
2 changes: 2 additions & 0 deletions src/tls/utility/TLSClientMqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ void TLSClientMqtt::begin(ConnectionHandler & connection) {
* https://github.com/arduino/uno-r4-wifi-usb-bridge/blob/f09ca94fdcab845b8368d4435fdac9f6999d21d2/certificates/certificates.pem#L852
*/
(void)connection;
#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)
setCACert(AIoTUPCert);
#elif defined(ARDUINO_ARCH_ESP32)
#if (ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 4))
setCACertBundle(x509_crt_bundle);
Expand Down
3 changes: 2 additions & 1 deletion src/tls/utility/TLSClientMqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@
*/
#include <WiFiSSLClient.h>
class TLSClientMqtt : public WiFiSSLClient {
#elif defined(BOARD_ESP)
#elif defined(BOARD_ESP) || defined(ARDUINO_RASPBERRY_PI_PICO_W)
/*
* ESP32*
* ESP82*
* PICOW
*/
#include <WiFiClientSecure.h>
class TLSClientMqtt : public WiFiClientSecure {
Expand Down
2 changes: 2 additions & 0 deletions src/tls/utility/TLSClientOta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ void TLSClientOta::begin(ConnectionHandler &connection) {
* https://github.com/arduino-libraries/Arduino_ESP32_OTA/blob/fc755e7d1d3946232107e2590662ee08d6ccdec4/src/tls/amazon_root_ca.h
*/
(void)connection;
#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)
setCACert(AIoTUPCert);
#elif defined(ARDUINO_ARCH_ESP32)
#if (ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 4))
setCACertBundle(x509_crt_bundle);
Expand Down
3 changes: 2 additions & 1 deletion src/tls/utility/TLSClientOta.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@
*/
#include <WiFiSSLClient.h>
class TLSClientOta : public WiFiSSLClient {
#elif defined(BOARD_ESP)
#elif defined(BOARD_ESP) || defined(ARDUINO_RASPBERRY_PI_PICO_W)
/*
* ESP32*
* ESP82*
* PICOW
*/
#include <WiFiClientSecure.h>
class TLSClientOta : public WiFiClientSecure {
Expand Down
4 changes: 2 additions & 2 deletions src/utility/time/RTCMillis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
a commercial license, send an email to [email protected].
*/

#ifdef ARDUINO_ARCH_ESP8266
#if defined (ARDUINO_ARCH_ESP8266) || defined (ARDUINO_RASPBERRY_PI_PICO_W)

/**************************************************************************************
* INCLUDE
Expand Down Expand Up @@ -59,4 +59,4 @@ unsigned long RTCMillis::get()
return _last_rtc_update_value;
}

#endif /* ARDUINO_ARCH_ESP8266 */
#endif /* ARDUINO_ARCH_ESP8266 || ARDUINO_RASPBERRY_PI_PICO_W */
4 changes: 2 additions & 2 deletions src/utility/time/RTCMillis.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef ARDUINO_IOT_CLOUD_RTC_MILLIS_H_
#define ARDUINO_IOT_CLOUD_RTC_MILLIS_H_

#ifdef ARDUINO_ARCH_ESP8266
#if defined (ARDUINO_ARCH_ESP8266) || defined (ARDUINO_RASPBERRY_PI_PICO_W)

/**************************************************************************************
* INCLUDE
Expand All @@ -45,6 +45,6 @@ class RTCMillis

};

#endif /* ARDUINO_ARCH_ESP8266 */
#endif /* ARDUINO_ARCH_ESP8266 || ARDUINO_RASPBERRY_PI_PICO_W */

#endif /* ARDUINO_IOT_CLOUD_RTC_MILLIS_H_ */
33 changes: 31 additions & 2 deletions src/utility/time/TimeService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <mbed_rtc_time.h>
#endif

#ifdef ARDUINO_ARCH_ESP8266
#if defined (ARDUINO_ARCH_ESP8266) || defined (ARDUINO_RASPBERRY_PI_PICO_W)
#include "RTCMillis.h"
#endif

Expand All @@ -50,7 +50,7 @@
RTCZero rtc;
#endif

#ifdef ARDUINO_ARCH_ESP8266
#if defined (ARDUINO_ARCH_ESP8266) || defined (ARDUINO_RASPBERRY_PI_PICO_W)
RTCMillis rtc;
#endif

Expand Down Expand Up @@ -90,6 +90,12 @@ void renesas_setRTC(unsigned long time);
unsigned long renesas_getRTC();
#endif

#ifdef ARDUINO_RASPBERRY_PI_PICO_W
void pico_w_initRTC();
void pico_w_setRTC(unsigned long time);
unsigned long pico_w_getRTC();
#endif

/**************************************************************************************
* DEFINES
**************************************************************************************/
Expand Down Expand Up @@ -341,6 +347,8 @@ void TimeServiceClass::initRTC()
esp8266_initRTC();
#elif defined (ARDUINO_ARCH_RENESAS)
renesas_initRTC();
#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
pico_w_initRTC();
#else
#error "RTC not available for this architecture"
#endif
Expand All @@ -358,6 +366,8 @@ void TimeServiceClass::setRTC(unsigned long time)
esp8266_setRTC(time);
#elif defined (ARDUINO_ARCH_RENESAS)
renesas_setRTC(time);
#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
pico_w_setRTC(time);
#else
#error "RTC not available for this architecture"
#endif
Expand All @@ -375,6 +385,8 @@ unsigned long TimeServiceClass::getRTC()
return esp8266_getRTC();
#elif defined (ARDUINO_ARCH_RENESAS)
return renesas_getRTC();
#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
return pico_w_getRTC();
#else
#error "RTC not available for this architecture"
#endif
Expand Down Expand Up @@ -509,6 +521,23 @@ unsigned long renesas_getRTC()
}
#endif

#ifdef ARDUINO_RASPBERRY_PI_PICO_W
void pico_w_initRTC()
{
rtc.begin();
}

void pico_w_setRTC(unsigned long time)
{
rtc.set(time);
}

unsigned long pico_w_getRTC()
{
return rtc.get();
}
#endif

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