Skip to content

Commit 2ebb324

Browse files
authored
Fix native ethernet (#37)
* Replace the default Ethernet library with the NativeEthernet library The Teensy 4.1 requires a direct replacement for the normal Ethernet.h library by the NativeEthernet library. NativeEthernet is a builtin library in platformio, therefore no extra installations are required. * fix de-referencing null pointer The locator struct is not handed over, but the transport_* callbacks depend on it. This result in a NULL pointer in `transport->args`.
1 parent 58a6010 commit 2ebb324

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

platform_code/arduino/native_ethernet/micro_ros_transport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <micro_ros_platformio.h>
44

5-
#include <EthernetUdp.h>
5+
#include <NativeEthernetUdp.h>
66

77
#include <uxr/client/util/time.h>
88
#include <uxr/client/profile/transport/custom/custom_transport.h>
@@ -58,4 +58,4 @@ size_t platformio_transport_read(struct uxrCustomTransport * transport, uint8_t
5858
return (available > 0) ? available : 0;
5959
}
6060

61-
}
61+
}

platform_code/arduino/native_ethernet/micro_ros_transport.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <Ethernet.h>
1+
#include <NativeEthernet.h>
22

33
struct micro_ros_agent_locator {
44
IPAddress address;
@@ -17,10 +17,10 @@ static inline void set_microros_native_ethernet_transports(byte mac[], IPAddress
1717

1818
rmw_uros_set_custom_transport(
1919
false,
20-
NULL,
20+
&locator,
2121
platformio_transport_open,
2222
platformio_transport_close,
2323
platformio_transport_write,
2424
platformio_transport_read
2525
);
26-
}
26+
}

0 commit comments

Comments
 (0)