Optimized RF24Network Layer v2.0.2
2024 - Optimized RF24 Network Layer for NRF24L01 & NRF52x radios
Loading...
Searching...
No Matches
RF24Network_config.h
Go to the documentation of this file.
1
2/*
3 Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 version 2 as published by the Free Software Foundation.
8 */
9
10#ifndef __RF24NETWORK_CONFIG_H__
11#define __RF24NETWORK_CONFIG_H__
12
14#ifndef NETWORK_DEFAULT_ADDRESS
15 #define NETWORK_DEFAULT_ADDRESS 04444
16#endif // NETWORK_DEFAULT_ADDRESS
17
19#define NETWORK_MULTICAST_ADDRESS 0100
20
22#define NETWORK_AUTO_ROUTING 070
23
24#ifdef DOXYGEN_FORCED
34 #define SLOW_ADDR_POLL_RESPONSE 10
35#endif // defined DOXYGEN_FORCED
36
41#define NUM_PIPES 6
42
43#if !defined(__AVR_ATtiny85__) && !defined(__AVR_ATtiny84__)
44
45 /********** USER CONFIG - non ATTiny **************/
46
47 //#define ENABLE_SLEEP_MODE //AVR only
49 #define RF24NetworkMulticast
50
51 /* Saves memory by disabling fragmentation */
52 //#define DISABLE_FRAGMENTATION
53
54 /* System defines */
55
63 #ifndef MAX_PAYLOAD_SIZE
64 #if defined linux || defined __linux
65 #define MAX_PAYLOAD_SIZE 1514
66 #else
67 #define MAX_PAYLOAD_SIZE 144
68 #endif
69 #endif // MAX_PAYLOAD_SIZE
70
78 #define MAIN_BUFFER_SIZE (MAX_PAYLOAD_SIZE + FRAME_HEADER_SIZE)
79
80 /* Disable user payloads. Saves memory when used with RF24Ethernet or software that uses external data.*/
81 //#define DISABLE_USER_PAYLOADS
82
83 /* Enable tracking of success and failures for all transmissions, routed and user initiated */
84 //#define ENABLE_NETWORK_STATS
85
86 #ifndef DISABLE_DYNAMIC_PAYLOADS
88 #define ENABLE_DYNAMIC_PAYLOADS
89 #endif // DISABLE_DYNAMIC_PAYLOADS
90
91 /* Debug Options */
92 //#define RF24NETWORK_DEBUG
93 //#define RF24NETWORK_DEBUG_MINIMAL
94 //#define RF24NETWORK_DEBUG_ROUTING
95 //#define RF24NETWORK_DEBUG_FRAGMENTATION
96 //#define RF24NETWORK_DEBUG_FRAGMENTATION_L2
97 /*************************************/
98
99#else // Different set of defaults for ATTiny - fragmentation is disabled and user payloads are set to 3 max
100 /********** USER CONFIG - ATTiny **************/
101 //#define ENABLE_SLEEP_MODE //AVR only
102 #define RF24NetworkMulticast
103 // NOTE: Only 24 bytes of a payload are used when DISABLE_FRAGMENTATION is defined
104 #define MAX_PAYLOAD_SIZE 72
105 #define MAIN_BUFFER_SIZE (MAX_PAYLOAD_SIZE + FRAME_HEADER_SIZE)
106 #define DISABLE_FRAGMENTATION
107 #define ENABLE_DYNAMIC_PAYLOADS
108 //#define DISABLE_USER_PAYLOADS
109#endif
110/*************************************/
111
112#endif // RF24_NETWORK_CONFIG_H
113
114#ifdef __cplusplus
115
116#if (defined(__linux) || defined(linux)) && !defined(__ARDUINO_X86__) && !defined(USE_RF24_LIB_SRC)
117 #include <RF24/RF24_config.h>
118
119// ATXMega
120#elif defined(XMEGA)
121 #include "../../rf24lib/rf24lib/RF24_config.h"
122#else
123 #include <RF24_config.h>
124#endif
125
126#if !defined(ARDUINO_ARCH_AVR)
127 // sprintf is used by RF24NetworkHeader::toString
128 #ifndef sprintf_P
129 #define sprintf_P sprintf
130 #endif
131#endif
132
133#ifdef RF24NETWORK_DEBUG
134 #define IF_RF24NETWORK_DEBUG(x) ({ x; })
135#else
136 #define IF_RF24NETWORK_DEBUG(x)
137#endif
138#if defined(RF24NETWORK_DEBUG_MINIMAL)
139 #define IF_RF24NETWORK_DEBUG_MINIMAL(x) ({ x; })
140#else
141 #define IF_RF24NETWORK_DEBUG_MINIMAL(x)
142#endif
143
144#if defined(RF24NETWORK_DEBUG_FRAGMENTATION)
145 #define IF_RF24NETWORK_DEBUG_FRAGMENTATION(x) ({ x; })
146#else
147 #define IF_RF24NETWORK_DEBUG_FRAGMENTATION(x)
148#endif
149
150#if defined(RF24NETWORK_DEBUG_FRAGMENTATION_L2)
151 #define IF_RF24NETWORK_DEBUG_FRAGMENTATION_L2(x) ({ x; })
152#else
153 #define IF_RF24NETWORK_DEBUG_FRAGMENTATION_L2(x)
154#endif
155
156#if defined(RF24NETWORK_DEBUG_ROUTING)
157 #define IF_RF24NETWORK_DEBUG_ROUTING(x) ({ x; })
158#else
159 #define IF_RF24NETWORK_DEBUG_ROUTING(x)
160#endif
161
162#endif // RF24_CONFIG_H