Skip to content

Commit 7286da7

Browse files
committed
feat: add support for arduino-pico sdk
1 parent fbb03b1 commit 7286da7

File tree

8 files changed

+57
-28
lines changed

8 files changed

+57
-28
lines changed

examples/Demo/Demo.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
Works with following hardware:
1414
- ESP8266
1515
- ESP32
16+
- RP2040+W
17+
- RP2350+W
1618
1719
WebSerial terminal will be accessible at your microcontroller's <IPAddress>/webserial URL.
1820
@@ -26,6 +28,9 @@
2628
#elif defined(ESP32)
2729
#include <WiFi.h>
2830
#include <AsyncTCP.h>
31+
#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
32+
#include <WiFi.h>
33+
#include <RPAsyncTCP.h>
2934
#endif
3035
#include <ESPAsyncWebServer.h>
3136
#include <WebSerial.h>

examples/Demo_AP/Demo_AP.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
Works with following hardware:
1414
- ESP8266
1515
- ESP32
16+
- RP2040+W
17+
- RP2350+W
1618
1719
WebSerial terminal will be accessible at your microcontroller's <IPAddress>/webserial URL.
1820
@@ -26,6 +28,9 @@
2628
#elif defined(ESP32)
2729
#include <WiFi.h>
2830
#include <AsyncTCP.h>
31+
#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
32+
#include <WiFi.h>
33+
#include <RPAsyncTCP.h>
2934
#endif
3035
#include <ESPAsyncWebServer.h>
3136
#include <WebSerial.h>

examples/HighPerf/HighPerf.ino

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,18 @@
1717
* -D WS_MAX_QUEUED_MESSAGES=128
1818
*/
1919
#include <Arduino.h>
20+
2021
#if defined(ESP8266)
21-
#include <ESP8266WiFi.h>
22-
#include <ESPAsyncTCP.h>
22+
#include <ESP8266WiFi.h>
23+
#include <ESPAsyncTCP.h>
2324
#elif defined(ESP32)
24-
#include <AsyncTCP.h>
25-
#include <WiFi.h>
25+
#include <WiFi.h>
26+
#include <AsyncTCP.h>
27+
#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
28+
#include <WiFi.h>
29+
#include <RPAsyncTCP.h>
2630
#endif
31+
2732
#include <DNSServer.h>
2833
#include <ESPAsyncWebServer.h>
2934
#include <WString.h>

examples/Logging/Logging.ino

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@
99
* -D WS_MAX_QUEUED_MESSAGES=128
1010
*/
1111
#include <Arduino.h>
12+
1213
#if defined(ESP8266)
13-
#include <ESP8266WiFi.h>
14-
#include <ESPAsyncTCP.h>
14+
#include <ESP8266WiFi.h>
15+
#include <ESPAsyncTCP.h>
1516
#elif defined(ESP32)
16-
#include <AsyncTCP.h>
17-
#include <WiFi.h>
17+
#include <WiFi.h>
18+
#include <AsyncTCP.h>
19+
#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
20+
#include <WiFi.h>
21+
#include <RPAsyncTCP.h>
1822
#endif
23+
1924
#include <DNSServer.h>
2025
#include <ESPAsyncWebServer.h>
2126
#include <WString.h>

library.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "WebSerial",
3-
"keywords": "WebSerial, remote, terminal, serial, monitor, ESP8266, ESP32, webpage, websocket, wireless",
3+
"keywords": "WebSerial, remote, terminal, serial, monitor, ESP8266, ESP32, RP2040, RP2350, webpage, websocket, wireless",
44
"description": "WebSerial is a remote terminal which is accessible via browser to log, monitor or debug your firmware remotely.",
55
"repository":
66
{
@@ -15,15 +15,15 @@
1515
"maintainer": true
1616
}
1717
],
18-
"version": "2.0.8",
18+
"version": "2.1.0",
1919
"frameworks": "arduino",
20-
"platforms": ["espressif8266", "espressif32"],
20+
"platforms": ["espressif8266", "espressif32", "raspberrypi"],
2121
"dependencies": [
2222
{
23-
"owner": "mathieucarbou",
23+
"owner": "esp32async",
2424
"name": "ESPAsyncWebServer",
25-
"version": "^3.3.17",
26-
"platforms": ["espressif8266", "espressif32"]
25+
"version": "^3.7.3",
26+
"platforms": ["espressif8266", "espressif32", "raspberrypi"]
2727
}
2828
]
2929
}

library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=WebSerial
2-
version=2.0.8
2+
version=2.1.0
33
author=Ayush Sharma
44
category=Communication
55
maintainer=Ayush Sharma <[email protected]>
66
sentence=Remote terminal for wireless microcontrollers
77
paragraph=WebSerial is a remote terminal which is accessible via browser to log, monitor or debug your firmware remotely.
88
url=https://github.com/ayushsharma82/WebSerial
9-
architectures=esp8266,esp32
9+
architectures=esp8266,esp32,rp2040

src/WebSerial.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,12 @@ size_t WebSerialClass::write(uint8_t m) {
127127
// We do not support non-buffered write on webserial for the HIGH_PERF version
128128
// we fail with a stack trace allowing the user to change the code to use write(const uint8_t* buffer, size_t size) instead
129129
if(!_initialBufferCapacity) {
130-
#ifdef ESP8266
130+
#ifdef defined(ESP8266)
131131
ets_printf("Non-buffered write is not supported. Please use write(const uint8_t* buffer, size_t size) instead.");
132-
#else
132+
#elif defined(ESP32)
133133
log_e("Non-buffered write is not supported. Please use write(const uint8_t* buffer, size_t size) instead.");
134+
#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
135+
Serial.println("Non-buffered write is not supported. Please use write(const uint8_t* buffer, size_t size) instead.");
134136
#endif
135137
assert(false);
136138
return 0;

src/WebSerial.h

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,24 @@ License: AGPL-3.0 (https://www.gnu.org/licenses/agpl-3.0.html)
2424
#include <functional>
2525

2626
#if defined(ESP8266)
27-
#define HARDWARE "ESP8266"
28-
#include "ESP8266WiFi.h"
29-
#include "ESPAsyncTCP.h"
30-
#include "ESPAsyncWebServer.h"
27+
#define HARDWARE "ESP8266"
28+
#include "ESP8266WiFi.h"
29+
#include "ESPAsyncTCP.h"
30+
#include "ESPAsyncWebServer.h"
3131
#elif defined(ESP32)
32-
#define HARDWARE "ESP32"
33-
#include "WiFi.h"
34-
#include "AsyncTCP.h"
35-
#include "ESPAsyncWebServer.h"
32+
#define HARDWARE "ESP32"
33+
#include "WiFi.h"
34+
#include "AsyncTCP.h"
35+
#include "ESPAsyncWebServer.h"
36+
#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
37+
#include "WiFi.h"
38+
#include "RPAsyncTCP.h"
39+
#include "ESPAsyncWebServer.h"
40+
#if defined(TARGET_RP2040) || defined(PICO_RP2040)
41+
#define HARDWARE "RP2040"
42+
#elif defined(TARGET_RP2350) || defined(PICO_RP2350)
43+
#define HARDWARE "RP2350"
44+
#endif
3645
#endif
3746

3847
#ifndef WSL_MAX_WS_CLIENTS
@@ -116,7 +125,6 @@ class WebSerialClass : public Print {
116125
void setBuffer(size_t initialCapacity);
117126

118127
#ifdef WSL_HIGH_PERF
119-
#ifdef ASYNCWEBSERVER_FORK_mathieucarbou
120128
// Expose the internal WebSocket makeBuffer to even improve memory consumption on client-side
121129
// 1. make a AsyncWebSocketMessageBuffer
122130
// 2. put the data inside
@@ -135,7 +143,6 @@ class WebSerialClass : public Print {
135143
if (_ws->count())
136144
_ws->textAll(buffer);
137145
}
138-
#endif
139146
#endif
140147

141148
private:

0 commit comments

Comments
 (0)