CI can use custom defines, add ESPHost/WINC tests (#2142)
If a file called `.ci.defines` is present in a directory, apply those while building the specified sketch. * Add an lwip_ESPHost test, like the wired Ethernet ones * Add WINC1500 test and CI hook * Remove 1 minor warning in WINC build
This commit is contained in:
parent
0b4afab56c
commit
fa58b6987a
7 changed files with 213 additions and 3 deletions
|
|
@ -0,0 +1 @@
|
|||
-DESPHOST_RESET=D5 -DESPHOST_HANDSHAKE=D7 -DESPHOST_DATA_READY=D6 -DESPHOST_CS=D1 -DESPHOSTSPI=SPI
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
This sketch establishes a TCP connection to a "quote of the day" service.
|
||||
It sends a "hello" message, and then prints received data.
|
||||
*/
|
||||
|
||||
#ifndef ESPHOSTSPI
|
||||
#error This example requires an ESP-Hosted-FG WiFi chip to be defined, see the documentation
|
||||
// For example, add this to your boards.local.txt:
|
||||
// rpipico.build.extra_flags=-DESPHOST_RESET=D5 -DESPHOST_HANDSHAKE=D7 -DESPHOST_DATA_READY=D6 -DESPHOST_CS=D1 -DESPHOSTSPI=SPI
|
||||
#endif
|
||||
|
||||
#include <WiFi.h>
|
||||
|
||||
#ifndef STASSID
|
||||
#define STASSID "your-ssid"
|
||||
#define STAPSK "your-password"
|
||||
#endif
|
||||
|
||||
const char* ssid = STASSID;
|
||||
const char* password = STAPSK;
|
||||
|
||||
const char* host = "djxmmx.net";
|
||||
const uint16_t port = 17;
|
||||
|
||||
WiFiMulti multi;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
// We start by connecting to a WiFi network
|
||||
|
||||
Serial.println();
|
||||
Serial.println();
|
||||
Serial.print("Connecting to ");
|
||||
Serial.println(ssid);
|
||||
|
||||
multi.addAP(ssid, password);
|
||||
|
||||
if (multi.run() != WL_CONNECTED) {
|
||||
Serial.println("Unable to connect to network, rebooting in 10 seconds...");
|
||||
delay(10000);
|
||||
rp2040.reboot();
|
||||
}
|
||||
|
||||
Serial.println("");
|
||||
Serial.println("WiFi connected");
|
||||
Serial.println("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
|
||||
void loop() {
|
||||
static bool wait = false;
|
||||
|
||||
Serial.print("connecting to ");
|
||||
Serial.print(host);
|
||||
Serial.print(':');
|
||||
Serial.println(port);
|
||||
|
||||
// Use WiFiClient class to create TCP connections
|
||||
WiFiClient client;
|
||||
if (!client.connect(host, port)) {
|
||||
Serial.println("connection failed");
|
||||
delay(5000);
|
||||
return;
|
||||
}
|
||||
|
||||
// This will send a string to the server
|
||||
Serial.println("sending data to server");
|
||||
if (client.connected()) {
|
||||
client.println("hello from RP2040");
|
||||
}
|
||||
|
||||
// wait for data to be available
|
||||
unsigned long timeout = millis();
|
||||
while (client.available() == 0) {
|
||||
if (millis() - timeout > 5000) {
|
||||
Serial.println(">>> Client Timeout !");
|
||||
client.stop();
|
||||
delay(60000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Read all the lines of the reply from server and print them to Serial
|
||||
Serial.println("receiving from remote server");
|
||||
// not testing 'client.connected()' since we do not need to send data here
|
||||
while (client.available()) {
|
||||
char ch = static_cast<char>(client.read());
|
||||
Serial.print(ch);
|
||||
}
|
||||
|
||||
// Close the connection
|
||||
Serial.println();
|
||||
Serial.println("closing connection");
|
||||
client.stop();
|
||||
|
||||
if (wait) {
|
||||
delay(300000); // execute once every 5 minutes, don't flood remote service
|
||||
}
|
||||
wait = true;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
-DWINC1501_SPI=SPI -DWINC1501_RESET_PIN=D5 -DWINC1501_INTN_PIN=D7 -DWINC1501_SPI_CS_PIN=D10
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
This sketch establishes a TCP connection to a "quote of the day" service.
|
||||
It sends a "hello" message, and then prints received data.
|
||||
*/
|
||||
|
||||
#ifndef WINC1501_SPI
|
||||
#error This example requires a WINC1500 WiFi chip to be defined, see the documentation
|
||||
// For example, add this to your boards.local.txt:
|
||||
// rpipico.build.extra_flags=-DWINC1501_SPI=SPI -DWINC1501_RESET_PIN=D5 -DWINC1501_INTN_PIN=D7 -DWINC1501_SPI_CS_PIN=D10
|
||||
#endif
|
||||
|
||||
#include <WiFi.h>
|
||||
|
||||
#ifndef STASSID
|
||||
#define STASSID "your-ssid"
|
||||
#define STAPSK "your-password"
|
||||
#endif
|
||||
|
||||
const char* ssid = STASSID;
|
||||
const char* password = STAPSK;
|
||||
|
||||
const char* host = "djxmmx.net";
|
||||
const uint16_t port = 17;
|
||||
|
||||
WiFiMulti multi;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
// We start by connecting to a WiFi network
|
||||
|
||||
Serial.println();
|
||||
Serial.println();
|
||||
Serial.print("Connecting to ");
|
||||
Serial.println(ssid);
|
||||
|
||||
multi.addAP(ssid, password);
|
||||
|
||||
if (multi.run() != WL_CONNECTED) {
|
||||
Serial.println("Unable to connect to network, rebooting in 10 seconds...");
|
||||
delay(10000);
|
||||
rp2040.reboot();
|
||||
}
|
||||
|
||||
Serial.println("");
|
||||
Serial.println("WiFi connected");
|
||||
Serial.println("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
|
||||
void loop() {
|
||||
static bool wait = false;
|
||||
|
||||
Serial.print("connecting to ");
|
||||
Serial.print(host);
|
||||
Serial.print(':');
|
||||
Serial.println(port);
|
||||
|
||||
// Use WiFiClient class to create TCP connections
|
||||
WiFiClient client;
|
||||
if (!client.connect(host, port)) {
|
||||
Serial.println("connection failed");
|
||||
delay(5000);
|
||||
return;
|
||||
}
|
||||
|
||||
// This will send a string to the server
|
||||
Serial.println("sending data to server");
|
||||
if (client.connected()) {
|
||||
client.println("hello from RP2040");
|
||||
}
|
||||
|
||||
// wait for data to be available
|
||||
unsigned long timeout = millis();
|
||||
while (client.available() == 0) {
|
||||
if (millis() - timeout > 5000) {
|
||||
Serial.println(">>> Client Timeout !");
|
||||
client.stop();
|
||||
delay(60000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Read all the lines of the reply from server and print them to Serial
|
||||
Serial.println("receiving from remote server");
|
||||
// not testing 'client.connected()' since we do not need to send data here
|
||||
while (client.available()) {
|
||||
char ch = static_cast<char>(client.read());
|
||||
Serial.print(ch);
|
||||
}
|
||||
|
||||
// Close the connection
|
||||
Serial.println();
|
||||
Serial.println("closing connection");
|
||||
client.stop();
|
||||
|
||||
if (wait) {
|
||||
delay(300000); // execute once every 5 minutes, don't flood remote service
|
||||
}
|
||||
wait = true;
|
||||
}
|
||||
|
|
@ -242,7 +242,7 @@ static void m2m_wifi_cb(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr)
|
|||
{
|
||||
uint8 u8SetRxDone;
|
||||
tstrM2mIpRsvdPkt strM2mRsvd;
|
||||
if(hif_receive(u32Addr, &strM2mRsvd ,sizeof(tstrM2mIpRsvdPkt), 0) == M2M_SUCCESS)
|
||||
if(hif_receive(u32Addr, (uint8 *)&strM2mRsvd ,sizeof(tstrM2mIpRsvdPkt), 0) == M2M_SUCCESS)
|
||||
{
|
||||
tstrM2mIpCtrlBuf strM2mIpCtrlBuf;
|
||||
uint16 u16Offset = strM2mRsvd.u16PktOffset;
|
||||
|
|
|
|||
|
|
@ -123,6 +123,12 @@ function build_sketches()
|
|||
export MSYS2_ARG_CONV_EXC="*"
|
||||
export MSYS_NO_PATHCONV=1
|
||||
fi
|
||||
rm -f boards.local.txt
|
||||
if [[ -f "$sketchdir/.ci.defines" ]]; then
|
||||
(echo -n "rpipico.build.extra_flags="; cat "$sketchdir/.ci.defines") > boards.local.txt
|
||||
echo -n "--- Additional test defines: "
|
||||
cat boards.local.txt
|
||||
fi
|
||||
echo "$build_cmd $sketch"
|
||||
time ($build_cmd $sketch >build.log)
|
||||
local result=$?
|
||||
|
|
@ -150,7 +156,6 @@ function install_libraries()
|
|||
mkdir -p $HOME/Arduino/libraries
|
||||
pushd $HOME/Arduino/libraries
|
||||
|
||||
# install ArduinoJson library
|
||||
{ test -r ArduinoJson-v6.11.0.zip || curl -sS --output ArduinoJson-v6.11.0.zip -L https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip; } && unzip -qo ArduinoJson-v6.11.0.zip
|
||||
{ test -r Adafruit_SPIFlash-3.4.1.zip || curl -sS --output Adafruit_SPIFlash-3.4.1.zip -L https://github.com/adafruit/Adafruit_SPIFlash/archive/refs/tags/3.4.1.zip; } && unzip -qo Adafruit_SPIFlash-3.4.1.zip
|
||||
{ test -r Adafruit_Seesaw-1.4.4.zip || curl -sS --output Adafruit_Seesaw-1.4.4.zip -L https://github.com/adafruit/Adafruit_Seesaw/archive/refs/tags/1.4.4.zip; } && unzip -qo Adafruit_Seesaw-1.4.4.zip
|
||||
|
|
@ -158,6 +163,7 @@ function install_libraries()
|
|||
{ test -r Adafruit_CircuitPlayground-1.11.3.zip || curl -sS --output Adafruit_CircuitPlayground-1.11.3.zip -L https://github.com/adafruit/Adafruit_CircuitPlayground/archive/refs/tags/1.11.3.zip; } && unzip -qo Adafruit_CircuitPlayground-1.11.3.zip
|
||||
{ test -r Adafruit_NeoPixel-1.8.1.zip || curl -sS --output Adafruit_NeoPixel-1.8.1.zip -L https://github.com/adafruit/Adafruit_NeoPixel/archive/refs/tags/1.8.1.zip; } && unzip -qo Adafruit_NeoPixel-1.8.1.zip
|
||||
{ test -r Arduino_MIDI_Library-5.0.2.zip || curl -sS --output Arduino_MIDI_Library-5.0.2.zip -L https://github.com/FortySevenEffects/arduino_midi_library/archive/refs/tags/5.0.2.zip; } && unzip -qo Arduino_MIDI_Library-5.0.2.zip
|
||||
git clone https://github.com/JAndrassy/ESPHost.git
|
||||
popd
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ def compile(tmp_dir, sketch, cache, tools_dir, hardware_dir, ide_path, f, args):
|
|||
'dbgport={dbgport},' \
|
||||
'dbglvl={dbglvl},' \
|
||||
'usbstack={usbstack}'.format(**vars(args))
|
||||
if ("/WiFi" in sketch) or ("/ArduinoOTA" in sketch) or ("/HTTPClient" in sketch) or ('/HTTPUpdate' in sketch) or ('/WebServer' in sketch) or ('/DNSServer' in sketch) or ('/BT' in sketch) or ('/BLE' in sketch):
|
||||
if ("libraries/WiFi" in sketch) or ("/ArduinoOTA" in sketch) or ("/HTTPClient" in sketch) or ('/HTTPUpdate' in sketch) or ('/WebServer' in sketch) or ('/DNSServer' in sketch) or ('/BT' in sketch) or ('/BLE' in sketch):
|
||||
fqbn = fqbn.replace("rpipico", "rpipicow")
|
||||
if ('/BT' in sketch) or ('/BLE' in sketch):
|
||||
fqbn = fqbn + ",ipbtstack=ipv4btcble"
|
||||
|
|
|
|||
Loading…
Reference in a new issue