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
0 commit comments