Newly Optimized RF24Network Layer v2.0.0
2020 - Optimized RF24 Network Layer for NRF24L01 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
85 /* Debug Options */
86 //#define SERIAL_DEBUG
87 //#define SERIAL_DEBUG_MINIMAL
88 //#define SERIAL_DEBUG_ROUTING
89 //#define SERIAL_DEBUG_FRAGMENTATION
90 //#define SERIAL_DEBUG_FRAGMENTATION_L2
91 /*************************************/
92
93#else // Different set of defaults for ATTiny - fragmentation is disabled and user payloads are set to 3 max
94 /********** USER CONFIG - ATTiny **************/
95 //#define ENABLE_SLEEP_MODE //AVR only
96 #define RF24NetworkMulticast
97 // NOTE: Only 24 bytes of a payload are used when DISABLE_FRAGMENTATION is defined
98 #define MAX_PAYLOAD_SIZE 72
99 #define MAIN_BUFFER_SIZE (MAX_PAYLOAD_SIZE + FRAME_HEADER_SIZE)
100 #define DISABLE_FRAGMENTATION
101 #define ENABLE_DYNAMIC_PAYLOADS
102 //#define DISABLE_USER_PAYLOADS
103#endif
104/*************************************/
105
106#endif // RF24_NETWORK_CONFIG_H
107
108#ifdef __cplusplus
109
110#if (defined(__linux) || defined(linux)) && !defined(__ARDUINO_X86__) && !defined(USE_RF24_LIB_SRC)
111 #include <RF24/RF24_config.h>
112
113// ATXMega
114#elif defined(XMEGA)
115 #include "../../rf24lib/rf24lib/RF24_config.h"
116#else
117 #include <RF24_config.h>
118#endif
119
120#if !defined(ARDUINO_ARCH_AVR)
121 // sprintf is used by RF24NetworkHeader::toString
122 #ifndef sprintf_P
123 #define sprintf_P sprintf
124 #endif
125#endif
126
127#if defined(SERIAL_DEBUG_MINIMAL)
128 #define IF_SERIAL_DEBUG_MINIMAL(x) ({ x; })
129#else
130 #define IF_SERIAL_DEBUG_MINIMAL(x)
131#endif
132
133#if defined(SERIAL_DEBUG_FRAGMENTATION)
134 #define IF_SERIAL_DEBUG_FRAGMENTATION(x) ({ x; })
135#else
136 #define IF_SERIAL_DEBUG_FRAGMENTATION(x)
137#endif
138
139#if defined(SERIAL_DEBUG_FRAGMENTATION_L2)
140 #define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x) ({ x; })
141#else
142 #define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x)
143#endif
144
145#if defined(SERIAL_DEBUG_ROUTING)
146 #define IF_SERIAL_DEBUG_ROUTING(x) ({ x; })
147#else
148 #define IF_SERIAL_DEBUG_ROUTING(x)
149#endif
150
151#endif // RF24_CONFIG_H