23IPAddress RF24EthernetClass::_dnsServerAddress;
27#if !defined NRF52_RADIO_LIBRARY
69 if (!network.multicastRelay) {
73 const uint8_t mac[6] = {0x52, 0x46, 0x32, 0x34, (uint8_t)address, (uint8_t)(address >> 8)};
78 network.multicastRelay = 1;
84 RF24_Channel = RF24_Channel ? RF24_Channel : 97;
85 network.begin(RF24_Channel, address);
92 RF24_Channel = channel;
93 if (network.multicastRelay) {
94 radio.setChannel(RF24_Channel);
111 IPAddress gateway = ip;
113 begin(ip, dns, gateway);
120 IPAddress subnet(255, 255, 255, 0);
121 begin(ip, dns, gateway, subnet);
128 configure(ip, dns, gateway, subnet);
133void RF24EthernetClass::configure(IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet)
135#if !defined(RF24_TAP)
136 mesh.setNodeID(ip[3]);
139 uip_buf = (uint8_t*)&network.frag_ptr->message_buffer[0];
143 uip_sethostaddr(ipaddr);
145 uip_setdraddr(ipaddr);
147 uip_setnetmask(ipaddr);
148 _dnsServerAddress = dns;
153 timer_set(&this->arp_timer, CLOCK_SECOND * 2);
168 uip_setdraddr(ipaddr);
175 uip_listen(HTONS(port));
212 return _dnsServerAddress;
217void RF24EthernetClass::tick()
219#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_RP2040)
222#if defined(ARDUINO_ARCH_ESP32)
223 const TickType_t xDelay = 1 / portTICK_PERIOD_MS;
227 if (
RF24Ethernet.network.update() == EXTERNAL_DATA_TYPE) {
228 if (
RF24Ethernet.network.frag_ptr->message_size <= UIP_BUFSIZE) {
233#if !defined(RF24_TAP)
240 else if (timer_expired(&
Ethernet.periodic_timer)) {
241 timer_reset(&
Ethernet.periodic_timer);
242 for (
int i = 0; i < UIP_CONNS; i++) {
254 if (
BUF->type == htons(UIP_ETHTYPE_IP)) {
265 else if (
BUF->type == htons(UIP_ETHTYPE_ARP)) {
275 else if (timer_expired(&
Ethernet.periodic_timer)) {
276 timer_reset(&
Ethernet.periodic_timer);
277 for (
int i = 0; i < UIP_CONNS; i++) {
289 for (
int i = 0; i < UIP_UDP_CONNS; i++) {
297 RF24UDP::_send((uip_udp_userdata_t*)(uip_udp_conns[i].appstate));
304 if (timer_expired(&
Ethernet.arp_timer)) {
314void RF24EthernetClass::network_send()
316 RF24NetworkHeader headerOut(00, EXTERNAL_DATA_TYPE);
318#if defined ETH_DEBUG_L1 || defined ETH_DEBUG_L2
319 bool ok =
RF24Ethernet.network.write(headerOut, uip_buf, uip_len);
322 Serial.print(millis());
323 Serial.println(F(
" *** RF24Ethernet Network Write Fail ***"));
326 RF24Ethernet.network.write(headerOut, uip_buf, uip_len);
329#if defined ETH_DEBUG_L2
332 Serial.print(millis());
333 Serial.println(F(
" RF24Ethernet Network Write OK"));
#define uip_ip_addr(addr, ip)
#define uip_seteth_addr(eaddr)
RF24EthernetClass RF24Ethernet
void setMac(uint16_t address)
void setChannel(uint8_t channel)
void listen(uint16_t port)
void set_gateway(IPAddress gwIP)
void begin(IP_ADDR myIP, IP_ADDR subnet)
#define UIP_TIMER_DIVISOR
Adjust the rate at which the IP stack performs periodic processing.