Maniacbug's RF24 arduino library ported to mbed. Tested, it works for Nucleo F411

Dependents:   RF24Network_Send RF24Network_Receive maple_chotobot_rf_motores Thesis_Verzender ... more

Committer:
akashvibhute
Date:
Thu Apr 21 04:10:31 2016 +0000
Revision:
5:b1110d26a900
Parent:
4:75c5aa56411f
Library re-ported with all the latest and greatest stuff from Manicbug; Synced with TMRh20's RF24 library on Apr/18/2015 from https://github.com/TMRh20

Who changed what in which revision?

UserRevisionLine numberNew 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 4:75c5aa56411f 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 4:75c5aa56411f 14 * Updated 1: Synced with TMRh20's RF24 library on Nov/04/2015 from https://github.com/TMRh20
akashvibhute 4:75c5aa56411f 15 * Updated 2: Synced with TMRh20's RF24 library on Apr/18/2015 from https://github.com/TMRh20
akashvibhute 3:dfc8da7ac18c 16 *
akashvibhute 3:dfc8da7ac18c 17 */
akashvibhute 4:75c5aa56411f 18
akashvibhute 5:b1110d26a900 19
akashvibhute 2:a5f8e04bd02b 20 #ifndef __RF24NETWORK_CONFIG_H__
akashvibhute 2:a5f8e04bd02b 21 #define __RF24NETWORK_CONFIG_H__
akashvibhute 0:c3db0798d9aa 22
akashvibhute 4:75c5aa56411f 23 /********** USER CONFIG **************/
akashvibhute 4:75c5aa56411f 24
akashvibhute 4:75c5aa56411f 25 //#define DUAL_HEAD_RADIO
akashvibhute 4:75c5aa56411f 26 //#define ENABLE_SLEEP_MODE //AVR only
akashvibhute 4:75c5aa56411f 27 #define RF24NetworkMulticast
akashvibhute 4:75c5aa56411f 28
akashvibhute 4:75c5aa56411f 29 /** \def
akashvibhute 4:75c5aa56411f 30 * Saves memory by disabling fragmentation
akashvibhute 4:75c5aa56411f 31 */
akashvibhute 4:75c5aa56411f 32 //#define DISABLE_FRAGMENTATION
akashvibhute 4:75c5aa56411f 33
akashvibhute 4:75c5aa56411f 34 /** System defines */
akashvibhute 4:75c5aa56411f 35
akashvibhute 4:75c5aa56411f 36 /** The size of the main buffer. This is the user-cache, where incoming data is stored.
akashvibhute 4:75c5aa56411f 37 * Data is stored using Frames: Header (8-bytes) + Frame_Size (2-bytes) + Data (?-bytes)
akashvibhute 4:75c5aa56411f 38 *
akashvibhute 4:75c5aa56411f 39 * @note The MAX_PAYLOAD_SIZE is (MAIN_BUFFER_SIZE - 10), and the result must be divisible by 24.
akashvibhute 4:75c5aa56411f 40 */
akashvibhute 4:75c5aa56411f 41 #define MAIN_BUFFER_SIZE 144 + 10
akashvibhute 4:75c5aa56411f 42
akashvibhute 4:75c5aa56411f 43 /** Maximum size of fragmented network frames and fragmentation cache. This MUST BE divisible by 24.
akashvibhute 4:75c5aa56411f 44 * @note: Must be a multiple of 24.
akashvibhute 4:75c5aa56411f 45 * @note: If used with RF24Ethernet, this value is used to set the buffer sizes.
akashvibhute 4:75c5aa56411f 46 */
akashvibhute 4:75c5aa56411f 47 #define MAX_PAYLOAD_SIZE MAIN_BUFFER_SIZE-10
akashvibhute 4:75c5aa56411f 48
akashvibhute 4:75c5aa56411f 49 /** Disable user payloads. Saves memory when used with RF24Ethernet or software that uses external data.*/
akashvibhute 4:75c5aa56411f 50 //#define DISABLE_USER_PAYLOADS
akashvibhute 4:75c5aa56411f 51
akashvibhute 4:75c5aa56411f 52 /** Enable tracking of success and failures for all transmissions, routed and user initiated */
akashvibhute 4:75c5aa56411f 53 //#define ENABLE_NETWORK_STATS
akashvibhute 4:75c5aa56411f 54
akashvibhute 4:75c5aa56411f 55 /** Enable dynamic payloads - If using different types of NRF24L01 modules, some may be incompatible when using this feature **/
akashvibhute 4:75c5aa56411f 56 #define ENABLE_DYNAMIC_PAYLOADS
akashvibhute 0:c3db0798d9aa 57
akashvibhute 4:75c5aa56411f 58 /** Debug Options */
akashvibhute 4:75c5aa56411f 59 //#define SERIAL_DEBUG
akashvibhute 4:75c5aa56411f 60 //#define SERIAL_DEBUG_MINIMAL
akashvibhute 4:75c5aa56411f 61 //#define SERIAL_DEBUG_ROUTING
akashvibhute 4:75c5aa56411f 62 //#define SERIAL_DEBUG_FRAGMENTATION
akashvibhute 4:75c5aa56411f 63 //#define SERIAL_DEBUG_FRAGMENTATION_L2
akashvibhute 4:75c5aa56411f 64 /*************************************/
akashvibhute 4:75c5aa56411f 65
akashvibhute 4:75c5aa56411f 66 #endif //RF24_NETWORK_CONFIG_H
akashvibhute 4:75c5aa56411f 67
akashvibhute 4:75c5aa56411f 68 #include <RF24_config.h>
akashvibhute 4:75c5aa56411f 69
akashvibhute 4:75c5aa56411f 70 #define sprintf_P sprintf
akashvibhute 4:75c5aa56411f 71
akashvibhute 4:75c5aa56411f 72 #if defined (SERIAL_DEBUG_MINIMAL)
akashvibhute 4:75c5aa56411f 73 #define IF_SERIAL_DEBUG_MINIMAL(x) ({x;})
akashvibhute 4:75c5aa56411f 74 #else
akashvibhute 4:75c5aa56411f 75 #define IF_SERIAL_DEBUG_MINIMAL(x)
akashvibhute 4:75c5aa56411f 76 #endif
akashvibhute 4:75c5aa56411f 77
akashvibhute 4:75c5aa56411f 78 #if defined (SERIAL_DEBUG_FRAGMENTATION)
akashvibhute 4:75c5aa56411f 79 #define IF_SERIAL_DEBUG_FRAGMENTATION(x) ({x;})
akashvibhute 4:75c5aa56411f 80 #else
akashvibhute 4:75c5aa56411f 81 #define IF_SERIAL_DEBUG_FRAGMENTATION(x)
akashvibhute 4:75c5aa56411f 82 #endif
akashvibhute 4:75c5aa56411f 83
akashvibhute 4:75c5aa56411f 84 #if defined (SERIAL_DEBUG_FRAGMENTATION_L2)
akashvibhute 4:75c5aa56411f 85 #define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x) ({x;})
akashvibhute 4:75c5aa56411f 86 #else
akashvibhute 4:75c5aa56411f 87 #define IF_SERIAL_DEBUG_FRAGMENTATION_L2(x)
akashvibhute 4:75c5aa56411f 88 #endif
akashvibhute 4:75c5aa56411f 89
akashvibhute 4:75c5aa56411f 90 #if defined (SERIAL_DEBUG_ROUTING)
akashvibhute 4:75c5aa56411f 91 #define IF_SERIAL_DEBUG_ROUTING(x) ({x;})
akashvibhute 4:75c5aa56411f 92 #else
akashvibhute 4:75c5aa56411f 93 #define IF_SERIAL_DEBUG_ROUTING(x)
akashvibhute 4:75c5aa56411f 94 #endif
akashvibhute 2:a5f8e04bd02b 95
akashvibhute 2:a5f8e04bd02b 96
akashvibhute 2:a5f8e04bd02b 97
akashvibhute 2:a5f8e04bd02b 98