Optimized RF24Network Layer v2.0.0
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
37#if !defined(__AVR_ATtiny85__) && !defined(__AVR_ATtiny84__)
38
39 /********** USER CONFIG - non ATTiny **************/
40
41 //#define ENABLE_SLEEP_MODE //AVR only
43 #define RF24NetworkMulticast
44
45 /* Saves memory by disabling fragmentation */
46 //#define DISABLE_FRAGMENTATION
47
48 /* System defines */
49
57 #ifndef MAX_PAYLOAD_SIZE
58 #if defined linux || defined __linux
59 #define MAX_PAYLOAD_SIZE 1514
60 #else
61 #define MAX_PAYLOAD_SIZE 144
62 #endif
63 #endif // MAX_PAYLOAD_SIZE
64
72 #define MAIN_BUFFER_SIZE (MAX_PAYLOAD_SIZE + FRAME_HEADER_SIZE)
73
74 /* Disable user payloads. Saves memory when used with RF24Ethernet or software that uses external data.*/
75 //#define DISABLE_USER_PAYLOADS
76
77 /* Enable tracking of success and failures for all transmissions, routed and user initiated */
78 //#define ENABLE_NETWORK_STATS
79
80 #ifndef DISABLE_DYNAMIC_PAYLOADS
82 #define ENABLE_DYNAMIC_PAYLOADS
83 #endif // DISABLE_DYNAMIC_PAYLOADS
84
89 #define NUM_PIPES 6
90
91 /* Debug Options */
92 //#define SERIAL_DEBUG
93 //#define SERIAL_DEBUG_MINIMAL
94 //#define SERIAL_DEBUG_ROUTING
95 //#define SERIAL_DEBUG_FRAGMENTATION
96 //#define SERIAL_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#if defined(SERIAL_DEBUG_MINIMAL)
134 #define IF_SERIAL_DEBUG_MINIMAL(x) ({ x; })
135#else
136 #define IF_SERIAL_DEBUG_MINIMAL(x)
137#endif
138
139#if defined(SERIAL_DEBUG_FRAGMENTATION)
140 #define IF_SERIAL_DEBUG_FRAGMENTATION(x) ({ x; })
141#else
142 #define IF_SERIAL_DEBUG_FRAGMENTATION(x)
143#endif
144
145#if defined(SERIAL_DEBUG_FRAGMENTATION_L2)
146 #define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x) ({ x; })
147#else
148 #define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x)
149#endif
150
151#if defined(SERIAL_DEBUG_ROUTING)
152 #define IF_SERIAL_DEBUG_ROUTING(x) ({ x; })
153#else
154 #define IF_SERIAL_DEBUG_ROUTING(x)
155#endif
156
157#endif // RF24_CONFIG_H