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