Skip to content

Commit 1ce09cc

Browse files
authored
Arduino Opta support (#1867)
* added opta, wifi test needed * added ci * updated readme * fix example * fix define ARDUINO_OPTA * added ethernet
1 parent 299ed38 commit 1ce09cc

File tree

8 files changed

+20
-14
lines changed

8 files changed

+20
-14
lines changed

.github/workflows/ci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
arduino-cli core install arduino:mbed_giga -v
4343
arduino-cli core install arduino:mbed_rp2040 -v
4444
arduino-cli core install arduino:mbed_portenta -v
45+
arduino-cli core install arduino:mbed_opta -v
4546
arduino-cli core install arduino:renesas_uno -v
4647
arduino-cli core install arduino:mbed_nano -v
4748
arduino-cli core install esp32:esp32 -v
@@ -92,6 +93,10 @@ jobs:
9293
arduino-cli compile --fqbn arduino:renesas_uno:minima /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
9394
arduino-cli compile --fqbn arduino:renesas_uno:unor4wifi /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
9495
arduino-cli compile --fqbn arduino:renesas_uno:unor4wifi /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v
96+
arduino-cli compile --fqbn arduino:mbed_opta:opta /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v
97+
arduino-cli compile --fqbn arduino:mbed_opta:opta /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v
98+
arduino-cli compile --fqbn arduino:mbed_opta:opta /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_ethernet -v
99+
95100
# Build micro-ros_publisher-wifi_at for WiFi non-native board with ESP-AT
96101
arduino-cli compile --fqbn arduino:mbed_rp2040:pico /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi_at -v
97102

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Community contributed boards are:
5151
| [Arduino Giga R1](https://store.arduino.cc/products/giga-r1-wifi) | - | [@gbr1](https://github.com/gbr1) | | `colcon.meta` |
5252
| [Arduino UNO R4 WiFi](https://store.arduino.cc/products/uno-r4-wifi) | - | [@gbr1](https://github.com/gbr1) | | `colcon.meta` |
5353
| [Arduino UNO R4 Minima](https://store.arduino.cc/products/uno-r4-minima) | - | [@gbr1](https://github.com/gbr1) | | `colcon.meta` |
54+
| [Arduino Opta](https://store.arduino.cc/products/opta-wifi) | - | [@gbr1](https://github.com/gbr1) | | `colcon.meta` |
5455

5556

5657
You can find the available precompiled ROS 2 types for messages and services in [available_ros2_types](available_ros2_types).

examples/micro-ros_publisher_ethernet/micro-ros_publisher_ethernet.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#include <rclc/executor.h>
88
#include <std_msgs/msg/int32.h>
99

10-
#if !defined(TARGET_STM32F4) && !defined(ARDUINO_TEENSY41) && !defined(TARGET_PORTENTA_H7_M7)
11-
#error This example is only available for Arduino Portenta, Arduino Teensy41 and STM32F4
10+
#if !defined(TARGET_STM32F4) && !defined(ARDUINO_TEENSY41) && !defined(TARGET_PORTENTA_H7_M7) && !defined(ARDUINO_OPTA)
11+
#error This example is only available for Arduino Portenta, Arduino Teensy41, STM32F4 and Arduino OPTA
1212
#endif
1313

1414
#if defined(ARDUINO_TEENSY41)

examples/micro-ros_publisher_wifi/micro-ros_publisher_wifi.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#include <std_msgs/msg/int32.h>
1010

11-
#if !defined(ESP32) && !defined(TARGET_PORTENTA_H7_M7) && !defined(ARDUINO_GIGA) && !defined(ARDUINO_NANO_RP2040_CONNECT) && !defined(ARDUINO_WIO_TERMINAL) && !defined(ARDUINO_UNOR4_WIFI)
12-
#error This example is only available for Arduino Portenta, Arduino Giga R1, Arduino Nano RP2040 Connect, ESP32 Dev module, Wio Terminal and Arduino Uno R4 WiFi
11+
#if !defined(ESP32) && !defined(TARGET_PORTENTA_H7_M7) && !defined(ARDUINO_GIGA) && !defined(ARDUINO_NANO_RP2040_CONNECT) && !defined(ARDUINO_WIO_TERMINAL) && !defined(ARDUINO_UNOR4_WIFI) && !defined(ARDUINO_OPTA)
12+
#error This example is only available for Arduino Portenta, Arduino Giga R1, Arduino Nano RP2040 Connect, ESP32 Dev module, Wio Terminal, Arduino Uno R4 WiFi and Arduino OPTA WiFi
1313
#endif
1414

1515
rcl_publisher_t publisher;

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ paragraph=micro-ROS Arduino library
77
url=https://github.com/micro-ROS/micro_ros_arduino
88
precompiled=true
99
category=Other
10-
architectures=stm32,OpenCR,Teensyduino,samd,sam,mbed,esp32,mbed_portenta,mbed_giga,renesas_uno
10+
architectures=stm32,OpenCR,Teensyduino,samd,sam,mbed,esp32,mbed_portenta,mbed_giga,renesas_uno,mbed_opta

src/micro_ros_arduino.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ static inline void set_microros_transports(){
5656
#include <NativeEthernet.h>
5757
#endif
5858

59-
#if defined(TARGET_PORTENTA_H7_M7)
59+
#if defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
6060
#include <PortentaEthernet.h>
6161
#endif
6262

63-
#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7)
63+
#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
6464
extern "C" bool arduino_native_ethernet_udp_transport_open(struct uxrCustomTransport * transport);
6565
extern "C" bool arduino_native_ethernet_udp_transport_close(struct uxrCustomTransport * transport);
6666
extern "C" size_t arduino_native_ethernet_udp_transport_write(struct uxrCustomTransport* transport, const uint8_t * buf, size_t len, uint8_t * err);
@@ -95,9 +95,9 @@ static inline void set_microros_native_ethernet_udp_transports(byte mac[], IPAdd
9595

9696
#endif
9797

98-
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_WIO_TERMINAL) || defined(BOARD_WITH_ESP_AT) || defined(ARDUINO_UNOR4_WIFI)
98+
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_WIO_TERMINAL) || defined(BOARD_WITH_ESP_AT) || defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_OPTA)
9999

100-
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA)
100+
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_OPTA)
101101
#include <WiFi.h>
102102
#include <WiFiUdp.h>
103103
#elif defined(ARDUINO_NANO_RP2040_CONNECT)
@@ -116,7 +116,7 @@ extern "C" bool arduino_wifi_transport_open(struct uxrCustomTransport * transpor
116116
extern "C" bool arduino_wifi_transport_close(struct uxrCustomTransport * transport);
117117
extern "C" size_t arduino_wifi_transport_write(struct uxrCustomTransport* transport, const uint8_t * buf, size_t len, uint8_t * err);
118118
extern "C" size_t arduino_wifi_transport_read(struct uxrCustomTransport* transport, uint8_t* buf, size_t len, int timeout, uint8_t* err);
119-
#ifndef TARGET_PORTENTA_H7_M7
119+
#if !defined(TARGET_PORTENTA_H7_M7) && !defined(ARDUINO_OPTA)
120120
struct micro_ros_agent_locator {
121121
IPAddress address;
122122
int port;

src/native_ethernet_transport.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
#include <NativeEthernet.h>
1111
#include <micro_ros_arduino.h>
1212
#endif
13-
#ifdef TARGET_PORTENTA_H7_M7
13+
#if defined(TARGET_PORTENTA_H7_M7 ) || defined(ARDUINO_OPTA)
1414
#include <Arduino.h>
1515
#include <EthernetUdp.h>
1616
#include <micro_ros_arduino.h>
1717
#endif
1818

19-
#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7)
19+
#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
2020
extern "C" {
2121

2222
#include <stdbool.h>

src/wifi_transport.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_WIO_TERMINAL) || defined(BOARD_WITH_ESP_AT) || defined(ARDUINO_UNOR4_WIFI)
1+
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_WIO_TERMINAL) || defined(BOARD_WITH_ESP_AT) || defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_OPTA)
22
#include <Arduino.h>
33

44

5-
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA)
5+
#if defined(ESP32) || defined(TARGET_PORTENTA_H7_M7) || defined(ARDUINO_GIGA) || defined(ARDUINO_OPTA)
66
#include <WiFi.h>
77
#include <WiFiUdp.h>
88
#elif defined(ARDUINO_NANO_RP2040_CONNECT)

0 commit comments

Comments
 (0)