RF24Ethernet - TCP/IP over RF24Network v2.2.6
TMRh20 - Pushing the practical limits of RF24 modules
Loading...
Searching...
No Matches
RF24BoardConfig.h
Go to the documentation of this file.
1
2#ifndef RF24BOARDCONFIG_H
3#define RF24BOARDCONFIG_H
4
5/*******************************************************************/
6
7// Temporary for nRF52x devices until core changes are in on GitHub: force uIP (no lwIP) and no UDP
8#if defined ARDUINO_ARCH_NRF52 || defined ARDUINO_ARCH_NRF52840 || defined ARDUINO_ARCH_NRF52833 || defined ARDUINO_ARCH_NRF5 \
9 || defined NRF52 || defined NRF52_SERIES \
10 || defined NRF52805_XXAA || defined NRF52810_XXAA || defined NRF52811_XXAA || defined NRF52820_XXAA \
11 || defined NRF52832_XXAA || defined NRF52832_XXAB || defined NRF52833_XXAA || defined NRF52840_XXAA
12 #undef USE_LWIP
13 #define USE_LWIP 0
14 #undef RF24ETHERNET_USE_UDP
15 #define RF24ETHERNET_USE_UDP 0
16
17// Initial detection for devices w/CPU >=50MHz
18#elif ((!defined F_CPU || F_CPU >= 45000000) || defined ARDUINO_UNO_Q || defined ARDUINO_ARCH_STM32) && !defined STM32F1xx
19 // Attempt to use internal stack with non-mbed core for RP2040 or RP2350
20 #if (defined ARDUINO_ARCH_RP2040 && !defined ARDUINO_ARCH_MBED) || (defined ARDUINO_ARCH_RP2350 && !defined ARDUINO_ARCH_MBED)
21 #ifndef USE_LWIP
22 #define USE_LWIP 1
23 #endif
24 #ifndef RF24ETHERNET_USE_UDP
25 #define RF24ETHERNET_USE_UDP 1
26 #endif
27 #else
28 // Add boards here that should be specifically excluded from using lwIP stack (use uIP)
29 #if !defined ARDUINO_ARCH_RP2040 && !defined ARDUINO_ARCH_RP2350
30 #ifndef USE_LWIP
31 #define USE_LWIP 1
32 #endif
33 #ifndef RF24ETHERNET_USE_UDP
34 #define RF24ETHERNET_USE_UDP 1
35 #endif
36 #endif
37 #endif
38#endif
39
40/*******************************************************************/
41
42// Set up defines if using lwIP
43#if USE_LWIP == 1
44
45 // Add any boards here that use lwIP internally
46 #if defined ARDUINO_ARCH_ESP32 || defined ARDUINO_ARCH_ESP8266
47 // Use internal IP stack
48 #else
49 // Use External Arduino lwIP stack
50 #define ETHERNET_USING_LWIP_ARDUINO
51 #endif
52
53 // Add boards here that require core locking.
54 #if defined ARDUINO_ARCH_ESP32
55 #if defined CONFIG_LWIP_TCPIP_CORE_LOCKING
56 #define RF24ETHERNET_CORE_REQUIRES_LOCKING
57 #include <WiFi.h>
58 #include "esp_wifi.h"
59 #define ETHERNET_APPLY_LOCK LOCK_TCPIP_CORE
60 #define ETHERNET_REMOVE_LOCK UNLOCK_TCPIP_CORE
61 #endif
62 #endif
63
64 #if (defined ARDUINO_ARCH_RP2040 || defined ARDUINO_ARCH_RP2350) && !defined ARDUINO_ARCH_MBED
65 //#define RF24ETHERNET_CORE_REQUIRES_LOCKING
66 #include <pico/cyw43_arch.h>
67 #define ETHERNET_APPLY_LOCK cyw43_arch_lwip_begin
68 #define ETHERNET_REMOVE_LOCK cyw43_arch_lwip_end
69 #endif
70
71 #if defined ARDUINO_ARCH_ESP8266
72 #define RF24ETHERNET_CORE_REQUIRES_LOCKING
73 #define ETHERNET_APPLY_LOCK() ets_intr_lock()
74 #define ETHERNET_REMOVE_LOCK() ets_intr_unlock()
75 #endif
76
77 #if defined ARDUINO_ARCH_ESP8266
78 #define ETHERNET_TX_BARRIER() __asm__ __volatile__("" ::: "memory")
79 #else
80 #define ETHERNET_TX_BARRIER() __sync_synchronize()
81 #endif
82
83 #include "ethernet_comp.h"
84 #include "RF24Client.h"
85 #include "RF24Server.h"
86 #define HTONS htons
87 #if RF24ETHERNET_USE_UDP > 0
88 #include "RF24Udp.h"
89 #include "Dns.h"
90 #endif
91
92 #if !defined ETHERNET_USING_LWIP_ARDUINO
93 #include "lwip/ip.h"
94 #include "lwip/stats.h"
95 #include "lwip/netif.h"
96 #include "lwip/snmp.h"
97 #include "lwip/timeouts.h"
98 #else
99 #include <lwIP_Arduino.h>
100 #include "lwip/include/lwip/ip.h"
101 #endif
102
103#endif
104
105/*******************************************************************/
106
107#endif // BOARDCONFIG_H