RF24Ethernet - TCP/IP over RF24Network v2.0.1
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 #include "ethernet_comp.h"
62 #include "RF24Client.h"
63 #include "RF24Server.h"
64 #define HTONS htons
65 #if RF24ETHERNET_USE_UDP > 0
66 #include "RF24Udp.h"
67 #include "Dns.h"
68 #endif
69
70 #if !defined ETHERNET_USING_LWIP_ARDUINO
71 #include "lwip/ip.h"
72 #include "lwip/stats.h"
73 #include "lwip/netif.h"
74 #include "lwip/snmp.h"
75 #include "lwip/timeouts.h"
76 #else
77 #include <lwIP_Arduino.h>
78 #include "lwip/include/lwip/ip.h"
79 #endif
80
81#endif
82
83/*******************************************************************/
84
85#endif // BOARDCONFIG_H