23IPAddress RF24EthernetClass::_dnsServerAddress;
56 if (!network.multicastRelay) {
60 const uint8_t mac[6] = {0x52, 0x46, 0x32, 0x34, (uint8_t)address, (uint8_t)(address >> 8)};
65 network.multicastRelay = 1;
71 RF24_Channel = RF24_Channel ? RF24_Channel : 97;
72 network.begin(RF24_Channel, address);
79 RF24_Channel = channel;
80 if (network.multicastRelay) {
81 radio.setChannel(RF24_Channel);
98 IPAddress gateway = ip;
100 begin(ip, dns, gateway);
107 IPAddress subnet(255, 255, 255, 0);
108 begin(ip, dns, gateway, subnet);
115 configure(ip, dns, gateway, subnet);
120void RF24EthernetClass::configure(IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet)
122#if !defined(RF24_TAP)
123 mesh.setNodeID(ip[3]);
126 uip_buf = (uint8_t*)&network.frag_ptr->message_buffer[0];
130 uip_sethostaddr(ipaddr);
132 uip_setdraddr(ipaddr);
134 uip_setnetmask(ipaddr);
135 _dnsServerAddress = dns;
140 timer_set(&this->arp_timer, CLOCK_SECOND * 2);
155 uip_setdraddr(ipaddr);
162 uip_listen(HTONS(port));
199 return _dnsServerAddress;
204void RF24EthernetClass::tick()
206#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_RP2040)
209 if (
RF24Ethernet.network.update() == EXTERNAL_DATA_TYPE) {
210 if (
RF24Ethernet.network.frag_ptr->message_size <= UIP_BUFSIZE) {
215#if !defined(RF24_TAP)
222 else if (timer_expired(&
Ethernet.periodic_timer)) {
223 timer_reset(&
Ethernet.periodic_timer);
224 for (
int i = 0; i < UIP_CONNS; i++) {
236 if (
BUF->type == htons(UIP_ETHTYPE_IP)) {
247 else if (
BUF->type == htons(UIP_ETHTYPE_ARP)) {
257 else if (timer_expired(&
Ethernet.periodic_timer)) {
258 timer_reset(&
Ethernet.periodic_timer);
259 for (
int i = 0; i < UIP_CONNS; i++) {
271 for (
int i = 0; i < UIP_UDP_CONNS; i++) {
279 RF24UDP::_send((uip_udp_userdata_t*)(uip_udp_conns[i].appstate));
286 if (timer_expired(&
Ethernet.arp_timer)) {
296void RF24EthernetClass::network_send()
298 RF24NetworkHeader headerOut(00, EXTERNAL_DATA_TYPE);
300 bool ok =
RF24Ethernet.network.write(headerOut, uip_buf, uip_len);
303 ok =
RF24Ethernet.network.write(headerOut, uip_buf, uip_len);
304#if defined ETH_DEBUG_L1 || defined ETH_DEBUG_L2
307 Serial.print(millis());
308 Serial.println(F(
" *** RF24Ethernet Network Write Fail ***"));
313#if defined ETH_DEBUG_L2
316 Serial.print(millis());
317 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.