Last active
August 29, 2015 14:15
-
-
Save TMRh20/1e67b372aed37e19a4c8 to your computer and use it in GitHub Desktop.
RF24Network_config changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com> | |
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__ | |
#ifdef __cplusplus | |
#if (defined (__linux) || defined (linux)) && !defined (__ARDUINO_X86__) | |
#define RF24_LINUX | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <string.h> | |
#define _BV(x) (1<<(x)) | |
#endif | |
#if defined (ARDUINO) | |
#if ARDUINO < 100 | |
#include <WProgram.h> | |
#else | |
#include <Arduino.h> | |
#endif | |
#endif | |
#include <stddef.h> | |
#endif //cplusplus: Allows RF24Ethernet(uIP) or other c programs to get access to the RF24Network config variables | |
#if !defined(__AVR_ATtiny85__) && !defined(__AVR_ATtiny84__) | |
/********** USER CONFIG - non ATTiny **************/ | |
//#define DUAL_HEAD_RADIO | |
//#define ENABLE_SLEEP_MODE //AVR only | |
#define RF24NetworkMulticast | |
/** Saves memory by disabling fragmentation */ | |
//#define DISABLE_FRAGMENTATION | |
/** System defines */ | |
/** Size of fragmented network frames | |
* | |
* @note: If used with RF24Ethernet, this value should match the uip buffer size (default 120). Different nodes can use different max payload sizes, | |
* but are limited to the smallest of the two when in direct communication. Routing nodes do not need to support fragmentation. | |
* With RF24ethernet, assign in multiples of 24. General minimum is 96 (a 32-byte ping from windows is 74 bytes, (Ethernet Header is 42)) | |
* | |
*/ | |
#define MAX_PAYLOAD_SIZE 144 | |
/** The number of 24-byte payloads RF24Network will automatically buffer for network.read(). | |
* If using fragmentation, this value multiplied by 24 must be larger than the MAX_PAYLOAD_SIZE defined above */ | |
#define NUM_USER_PAYLOADS 5 | |
/** 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 | |
/** 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 DISABLE_FRAGMENTATION | |
//#define MAX_PAYLOAD_SIZE 96 | |
#define NUM_USER_PAYLOADS 3 | |
//#define DISABLE_USER_PAYLOADS | |
#endif | |
/*************************************/ | |
#endif | |
#ifdef __cplusplus | |
#ifndef rf24_max | |
#define rf24_max(a,b) (a>b?a:b) | |
#endif | |
#ifndef rf24_min | |
#define rf24_min(a,b) (a<b?a:b) | |
#endif | |
#ifndef __RF24_CONFIG_H__ | |
#include <RF24_config.h> | |
#endif | |
#if defined (SERIAL_DEBUG) | |
#define IF_SERIAL_DEBUG(x) ({x;}) | |
#else | |
#define IF_SERIAL_DEBUG(x) | |
#if defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny85__) | |
#define printf_P(...) | |
#endif | |
#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 //cplusplus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment