diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 4e286b9f..0965db83 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -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 @@ -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 diff --git a/src/AIoTC_Config.h b/src/AIoTC_Config.h index 2efb7021..6276f57c 100644 --- a/src/AIoTC_Config.h +++ b/src/AIoTC_Config.h @@ -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 diff --git a/src/tls/AIoTCUPCert.h b/src/tls/AIoTCUPCert.h index 5c933da0..40fe3c00 100644 --- a/src/tls/AIoTCUPCert.h +++ b/src/tls/AIoTCUPCert.h @@ -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 diff --git a/src/tls/utility/TLSClientMqtt.cpp b/src/tls/utility/TLSClientMqtt.cpp index 831f31cf..449e780f 100644 --- a/src/tls/utility/TLSClientMqtt.cpp +++ b/src/tls/utility/TLSClientMqtt.cpp @@ -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); diff --git a/src/tls/utility/TLSClientMqtt.h b/src/tls/utility/TLSClientMqtt.h index 837e76de..11acfb30 100644 --- a/src/tls/utility/TLSClientMqtt.h +++ b/src/tls/utility/TLSClientMqtt.h @@ -54,10 +54,11 @@ */ #include class TLSClientMqtt : public WiFiSSLClient { -#elif defined(BOARD_ESP) +#elif defined(BOARD_ESP) || defined(ARDUINO_RASPBERRY_PI_PICO_W) /* * ESP32* * ESP82* + * PICOW */ #include class TLSClientMqtt : public WiFiClientSecure { diff --git a/src/tls/utility/TLSClientOta.cpp b/src/tls/utility/TLSClientOta.cpp index f03af769..2d86c54b 100644 --- a/src/tls/utility/TLSClientOta.cpp +++ b/src/tls/utility/TLSClientOta.cpp @@ -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); diff --git a/src/tls/utility/TLSClientOta.h b/src/tls/utility/TLSClientOta.h index 3e76433a..4ce90ae9 100644 --- a/src/tls/utility/TLSClientOta.h +++ b/src/tls/utility/TLSClientOta.h @@ -54,10 +54,11 @@ */ #include class TLSClientOta : public WiFiSSLClient { -#elif defined(BOARD_ESP) +#elif defined(BOARD_ESP) || defined(ARDUINO_RASPBERRY_PI_PICO_W) /* * ESP32* * ESP82* + * PICOW */ #include class TLSClientOta : public WiFiClientSecure { diff --git a/src/utility/time/RTCMillis.cpp b/src/utility/time/RTCMillis.cpp index 419236d1..91741678 100644 --- a/src/utility/time/RTCMillis.cpp +++ b/src/utility/time/RTCMillis.cpp @@ -15,7 +15,7 @@ a commercial license, send an email to license@arduino.cc. */ -#ifdef ARDUINO_ARCH_ESP8266 +#if defined (ARDUINO_ARCH_ESP8266) || defined (ARDUINO_RASPBERRY_PI_PICO_W) /************************************************************************************** * INCLUDE @@ -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 */ diff --git a/src/utility/time/RTCMillis.h b/src/utility/time/RTCMillis.h index 1fa7e0f4..fce881fd 100644 --- a/src/utility/time/RTCMillis.h +++ b/src/utility/time/RTCMillis.h @@ -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 @@ -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_ */ diff --git a/src/utility/time/TimeService.cpp b/src/utility/time/TimeService.cpp index 5bf081de..82f3a693 100644 --- a/src/utility/time/TimeService.cpp +++ b/src/utility/time/TimeService.cpp @@ -34,7 +34,7 @@ #include #endif -#ifdef ARDUINO_ARCH_ESP8266 +#if defined (ARDUINO_ARCH_ESP8266) || defined (ARDUINO_RASPBERRY_PI_PICO_W) #include "RTCMillis.h" #endif @@ -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 @@ -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 **************************************************************************************/ @@ -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 @@ -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 @@ -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 @@ -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 ******************************************************************************/