ISEN Nimes CSI3 / RF24Network

Dependents:   ISEN_RF24Network_Node_01 ISEN_RF24Network_Node_02

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RF24Network_config.h Source File

RF24Network_config.h

00001 
00002 /*
00003  Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
00004 
00005  This program is free software; you can redistribute it and/or
00006  modify it under the terms of the GNU General Public License
00007  version 2 as published by the Free Software Foundation.
00008  */
00009  
00010  /*
00011  * Mbed support added by Akash Vibhute <akash.roboticist@gmail.com>
00012  * Porting completed on Nov/05/2015
00013  *
00014  * Updated with TMRh20's RF24 library on Nov/04/2015 from https://github.com/TMRh20
00015  *
00016  */
00017 
00018 #ifndef __RF24NETWORK_CONFIG_H__
00019 #define __RF24NETWORK_CONFIG_H__
00020 
00021 #include "mbed.h"
00022 #include <stdint.h>
00023 #include <stdio.h>
00024 #include <string.h>
00025 #define _BV(x) (1<<(x))
00026 
00027 #include <stddef.h>
00028 
00029 
00030 //#define DUAL_HEAD_RADIO
00031 //#define ENABLE_SLEEP_MODE  //AVR only
00032 #define RF24NetworkMulticast
00033 
00034 /** \def
00035  * Saves memory by disabling fragmentation
00036  */
00037 //#define DISABLE_FRAGMENTATION
00038 
00039 /** System defines */
00040 
00041 /** The size of the main buffer. This is the user-cache, where incoming data is stored.
00042  * Data is stored using Frames: Header (8-bytes) + Frame_Size (2-bytes) + Data (?-bytes)
00043  *
00044  * @note The MAX_PAYLOAD_SIZE is (MAIN_BUFFER_SIZE - 10), and the result must be divisible by 24.
00045  */
00046 #define MAIN_BUFFER_SIZE 144 + 10
00047 
00048 /** Maximum size of fragmented network frames and fragmentation cache. This MUST BE divisible by 24.
00049 * @note: Must be a multiple of 24.
00050 * @note: If used with RF24Ethernet, this value is used to set the buffer sizes.
00051 */
00052 #define MAX_PAYLOAD_SIZE  MAIN_BUFFER_SIZE-10
00053 
00054 /** Disable user payloads. Saves memory when used with RF24Ethernet or software that uses external data.*/
00055 //#define DISABLE_USER_PAYLOADS
00056 
00057 /** Enable tracking of success and failures for all transmissions, routed and user initiated */
00058 //#define ENABLE_NETWORK_STATS
00059 
00060 /** Enable dynamic payloads - If using different types of NRF24L01 modules, some may be incompatible when using this feature **/
00061 #define ENABLE_DYNAMIC_PAYLOADS
00062 
00063 /** Debug Options */
00064 //#define SERIAL_DEBUG
00065 //#define SERIAL_DEBUG_MINIMAL
00066 //#define SERIAL_DEBUG_ROUTING
00067 //#define SERIAL_DEBUG_FRAGMENTATION
00068 //#define SERIAL_DEBUG_FRAGMENTATION_L2
00069 /*************************************/
00070 
00071 
00072 #ifndef rf24_max
00073 #define rf24_max(a,b) (a>b?a:b)
00074 #endif
00075 #ifndef rf24_min
00076 #define rf24_min(a,b) (a<b?a:b)
00077 #endif
00078 
00079 
00080 #if defined (SERIAL_DEBUG_MINIMAL)
00081 #define IF_SERIAL_DEBUG_MINIMAL(x) ({x;})
00082 #else
00083 #define IF_SERIAL_DEBUG_MINIMAL(x)
00084 #endif
00085 
00086 #if defined (SERIAL_DEBUG_FRAGMENTATION)
00087 #define IF_SERIAL_DEBUG_FRAGMENTATION(x) ({x;})
00088 #else
00089 #define IF_SERIAL_DEBUG_FRAGMENTATION(x)
00090 #endif
00091 
00092 #if defined (SERIAL_DEBUG_FRAGMENTATION_L2)
00093 #define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x) ({x;})
00094 #else
00095 #define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x)
00096 #endif
00097 
00098 #if defined (SERIAL_DEBUG_ROUTING)
00099 #define IF_SERIAL_DEBUG_ROUTING(x) ({x;})
00100 #else
00101 #define IF_SERIAL_DEBUG_ROUTING(x)
00102 #endif
00103 #endif // RF24_NETWORK_CONFIG_H
00104