Skip to content

Commit

Permalink
Initial: add pi pico w support
Browse files Browse the repository at this point in the history
  • Loading branch information
pennam committed Dec 23, 2024
1 parent c28ca7a commit 211dbdb
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/AIoTC_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,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: 4 additions & 0 deletions src/utility/time/TimeService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ void TimeServiceClass::initRTC()
esp8266_initRTC();
#elif defined (ARDUINO_ARCH_RENESAS)
renesas_initRTC();
#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
#else
#error "RTC not available for this architecture"
#endif
Expand All @@ -374,6 +375,7 @@ void TimeServiceClass::setRTC(unsigned long time)
esp8266_setRTC(time);
#elif defined (ARDUINO_ARCH_RENESAS)
renesas_setRTC(time);
#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
#else
#error "RTC not available for this architecture"
#endif
Expand All @@ -393,6 +395,8 @@ unsigned long TimeServiceClass::getRTC()
return esp8266_getRTC();
#elif defined (ARDUINO_ARCH_RENESAS)
return renesas_getRTC();
#elif defined (ARDUINO_RASPBERRY_PI_PICO_W)
return 1;
#else
#error "RTC not available for this architecture"
#endif
Expand Down

0 comments on commit 211dbdb

Please sign in to comment.