Skip to content

Commit 0d96330

Browse files
committed
[SD] add pico2
1 parent d29e3e4 commit 0d96330

File tree

10 files changed

+355
-24
lines changed

10 files changed

+355
-24
lines changed

platformio.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ board_build.filesystem_size = 0.5m
417417
build_flags = -DUSE_TINYUSB
418418
; Once https://github.com/platformio/platformio-core > 6.1.11 these can be removed
419419
lib_ignore = WiFiNINA, WiFi101, Adafruit Zero DMA Library
420-
lib_compat_mode = soft ; can be strict once pio detects SleepyDog on RP2350
421420

422421
[env:raspberypi_picow]
423422
extends = common:rp2040

src/network_interfaces/ws_networking_pico.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef WS_NETWORKING_PICO_H
1818
#define WS_NETWORKING_PICO_H
1919

20-
#ifdef ARDUINO_ARCH_RP2040
20+
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
2121

2222
#define PICO_CONNECT_TIMEOUT_MS 20000 /*!< Connection timeout (in ms) */
2323
#define PICO_CONNECT_RETRY_DELAY_MS 200 /*!< delay time between retries. */
@@ -363,4 +363,4 @@ class ws_networking_pico : public Wippersnapper {
363363
};
364364

365365
#endif // ARDUINO_ARCH_RP2040
366-
#endif // WS_NETWORKING_PICO_H
366+
#endif // RASPBERRY_PI_PICO_W

src/network_interfaces/ws_networking_pico_v2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef WS_NETWORKING_PICO_V2_H
1818
#define WS_NETWORKING_PICO_V2_H
1919

20-
#ifdef ARDUINO_ARCH_RP2040
20+
#ifdef ARDUINO_RASPBERRY_PI_PICO_W
2121

2222
#define PICO_CONNECT_TIMEOUT_MS 20000 /*!< Connection timeout (in ms) */
2323
#define PICO_CONNECT_RETRY_DELAY_MS 200 /*!< delay time between retries. */
@@ -362,5 +362,5 @@ class ws_networking_pico_v2 : public Wippersnapper_V2 {
362362
}
363363
};
364364

365-
#endif // ARDUINO_ARCH_RP2040
365+
#endif // RASPBERRY_PI_PICO_W
366366
#endif // WS_NETWORKING_PICO_V2_H
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
/*!
2+
* @file ws_nonet_pico.h
3+
*
4+
* This is a driver for using the Raspberry Pi Pico/Pico2
5+
* without a network interface with Adafruit IO Wippersnapper.
6+
*
7+
* Adafruit invests time and resources providing this open source code,
8+
* please support Adafruit and open-source hardware by purchasing
9+
* products from Adafruit!
10+
*
11+
* Copyright (c) Brent Rubell 2024-2025 for Adafruit Industries.
12+
*
13+
* MIT license, all text here must be included in any redistribution.
14+
*
15+
*/
16+
17+
#ifndef WS_NONET_PICO_H
18+
#define WS_NONET_PICO_H
19+
20+
#if defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_RASPBERRY_PI_PICO_2)
21+
22+
#define PICO_CONNECT_TIMEOUT_MS 20000 /*!< Connection timeout (in ms) */
23+
#define PICO_CONNECT_RETRY_DELAY_MS 200 /*!< delay time between retries. */
24+
25+
#include "Wippersnapper.h"
26+
#include "Arduino.h"
27+
28+
extern Wippersnapper WS;
29+
30+
/****************************************************************************/
31+
/*!
32+
@brief Class for using the Raspberry Pi Pico network interface.
33+
*/
34+
/****************************************************************************/
35+
class ws_nonet_pico : public Wippersnapper {
36+
37+
public:
38+
/**************************************************************************/
39+
/*!
40+
@brief Initializes the WipperSnapper class for RPi Pico.
41+
*/
42+
/**************************************************************************/
43+
ws_nonet_pico() : Wippersnapper() {
44+
_ssid = 0;
45+
_pass = 0;
46+
}
47+
48+
/**************************************************************************/
49+
/*!
50+
@brief Destructor
51+
*/
52+
/**************************************************************************/
53+
~ws_nonet_pico() {
54+
// Do nothing
55+
}
56+
57+
/********************************************************/
58+
/*!
59+
@brief Sets the WiFi client's ssid and password.
60+
@param ssid
61+
WiFi network's SSID.
62+
@param ssidPassword
63+
WiFi network's password.
64+
*/
65+
/********************************************************/
66+
void set_ssid_pass(const char *ssid, const char *ssidPassword) {
67+
// Do nothing
68+
}
69+
70+
/**********************************************************/
71+
/*!
72+
@brief Sets the WiFi client's ssid and password.
73+
*/
74+
/**********************************************************/
75+
void set_ssid_pass() {
76+
// Do nothing
77+
}
78+
79+
/***********************************************************/
80+
/*!
81+
@brief Performs a scan of local WiFi networks.
82+
@returns True if `_network_ssid` is found, False otherwise.
83+
*/
84+
/***********************************************************/
85+
bool check_valid_ssid() {
86+
return false;
87+
}
88+
89+
/********************************************************/
90+
/*!
91+
@brief Sets the RPi Pico's unique client identifier
92+
@note On RPi Pico, the UID is the MAC address.
93+
*/
94+
/********************************************************/
95+
void getMacAddr() {
96+
// Do nothing
97+
}
98+
99+
/********************************************************/
100+
/*!
101+
@brief Gets the current network RSSI value
102+
@return int32_t RSSI value
103+
*/
104+
/********************************************************/
105+
int32_t getRSSI() { return 0; }
106+
107+
/********************************************************/
108+
/*!
109+
@brief Initializes the MQTT client
110+
@param clientID
111+
MQTT client identifier
112+
*/
113+
/********************************************************/
114+
void setupMQTTClient(const char *clientID) {
115+
// Do nothing
116+
}
117+
118+
/********************************************************/
119+
/*!
120+
@brief Returns the network status of an RPi Pico.
121+
@return ws_status_t
122+
*/
123+
/********************************************************/
124+
ws_status_t networkStatus() {
125+
return WS_NET_DISCONNECTED;
126+
}
127+
128+
/*******************************************************************/
129+
/*!
130+
@brief Returns the type of network connection used by Wippersnapper
131+
@return Pico
132+
*/
133+
/*******************************************************************/
134+
const char *connectionType() { return "Pico-NoNet"; }
135+
136+
protected:
137+
const char *_ssid; ///< WiFi SSID
138+
const char *_pass; ///< WiFi password
139+
140+
/**************************************************************************/
141+
/*!
142+
@brief Establishes a connection with the wireless network.
143+
*/
144+
/**************************************************************************/
145+
void _connect() {
146+
// Do nothing
147+
}
148+
149+
/**************************************************************************/
150+
/*!
151+
@brief Disconnects from the wireless network.
152+
*/
153+
/**************************************************************************/
154+
void _disconnect() {
155+
// Do nothing
156+
}
157+
};
158+
159+
#endif // ARDUINO_ARCH_RP2040
160+
#endif // RASPBERRY_PI_PICO_W
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
/*!
2+
* @file ws_nonet_pico_v2.h
3+
*
4+
* This is a driver for using the Raspberry Pi Pi Pico/Pico2
5+
* without a network interface with Adafruit IO Wippersnapper.
6+
*
7+
* Adafruit invests time and resources providing this open source code,
8+
* please support Adafruit and open-source hardware by purchasing
9+
* products from Adafruit!
10+
*
11+
* Copyright (c) Brent Rubell 2024-2025 for Adafruit Industries.
12+
*
13+
* MIT license, all text here must be included in any redistribution.
14+
*
15+
*/
16+
17+
#ifndef WS_NONET_PICO_V2_H
18+
#define WS_NONET_PICO_V2_H
19+
20+
#if defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_RASPBERRY_PI_PICO_2)
21+
22+
#define PICO_CONNECT_TIMEOUT_MS 20000 /*!< Connection timeout (in ms) */
23+
#define PICO_CONNECT_RETRY_DELAY_MS 200 /*!< delay time between retries. */
24+
25+
#include "Wippersnapper_V2.h"
26+
#include "Arduino.h"
27+
28+
extern Wippersnapper_V2 WsV2;
29+
30+
/****************************************************************************/
31+
/*!
32+
@brief Class for using the Raspberry Pi Pico network interface.
33+
*/
34+
/****************************************************************************/
35+
class ws_nonet_pico_v2 : public Wippersnapper_V2 {
36+
37+
public:
38+
/**************************************************************************/
39+
/*!
40+
@brief Initializes the WipperSnapper class for RPi Pico.
41+
*/
42+
/**************************************************************************/
43+
ws_nonet_pico_v2() : Wippersnapper_V2() {
44+
// No-op
45+
}
46+
47+
/**************************************************************************/
48+
/*!
49+
@brief Destructor
50+
*/
51+
/**************************************************************************/
52+
~ws_nonet_pico_v2() {
53+
// No-op
54+
}
55+
56+
/********************************************************/
57+
/*!
58+
@brief Sets the WiFi client's ssid and password.
59+
@param ssid
60+
WiFi network's SSID.
61+
@param ssidPassword
62+
WiFi network's password.
63+
*/
64+
/********************************************************/
65+
void set_ssid_pass(const char *ssid, const char *ssidPassword) {
66+
// No-op
67+
WS_DEBUG_PRINTLN("Code should not get here!");
68+
}
69+
70+
/**********************************************************/
71+
/*!
72+
@brief Sets the WiFi client's ssid and password.
73+
*/
74+
/**********************************************************/
75+
void set_ssid_pass() {
76+
WS_DEBUG_PRINTLN("Code should not get here!");
77+
}
78+
79+
/***********************************************************/
80+
/*!
81+
@brief Performs a scan of local WiFi networks.
82+
@returns True if `_network_ssid` is found, False otherwise.
83+
*/
84+
/***********************************************************/
85+
bool check_valid_ssid() {
86+
WS_DEBUG_PRINTLN("Code should not get here!");
87+
return false;
88+
}
89+
90+
/********************************************************/
91+
/*!
92+
@brief Sets the RPi Pico's unique client identifier
93+
@note On RPi Pico, the UID is the MAC address.
94+
*/
95+
/********************************************************/
96+
void getMacAddr() {
97+
WS_DEBUG_PRINTLN("Code should not get here!");
98+
}
99+
100+
/********************************************************/
101+
/*!
102+
@brief Gets the current network RSSI value
103+
@return int32_t RSSI value
104+
*/
105+
/********************************************************/
106+
int32_t getRSSI() {
107+
WS_DEBUG_PRINTLN("Code should not get here!");
108+
return 0; }
109+
110+
/********************************************************/
111+
/*!
112+
@brief Initializes the MQTT client
113+
@param clientID
114+
MQTT client identifier
115+
*/
116+
/********************************************************/
117+
void setupMQTTClient(const char *clientID) {
118+
// No-op
119+
WS_DEBUG_PRINTLN("Code should not get here!");
120+
}
121+
122+
/********************************************************/
123+
/*!
124+
@brief Returns the network status of an RPi Pico.
125+
@return ws_status_t
126+
*/
127+
/********************************************************/
128+
ws_status_t networkStatus() {
129+
WS_DEBUG_PRINTLN("Code should not get here!");
130+
return WS_NET_DISCONNECTED;
131+
}
132+
133+
/*******************************************************************/
134+
/*!
135+
@brief Returns the type of network connection used by Wippersnapper
136+
@return Pico
137+
*/
138+
/*******************************************************************/
139+
const char *connectionType() {
140+
WS_DEBUG_PRINTLN("Code should not get here!");
141+
return "Pico-Nonet-v2"; }
142+
143+
protected:
144+
/**************************************************************************/
145+
/*!
146+
@brief Establishes a connection with the wireless network.
147+
*/
148+
/**************************************************************************/
149+
void _connect() {
150+
// No-op
151+
WS_DEBUG_PRINTLN("Code should not get here!");
152+
}
153+
154+
/**************************************************************************/
155+
/*!
156+
@brief Disconnects from the wireless network.
157+
*/
158+
/**************************************************************************/
159+
void _disconnect() {
160+
// No-op
161+
WS_DEBUG_PRINTLN("Code should not get here!");
162+
}
163+
};
164+
165+
#endif // RASPBERRY_PI_PICO_W
166+
#endif // WS_NONET_PICO_H

src/provisioning/tinyusb/Wippersnapper_FS.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
defined(ARDUINO_RASPBERRY_PI_PICO_W) || \
2727
defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S3_REVTFT) || \
2828
defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2_REVTFT) || \
29-
defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2)
29+
defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2) || \
30+
defined(ARDUINO_RASPBERRY_PI_PICO) || \
31+
defined(ARDUINO_RASPBERRY_PI_PICO_2)
3032
#include "Wippersnapper_FS.h"
3133
// On-board external flash (QSPI or SPI) macros should already
3234
// defined in your board variant if supported

src/provisioning/tinyusb/Wippersnapper_FS_V2.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S3_REVTFT) || \
2828
defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2_REVTFT) || \
2929
defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2) || \
30+
defined(ARDUINO_RASPBERRY_PI_PICO) || \
3031
defined(ARDUINO_RASPBERRY_PI_PICO_2)
3132
#include "Wippersnapper_FS_V2.h"
3233
// On-board external flash (QSPI or SPI) macros should already

0 commit comments

Comments
 (0)