RF24Network
RF24Network_config.h@3:dfc8da7ac18c, 2015-11-05 (annotated)
- Committer:
- akashvibhute
- Date:
- Thu Nov 05 05:54:47 2015 +0000
- Revision:
- 3:dfc8da7ac18c
- Parent:
- 2:a5f8e04bd02b
- Child:
- 4:75c5aa56411f
general code cleanup after updating library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashvibhute | 0:c3db0798d9aa | 1 | |
akashvibhute | 0:c3db0798d9aa | 2 | /* |
akashvibhute | 0:c3db0798d9aa | 3 | Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com> |
akashvibhute | 0:c3db0798d9aa | 4 | |
akashvibhute | 0:c3db0798d9aa | 5 | This program is free software; you can redistribute it and/or |
akashvibhute | 0:c3db0798d9aa | 6 | modify it under the terms of the GNU General Public License |
akashvibhute | 0:c3db0798d9aa | 7 | version 2 as published by the Free Software Foundation. |
akashvibhute | 0:c3db0798d9aa | 8 | */ |
akashvibhute | 3:dfc8da7ac18c | 9 | |
akashvibhute | 3:dfc8da7ac18c | 10 | /* |
akashvibhute | 3:dfc8da7ac18c | 11 | * Mbed support added by Akash Vibhute <akash.roboticist@gmail.com> |
akashvibhute | 3:dfc8da7ac18c | 12 | * Porting completed on Nov/05/2015 |
akashvibhute | 3:dfc8da7ac18c | 13 | * |
akashvibhute | 3:dfc8da7ac18c | 14 | * Updated with TMRh20's RF24 library on Nov/04/2015 from https://github.com/TMRh20 |
akashvibhute | 3:dfc8da7ac18c | 15 | * |
akashvibhute | 3:dfc8da7ac18c | 16 | */ |
akashvibhute | 0:c3db0798d9aa | 17 | |
akashvibhute | 2:a5f8e04bd02b | 18 | #ifndef __RF24NETWORK_CONFIG_H__ |
akashvibhute | 2:a5f8e04bd02b | 19 | #define __RF24NETWORK_CONFIG_H__ |
akashvibhute | 0:c3db0798d9aa | 20 | |
akashvibhute | 0:c3db0798d9aa | 21 | #include "mbed.h" |
akashvibhute | 0:c3db0798d9aa | 22 | #include <stdint.h> |
akashvibhute | 0:c3db0798d9aa | 23 | #include <stdio.h> |
akashvibhute | 0:c3db0798d9aa | 24 | #include <string.h> |
akashvibhute | 0:c3db0798d9aa | 25 | #define _BV(x) (1<<(x)) |
akashvibhute | 0:c3db0798d9aa | 26 | |
akashvibhute | 2:a5f8e04bd02b | 27 | #include <stddef.h> |
akashvibhute | 2:a5f8e04bd02b | 28 | |
akashvibhute | 2:a5f8e04bd02b | 29 | |
akashvibhute | 2:a5f8e04bd02b | 30 | //#define DUAL_HEAD_RADIO |
akashvibhute | 2:a5f8e04bd02b | 31 | //#define ENABLE_SLEEP_MODE //AVR only |
akashvibhute | 2:a5f8e04bd02b | 32 | #define RF24NetworkMulticast |
akashvibhute | 2:a5f8e04bd02b | 33 | |
akashvibhute | 2:a5f8e04bd02b | 34 | /** \def |
akashvibhute | 2:a5f8e04bd02b | 35 | * Saves memory by disabling fragmentation |
akashvibhute | 2:a5f8e04bd02b | 36 | */ |
akashvibhute | 2:a5f8e04bd02b | 37 | //#define DISABLE_FRAGMENTATION |
akashvibhute | 2:a5f8e04bd02b | 38 | |
akashvibhute | 2:a5f8e04bd02b | 39 | /** System defines */ |
akashvibhute | 2:a5f8e04bd02b | 40 | |
akashvibhute | 2:a5f8e04bd02b | 41 | /** The size of the main buffer. This is the user-cache, where incoming data is stored. |
akashvibhute | 2:a5f8e04bd02b | 42 | * Data is stored using Frames: Header (8-bytes) + Frame_Size (2-bytes) + Data (?-bytes) |
akashvibhute | 2:a5f8e04bd02b | 43 | * |
akashvibhute | 2:a5f8e04bd02b | 44 | * @note The MAX_PAYLOAD_SIZE is (MAIN_BUFFER_SIZE - 10), and the result must be divisible by 24. |
akashvibhute | 2:a5f8e04bd02b | 45 | */ |
akashvibhute | 2:a5f8e04bd02b | 46 | #define MAIN_BUFFER_SIZE 144 + 10 |
akashvibhute | 2:a5f8e04bd02b | 47 | |
akashvibhute | 2:a5f8e04bd02b | 48 | /** Maximum size of fragmented network frames and fragmentation cache. This MUST BE divisible by 24. |
akashvibhute | 2:a5f8e04bd02b | 49 | * @note: Must be a multiple of 24. |
akashvibhute | 2:a5f8e04bd02b | 50 | * @note: If used with RF24Ethernet, this value is used to set the buffer sizes. |
akashvibhute | 2:a5f8e04bd02b | 51 | */ |
akashvibhute | 2:a5f8e04bd02b | 52 | #define MAX_PAYLOAD_SIZE MAIN_BUFFER_SIZE-10 |
akashvibhute | 2:a5f8e04bd02b | 53 | |
akashvibhute | 2:a5f8e04bd02b | 54 | /** Disable user payloads. Saves memory when used with RF24Ethernet or software that uses external data.*/ |
akashvibhute | 2:a5f8e04bd02b | 55 | //#define DISABLE_USER_PAYLOADS |
akashvibhute | 2:a5f8e04bd02b | 56 | |
akashvibhute | 2:a5f8e04bd02b | 57 | /** Enable tracking of success and failures for all transmissions, routed and user initiated */ |
akashvibhute | 2:a5f8e04bd02b | 58 | //#define ENABLE_NETWORK_STATS |
akashvibhute | 2:a5f8e04bd02b | 59 | |
akashvibhute | 2:a5f8e04bd02b | 60 | /** Enable dynamic payloads - If using different types of NRF24L01 modules, some may be incompatible when using this feature **/ |
akashvibhute | 2:a5f8e04bd02b | 61 | #define ENABLE_DYNAMIC_PAYLOADS |
akashvibhute | 2:a5f8e04bd02b | 62 | |
akashvibhute | 2:a5f8e04bd02b | 63 | /** Debug Options */ |
akashvibhute | 2:a5f8e04bd02b | 64 | //#define SERIAL_DEBUG |
akashvibhute | 2:a5f8e04bd02b | 65 | //#define SERIAL_DEBUG_MINIMAL |
akashvibhute | 2:a5f8e04bd02b | 66 | //#define SERIAL_DEBUG_ROUTING |
akashvibhute | 2:a5f8e04bd02b | 67 | //#define SERIAL_DEBUG_FRAGMENTATION |
akashvibhute | 2:a5f8e04bd02b | 68 | //#define SERIAL_DEBUG_FRAGMENTATION_L2 |
akashvibhute | 2:a5f8e04bd02b | 69 | /*************************************/ |
akashvibhute | 2:a5f8e04bd02b | 70 | |
akashvibhute | 2:a5f8e04bd02b | 71 | |
akashvibhute | 2:a5f8e04bd02b | 72 | #ifndef rf24_max |
akashvibhute | 2:a5f8e04bd02b | 73 | #define rf24_max(a,b) (a>b?a:b) |
akashvibhute | 2:a5f8e04bd02b | 74 | #endif |
akashvibhute | 2:a5f8e04bd02b | 75 | #ifndef rf24_min |
akashvibhute | 2:a5f8e04bd02b | 76 | #define rf24_min(a,b) (a<b?a:b) |
akashvibhute | 2:a5f8e04bd02b | 77 | #endif |
akashvibhute | 2:a5f8e04bd02b | 78 | |
akashvibhute | 2:a5f8e04bd02b | 79 | |
akashvibhute | 2:a5f8e04bd02b | 80 | #if defined (SERIAL_DEBUG_MINIMAL) |
akashvibhute | 2:a5f8e04bd02b | 81 | #define IF_SERIAL_DEBUG_MINIMAL(x) ({x;}) |
akashvibhute | 2:a5f8e04bd02b | 82 | #else |
akashvibhute | 2:a5f8e04bd02b | 83 | #define IF_SERIAL_DEBUG_MINIMAL(x) |
akashvibhute | 2:a5f8e04bd02b | 84 | #endif |
akashvibhute | 2:a5f8e04bd02b | 85 | |
akashvibhute | 2:a5f8e04bd02b | 86 | #if defined (SERIAL_DEBUG_FRAGMENTATION) |
akashvibhute | 2:a5f8e04bd02b | 87 | #define IF_SERIAL_DEBUG_FRAGMENTATION(x) ({x;}) |
akashvibhute | 2:a5f8e04bd02b | 88 | #else |
akashvibhute | 2:a5f8e04bd02b | 89 | #define IF_SERIAL_DEBUG_FRAGMENTATION(x) |
akashvibhute | 2:a5f8e04bd02b | 90 | #endif |
akashvibhute | 2:a5f8e04bd02b | 91 | |
akashvibhute | 2:a5f8e04bd02b | 92 | #if defined (SERIAL_DEBUG_FRAGMENTATION_L2) |
akashvibhute | 2:a5f8e04bd02b | 93 | #define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x) ({x;}) |
akashvibhute | 2:a5f8e04bd02b | 94 | #else |
akashvibhute | 2:a5f8e04bd02b | 95 | #define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x) |
akashvibhute | 2:a5f8e04bd02b | 96 | #endif |
akashvibhute | 2:a5f8e04bd02b | 97 | |
akashvibhute | 2:a5f8e04bd02b | 98 | #if defined (SERIAL_DEBUG_ROUTING) |
akashvibhute | 2:a5f8e04bd02b | 99 | #define IF_SERIAL_DEBUG_ROUTING(x) ({x;}) |
akashvibhute | 2:a5f8e04bd02b | 100 | #else |
akashvibhute | 2:a5f8e04bd02b | 101 | #define IF_SERIAL_DEBUG_ROUTING(x) |
akashvibhute | 2:a5f8e04bd02b | 102 | #endif |
akashvibhute | 2:a5f8e04bd02b | 103 | #endif // RF24_NETWORK_CONFIG_H |
akashvibhute | 2:a5f8e04bd02b | 104 |