RF24Ethernet - TCP/IP over RF24Network v2.1.0
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// Initial detection for devices w/CPU >=50MHz
8#if (!defined F_CPU || F_CPU >= 50000000)
9 // Attempt to use internal stack with non-mbed core for RP2040 or RP2350
10 #if (defined ARDUINO_ARCH_RP2040 && !defined ARDUINO_ARCH_MBED) || (defined ARDUINO_ARCH_RP2350 && !defined ARDUINO_ARCH_MBED)
11 #ifndef USE_LWIP
12 #define USE_LWIP 1
13 #endif
14 #ifndef RF24ETHERNET_USE_UDP
15 #define RF24ETHERNET_USE_UDP 1
16 #endif
17 #else
18 // Add boards here that should be specifically excluded from using lwIP stack (use uIP)
19 #if !defined ARDUINO_ARCH_RP2040 && !defined ARDUINO_ARCH_RP2350
20 #ifndef USE_LWIP
21 #define USE_LWIP 1
22 #endif
23 #ifndef RF24ETHERNET_USE_UDP
24 #define RF24ETHERNET_USE_UDP 1
25 #endif
26 #endif
27 #endif
28#endif
29
30/*******************************************************************/
31
32// Set up defines if using lwIP
33#if USE_LWIP > 0
34
35 // Add any boards here that use lwIP internally
36 #if defined ARDUINO_ARCH_ESP32 || defined ARDUINO_ARCH_ESP8266
37 // Use internal IP stack
38 #else
39 // Use External Arduino lwIP stack
40 #define ETHERNET_USING_LWIP_ARDUINO
41 #endif
42
43 // Add boards here that require core locking.
44 #if defined ARDUINO_ARCH_ESP32
45 #if defined CONFIG_LWIP_TCPIP_CORE_LOCKING
46 #define RF24ETHERNET_CORE_REQUIRES_LOCKING
47 #include <WiFi.h>
48 #include "esp_wifi.h"
49 #define ETHERNET_APPLY_LOCK LOCK_TCPIP_CORE
50 #define ETHERNET_REMOVE_LOCK UNLOCK_TCPIP_CORE
51 #endif
52 #endif
53
54 #if (defined ARDUINO_ARCH_RP2040 || defined ARDUINO_ARCH_RP2350) && !defined ARDUINO_ARCH_MBED
55 //#define RF24ETHERNET_CORE_REQUIRES_LOCKING
56 #include <pico/cyw43_arch.h>
57 #define ETHERNET_APPLY_LOCK cyw43_arch_lwip_begin
58 #define ETHERNET_REMOVE_LOCK cyw43_arch_lwip_end
59 #endif
60
61 #if defined ARDUINO_ARCH_ESP8266
62 #define RF24ETHERNET_CORE_REQUIRES_LOCKING
63 #define ETHERNET_APPLY_LOCK() ets_intr_lock()
64 #define ETHERNET_REMOVE_LOCK() ets_intr_unlock()
65 #endif
66
67 #include "ethernet_comp.h"
68 #include "RF24Client.h"
69 #include "RF24Server.h"
70 #define HTONS htons
71 #if RF24ETHERNET_USE_UDP > 0
72 #include "RF24Udp.h"
73 #include "Dns.h"
74 #endif
75
76 #if !defined ETHERNET_USING_LWIP_ARDUINO
77 #include "lwip/ip.h"
78 #include "lwip/stats.h"
79 #include "lwip/netif.h"
80 #include "lwip/snmp.h"
81 #include "lwip/timeouts.h"
82 #else
83 #include <lwIP_Arduino.h>
84 #include "lwip/include/lwip/ip.h"
85 #endif
86
87#endif
88
89/*******************************************************************/
90
91#endif // BOARDCONFIG_H