forked from nRF24/RF24Network
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RF24Network_config.h
117 lines (89 loc) · 3.55 KB
/
RF24Network_config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
Copyright (C) 2011 James Coliz, Jr. <[email protected]>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
*/
#ifndef __RF24NETWORK_CONFIG_H__
#define __RF24NETWORK_CONFIG_H__
#if !defined(__AVR_ATtiny85__) && !defined(__AVR_ATtiny84__)
/********** USER CONFIG - non ATTiny **************/
//#define DUAL_HEAD_RADIO
//#define ENABLE_SLEEP_MODE //AVR only
#define RF24NetworkMulticast
/** \def
* Saves memory by disabling fragmentation
*/
//#define DISABLE_FRAGMENTATION
/** System defines */
/** The size of the main buffer. This is the user-cache, where incoming data is stored.
* Data is stored using Frames: Header (8-bytes) + Frame_Size (2-bytes) + Data (?-bytes)
*
* @note The MAX_PAYLOAD_SIZE is (MAIN_BUFFER_SIZE - 10), and the result must be divisible by 24.
*/
#define MAIN_BUFFER_SIZE 144 + 10
/** Maximum size of fragmented network frames and fragmentation cache. This MUST BE divisible by 24.
* @note: Must be a multiple of 24.
* @note: If used with RF24Ethernet, this value is used to set the buffer sizes.
*/
#define MAX_PAYLOAD_SIZE MAIN_BUFFER_SIZE-10
/** Disable user payloads. Saves memory when used with RF24Ethernet or software that uses external data.*/
//#define DISABLE_USER_PAYLOADS
/** Enable tracking of success and failures for all transmissions, routed and user initiated */
//#define ENABLE_NETWORK_STATS
/** Enable dynamic payloads - If using different types of NRF24L01 modules, some may be incompatible when using this feature **/
#define ENABLE_DYNAMIC_PAYLOADS
/** Debug Options */
//#define SERIAL_DEBUG
//#define SERIAL_DEBUG_MINIMAL
//#define SERIAL_DEBUG_ROUTING
//#define SERIAL_DEBUG_FRAGMENTATION
//#define SERIAL_DEBUG_FRAGMENTATION_L2
/*************************************/
#else // Different set of defaults for ATTiny - fragmentation is disabled and user payloads are set to 3 max
/********** USER CONFIG - ATTiny **************/
//#define DUAL_HEAD_RADIO
//#define ENABLE_SLEEP_MODE //AVR only
#define RF24NetworkMulticast
#define MAIN_BUFFER_SIZE 96 + 10
#define DISABLE_FRAGMENTATION
// Enable MAX PAYLOAD SIZE if enabling fragmentation
//#define MAX_PAYLOAD_SIZE MAIN_BUFFER_SIZE-10
#define ENABLE_DYNAMIC_PAYLOADS
//#define DISABLE_USER_PAYLOADS
#endif
/*************************************/
#endif //RF24_NETWORK_CONFIG_H
#ifdef __cplusplus
#if (defined (__linux) || defined (linux)) && !defined (__ARDUINO_X86__)
#include <RF24/RF24_config.h>
//ATXMega
#elif defined(XMEGA)
#include "../../rf24lib/rf24lib/RF24_config.h"
#else
#include <RF24_config.h>
#endif
#if !defined (ARDUINO_ARCH_AVR)
#define sprintf_P sprintf
#endif
#if defined (SERIAL_DEBUG_MINIMAL)
#define IF_SERIAL_DEBUG_MINIMAL(x) ({x;})
#else
#define IF_SERIAL_DEBUG_MINIMAL(x)
#endif
#if defined (SERIAL_DEBUG_FRAGMENTATION)
#define IF_SERIAL_DEBUG_FRAGMENTATION(x) ({x;})
#else
#define IF_SERIAL_DEBUG_FRAGMENTATION(x)
#endif
#if defined (SERIAL_DEBUG_FRAGMENTATION_L2)
#define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x) ({x;})
#else
#define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x)
#endif
#if defined (SERIAL_DEBUG_ROUTING)
#define IF_SERIAL_DEBUG_ROUTING(x) ({x;})
#else
#define IF_SERIAL_DEBUG_ROUTING(x)
#endif
#endif //RF24_CONFIG_H