Skip to content

Commit f3701cb

Browse files
Enable Ethernet library for Portenta
1 parent b599f40 commit f3701cb

File tree

15 files changed

+50
-4
lines changed

15 files changed

+50
-4
lines changed

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include(mbed-os/tools/cmake/mbed_toolchain_setup.cmake)
1111

1212
project(ArduinoCore-mbed-ce
1313
LANGUAGES C CXX ASM
14-
VERSION 1.1.0) # This is the version of the Mbed CE Arduino core, not of Mbed CE
14+
VERSION 1.1.1) # This is the version of the Mbed CE Arduino core, not of Mbed CE
1515

1616
include(mbed_project_setup)
1717

@@ -63,8 +63,11 @@ set(MBED_LIBS_TO_INSTALL
6363

6464
# Networking
6565
mbed-lwipstack
66+
mbed-ppp
6667
mbed-netsocket-api
68+
mbed-nanostack-libservice
6769
mbed-mbedtls
70+
mbed-randlib
6871

6972
# Storage / Block Device
7073
mbed-storage
@@ -118,6 +121,12 @@ if("COMPONENT_QSPIF=1" IN_LIST MBED_TARGET_DEFINITIONS)
118121
mbed-storage-blockdevice)
119122
endif()
120123

124+
if("DEVICE_EMAC=1" IN_LIST MBED_TARGET_DEFINITIONS)
125+
list(APPEND MBED_LIBS_TO_INSTALL
126+
mbed-emac)
127+
endif()
128+
129+
121130
# We also need to know about any precompiled .a files
122131
# under variants/xxx/libs
123132
if("ARDUINO_NANO33BLE" IN_LIST MBED_TARGET_LABELS)

extras/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Install Arduino API and make a build system target for it
22
set(ARDUINO_API_SOURCES
3+
ArduinoCore-API/api/Common.cpp
34
ArduinoCore-API/api/CanMsg.cpp
45
ArduinoCore-API/api/CanMsgRingbuffer.cpp
56
ArduinoCore-API/api/IPAddress.cpp

libraries/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ if("ARDUINO_PORTENTA_H7" IN_LIST MBED_TARGET_LABELS)
6060
add_subdirectory(ThreadDebug)
6161
add_subdirectory(USBAudio)
6262
add_subdirectory(KernelDebug)
63+
add_subdirectory(Ethernet)
6364
# TODO add missing libraries for Portenta
6465
# add_subdirectory(PDM)
6566
# add_subdirectory(Arduino_H7_Video)

libraries/Ethernet/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
add_library(arduino-Ethernet STATIC
2+
src/Ethernet.cpp
3+
src/EthernetServer.cpp)
4+
5+
target_link_libraries(arduino-Ethernet PUBLIC arduino-core arduino-SocketWrapper)
6+
target_include_directories(arduino-Ethernet PUBLIC src)
7+
8+
build_arduino_examples(Ethernet examples)
9+
10+
target_link_libraries(Ethernet-example-BarometricPressureWebServer arduino-SPI)
11+
12+
# Workaround for conflict between SPI.h from Mbed and SPI.h from Arduino.
13+
include_directories(../SPI)
14+
15+
install(DIRECTORY . DESTINATION libraries/Ethernet)

libraries/Ethernet/examples/AdvancedChatServer/AdvancedChatServer.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
2020
*/
2121

22+
#include <Arduino.h>
2223
#include <SPI.h>
2324
#include <PortentaEthernet.h>
2425
#include <Ethernet.h>

libraries/Ethernet/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
by Tom Igoe
2424
*/
2525

26+
#include <Arduino.h>
2627
#include <PortentaEthernet.h>
2728
#include <Ethernet.h>
2829
// the sensor communicates using SPI, so include the library:
@@ -53,6 +54,11 @@ float temperature = 0.0;
5354
long pressure = 0;
5455
long lastReadingTime = 0;
5556

57+
void getData();
58+
void listenForEthernetClients();
59+
void writeRegister(byte registerName, byte registerValue);
60+
unsigned int readRegister(byte registerName, int numBytes);
61+
5662
void setup() {
5763

5864
// start the SPI library:

libraries/Ethernet/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <PortentaEthernet.h>
2121
#include <SPI.h>
2222

23+
void connectEth();
24+
2325
void setup()
2426
{
2527

libraries/Ethernet/examples/DhcpChatServer/DhcpChatServer.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
2121
*/
2222

23+
#include <Arduino.h>
2324
#include <SPI.h>
2425
#include <PortentaEthernet.h>
2526
#include <Ethernet.h>

libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ byte packetBuffer[NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packe
3434
// A UDP instance to let us send and receive packets over UDP
3535
EthernetUDP Udp;
3636

37+
void connectEth();
38+
void sendNTPpacket(const char * address);
39+
3740
void setup() {
3841

3942
// Open serial communications and wait for port to open:

libraries/Ethernet/examples/WebClientRepeating/WebClientRepeating.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ char server[] = "www.arduino.cc"; // also change the Host line in httpRequest()
3939
unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
4040
const unsigned long postingInterval = 10*1000; // delay between updates, in milliseconds
4141

42+
void httpRequest();
43+
4244
void setup() {
4345

4446

libraries/Ethernet/examples/WebClientRepeatingManual/WebClientRepeatingManual.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ char server[] = "www.arduino.cc"; // also change the Host line in httpRequest()
4242
unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
4343
const unsigned long postingInterval = 10 * 1000; // delay between updates, in milliseconds
4444

45+
void httpRequest();
46+
4547
void setup()
4648
{
4749
// start serial port:

libraries/Ethernet/examples/WebClientRepeatingSSL/WebClientRepeatingSSL.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ IPAddress myDns(192, 168, 0, 1);
2424
unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
2525
const unsigned long postingInterval = 10 * 1000; // delay between updates, in milliseconds
2626

27+
void httpRequest();
28+
2729
void setup()
2830
{
2931

libraries/SocketWrapper/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ add_library(arduino-SocketWrapper STATIC ${SOCKETWRAPPER_SOURCES})
1010
target_link_libraries(arduino-SocketWrapper PUBLIC
1111
arduino-core
1212
mbed-netsocket-api
13+
mbed-storage
1314
mbed-storage-fat
1415
mbed-storage-blockdevice)
1516
target_include_directories(arduino-SocketWrapper PUBLIC src)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#define SECRET_SSID ""
2-
#define SECRET_PASS ""
1+
#define SECRET_SSID "Bird-Mounted Surveillance Drone"
2+
#define SECRET_PASS "dialupkestrel"

0 commit comments

Comments
 (0)