Skip to content

Commit 91e3a95

Browse files
authored
Adding native ethernet support for Teensy 4.1 (#625)
1 parent 9943871 commit 91e3a95

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/micro_ros_arduino.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ static inline void set_microros_transports(){
4242
#include <uxr/client/transport.h>
4343
#include <rmw_microros/rmw_microros.h>
4444
#include "IPAddress.h"
45+
#endif
46+
47+
#ifdef ARDUINO_TEENSY41
48+
#include <NativeEthernet.h>
49+
#endif
4550

51+
#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41)
4652
extern "C" bool arduino_native_ethernet_udp_transport_open(struct uxrCustomTransport * transport);
4753
extern "C" bool arduino_native_ethernet_udp_transport_close(struct uxrCustomTransport * transport);
4854
extern "C" size_t arduino_native_ethernet_udp_transport_write(struct uxrCustomTransport* transport, const uint8_t * buf, size_t len, uint8_t * err);

src/native_ethernet_transport.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44
#include <EthernetUdp.h>
55
#include <STM32Ethernet.h>
66
#include <micro_ros_arduino.h>
7+
#endif
78

9+
#ifdef ARDUINO_TEENSY41
10+
#include <NativeEthernet.h>
11+
#include <micro_ros_arduino.h>
12+
#endif
13+
14+
#if defined(TARGET_STM32F4) || defined(ARDUINO_TEENSY41)
815
extern "C" {
916

1017
#include <stdbool.h>
@@ -74,7 +81,6 @@ int clock_gettime(clockid_t unused, struct timespec *tp) {
7481

7582
return 0;
7683
}
77-
7884
}
7985

80-
#endif
86+
#endif

0 commit comments

Comments
 (0)