Port of Maniacbug's Arduino RF24 library to mbed.

Dependents:   STM32F407VET6_nRF24L01_Master STM32F407VET6_nRF24L01_Slave Main_ntp_sd_nrf IRC_MASTER

Committer:
hudakz
Date:
Fri Jan 25 14:01:33 2019 +0000
Revision:
1:d96c2056bf37
Parent:
0:2007da485383
Modified begin()

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hudakz 0:2007da485383 1 /*
hudakz 0:2007da485383 2 Copyright (c) 2007 Stefan Engelke <mbox@stefanengelke.de>
hudakz 0:2007da485383 3
hudakz 0:2007da485383 4 Permission is hereby granted, free of charge, to any person
hudakz 0:2007da485383 5 obtaining a copy of this software and associated documentation
hudakz 0:2007da485383 6 files (the "Software"), to deal in the Software without
hudakz 0:2007da485383 7 restriction, including without limitation the rights to use, copy,
hudakz 0:2007da485383 8 modify, merge, publish, distribute, sublicense, and/or sell copies
hudakz 0:2007da485383 9 of the Software, and to permit persons to whom the Software is
hudakz 0:2007da485383 10 furnished to do so, subject to the following conditions:
hudakz 0:2007da485383 11
hudakz 0:2007da485383 12 The above copyright notice and this permission notice shall be
hudakz 0:2007da485383 13 included in all copies or substantial portions of the Software.
hudakz 0:2007da485383 14
hudakz 0:2007da485383 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
hudakz 0:2007da485383 16 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
hudakz 0:2007da485383 17 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
hudakz 0:2007da485383 18 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
hudakz 0:2007da485383 19 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
hudakz 0:2007da485383 20 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
hudakz 0:2007da485383 21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
hudakz 0:2007da485383 22 DEALINGS IN THE SOFTWARE.
hudakz 0:2007da485383 23 */
hudakz 0:2007da485383 24
hudakz 0:2007da485383 25 /* Memory Map */
hudakz 0:2007da485383 26 #define CONFIG 0x00
hudakz 0:2007da485383 27 #define EN_AA 0x01
hudakz 0:2007da485383 28 #define EN_RXADDR 0x02
hudakz 0:2007da485383 29 #define SETUP_AW 0x03
hudakz 0:2007da485383 30 #define SETUP_RETR 0x04
hudakz 0:2007da485383 31 #define RF_CH 0x05
hudakz 0:2007da485383 32 #define RF_SETUP 0x06
hudakz 0:2007da485383 33 #define STATUS 0x07
hudakz 0:2007da485383 34 #define OBSERVE_TX 0x08
hudakz 0:2007da485383 35 #define CD 0x09
hudakz 0:2007da485383 36 #define RX_ADDR_P0 0x0A
hudakz 0:2007da485383 37 #define RX_ADDR_P1 0x0B
hudakz 0:2007da485383 38 #define RX_ADDR_P2 0x0C
hudakz 0:2007da485383 39 #define RX_ADDR_P3 0x0D
hudakz 0:2007da485383 40 #define RX_ADDR_P4 0x0E
hudakz 0:2007da485383 41 #define RX_ADDR_P5 0x0F
hudakz 0:2007da485383 42 #define TX_ADDR 0x10
hudakz 0:2007da485383 43 #define RX_PW_P0 0x11
hudakz 0:2007da485383 44 #define RX_PW_P1 0x12
hudakz 0:2007da485383 45 #define RX_PW_P2 0x13
hudakz 0:2007da485383 46 #define RX_PW_P3 0x14
hudakz 0:2007da485383 47 #define RX_PW_P4 0x15
hudakz 0:2007da485383 48 #define RX_PW_P5 0x16
hudakz 0:2007da485383 49 #define FIFO_STATUS 0x17
hudakz 0:2007da485383 50 #define DYNPD 0x1C
hudakz 0:2007da485383 51 #define FEATURE 0x1D
hudakz 0:2007da485383 52
hudakz 0:2007da485383 53 /* Bit Mnemonics */
hudakz 0:2007da485383 54 #define MASK_RX_DR 6
hudakz 0:2007da485383 55 #define MASK_TX_DS 5
hudakz 0:2007da485383 56 #define MASK_MAX_RT 4
hudakz 0:2007da485383 57 #define EN_CRC 3
hudakz 0:2007da485383 58 #define CRCO 2
hudakz 0:2007da485383 59 #define PWR_UP 1
hudakz 0:2007da485383 60 #define PRIM_RX 0
hudakz 0:2007da485383 61 #define ENAA_P5 5
hudakz 0:2007da485383 62 #define ENAA_P4 4
hudakz 0:2007da485383 63 #define ENAA_P3 3
hudakz 0:2007da485383 64 #define ENAA_P2 2
hudakz 0:2007da485383 65 #define ENAA_P1 1
hudakz 0:2007da485383 66 #define ENAA_P0 0
hudakz 0:2007da485383 67 #define ERX_P5 5
hudakz 0:2007da485383 68 #define ERX_P4 4
hudakz 0:2007da485383 69 #define ERX_P3 3
hudakz 0:2007da485383 70 #define ERX_P2 2
hudakz 0:2007da485383 71 #define ERX_P1 1
hudakz 0:2007da485383 72 #define ERX_P0 0
hudakz 0:2007da485383 73 #define AW 0
hudakz 0:2007da485383 74 #define ARD 4
hudakz 0:2007da485383 75 #define ARC 0
hudakz 0:2007da485383 76 #define PLL_LOCK 4
hudakz 0:2007da485383 77 #define RF_DR 3
hudakz 0:2007da485383 78 #define RF_PWR 6
hudakz 0:2007da485383 79 #define RX_DR 6
hudakz 0:2007da485383 80 #define TX_DS 5
hudakz 0:2007da485383 81 #define MAX_RT 4
hudakz 0:2007da485383 82 #define RX_P_NO 1
hudakz 0:2007da485383 83 #define TX_FULL 0
hudakz 0:2007da485383 84 #define PLOS_CNT 4
hudakz 0:2007da485383 85 #define ARC_CNT 0
hudakz 0:2007da485383 86 #define TX_REUSE 6
hudakz 0:2007da485383 87 #define FIFO_FULL 5
hudakz 0:2007da485383 88 #define TX_EMPTY 4
hudakz 0:2007da485383 89 #define RX_FULL 1
hudakz 0:2007da485383 90 #define RX_EMPTY 0
hudakz 0:2007da485383 91 #define DPL_P5 5
hudakz 0:2007da485383 92 #define DPL_P4 4
hudakz 0:2007da485383 93 #define DPL_P3 3
hudakz 0:2007da485383 94 #define DPL_P2 2
hudakz 0:2007da485383 95 #define DPL_P1 1
hudakz 0:2007da485383 96 #define DPL_P0 0
hudakz 0:2007da485383 97 #define EN_DPL 2
hudakz 0:2007da485383 98 #define EN_ACK_PAY 1
hudakz 0:2007da485383 99 #define EN_DYN_ACK 0
hudakz 0:2007da485383 100
hudakz 0:2007da485383 101 /* Instruction Mnemonics */
hudakz 0:2007da485383 102 #define R_REGISTER 0x00
hudakz 0:2007da485383 103 #define W_REGISTER 0x20
hudakz 0:2007da485383 104 #define REGISTER_MASK 0x1F
hudakz 0:2007da485383 105 #define ACTIVATE 0x50
hudakz 0:2007da485383 106 #define R_RX_PL_WID 0x60
hudakz 0:2007da485383 107 #define R_RX_PAYLOAD 0x61
hudakz 0:2007da485383 108 #define W_TX_PAYLOAD 0xA0
hudakz 0:2007da485383 109 #define W_ACK_PAYLOAD 0xA8
hudakz 0:2007da485383 110 #define FLUSH_TX 0xE1
hudakz 0:2007da485383 111 #define FLUSH_RX 0xE2
hudakz 0:2007da485383 112 #define REUSE_TX_PL 0xE3
hudakz 0:2007da485383 113 #define NOP 0xFF
hudakz 0:2007da485383 114
hudakz 0:2007da485383 115 /* Non-P omissions */
hudakz 0:2007da485383 116 #define LNA_HCURR 0
hudakz 0:2007da485383 117
hudakz 0:2007da485383 118 /* P model memory Map */
hudakz 0:2007da485383 119 #define RPD 0x09
hudakz 0:2007da485383 120
hudakz 0:2007da485383 121 /* P model bit Mnemonics */
hudakz 0:2007da485383 122 #define RF_DR_LOW 5
hudakz 0:2007da485383 123 #define RF_DR_HIGH 3
hudakz 0:2007da485383 124 #define RF_PWR_LOW 1
hudakz 0:2007da485383 125 #define RF_PWR_HIGH 2
hudakz 0:2007da485383 126
hudakz 0:2007da485383 127 #define HIGH 1
hudakz 0:2007da485383 128 #define LOW 0
hudakz 0:2007da485383 129 #define _BV(n) (1 << n)
hudakz 0:2007da485383 130
hudakz 0:2007da485383 131 /*
hudakz 0:2007da485383 132 Copyright (C) 2011 J. Coliz <maniacbug@ymail.com>
hudakz 0:2007da485383 133
hudakz 0:2007da485383 134 This program is free software; you can redistribute it and/or
hudakz 0:2007da485383 135 modify it under the terms of the GNU General Public License
hudakz 0:2007da485383 136 version 2 as published by the Free Software Foundation.
hudakz 0:2007da485383 137 */
hudakz 0:2007da485383 138
hudakz 0:2007da485383 139 /**
hudakz 0:2007da485383 140 * @file RF24.h
hudakz 0:2007da485383 141 *
hudakz 0:2007da485383 142 * Class declaration for RF24 and helper enums
hudakz 0:2007da485383 143 */
hudakz 0:2007da485383 144
hudakz 0:2007da485383 145 #ifndef __RF24_H__
hudakz 0:2007da485383 146 #define __RF24_H__
hudakz 0:2007da485383 147
hudakz 0:2007da485383 148 #include <mbed.h>
hudakz 0:2007da485383 149
hudakz 0:2007da485383 150 /**
hudakz 0:2007da485383 151 * Power Amplifier level.
hudakz 0:2007da485383 152 *
hudakz 0:2007da485383 153 * For use with setPALevel()
hudakz 0:2007da485383 154 */
hudakz 0:2007da485383 155 typedef enum { RF24_PA_MIN = 0, RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX, RF24_PA_ERROR } rf24_pa_dbm_e ;
hudakz 0:2007da485383 156
hudakz 0:2007da485383 157 /**
hudakz 0:2007da485383 158 * Data rate. How fast data moves through the air.
hudakz 0:2007da485383 159 *
hudakz 0:2007da485383 160 * For use with setDataRate()
hudakz 0:2007da485383 161 */
hudakz 0:2007da485383 162 typedef enum { RF24_1MBPS = 0, RF24_2MBPS, RF24_250KBPS } rf24_datarate_e;
hudakz 0:2007da485383 163
hudakz 0:2007da485383 164 /**
hudakz 0:2007da485383 165 * CRC Length. How big (if any) of a CRC is included.
hudakz 0:2007da485383 166 *
hudakz 0:2007da485383 167 * For use with setCRCLength()
hudakz 0:2007da485383 168 */
hudakz 0:2007da485383 169 typedef enum { RF24_CRC_DISABLED = 0, RF24_CRC_8, RF24_CRC_16 } rf24_crclength_e;
hudakz 0:2007da485383 170
hudakz 0:2007da485383 171 /**
hudakz 0:2007da485383 172 * Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
hudakz 0:2007da485383 173 */
hudakz 0:2007da485383 174
hudakz 0:2007da485383 175 class RF24
hudakz 0:2007da485383 176 {
hudakz 0:2007da485383 177 private:
hudakz 0:2007da485383 178 DigitalOut ce_pin; /**< "Chip Enable" pin, activates the RX or TX role */
hudakz 0:2007da485383 179 DigitalOut csn_pin; /**< SPI Chip select */
hudakz 0:2007da485383 180 bool wide_band; /* 2Mbs data rate in use? */
hudakz 0:2007da485383 181 bool p_variant; /* False for RF24L01 and true for RF24L01P */
hudakz 0:2007da485383 182 uint8_t payload_size; /**< Fixed size of payloads */
hudakz 0:2007da485383 183 bool ack_payload_available; /**< Whether there is an ack payload waiting */
hudakz 0:2007da485383 184 bool dynamic_payloads_enabled; /**< Whether dynamic payloads are enabled. */
hudakz 0:2007da485383 185 uint8_t ack_payload_length; /**< Dynamic size of pending ack payload. */
hudakz 0:2007da485383 186 uint64_t pipe0_reading_address; /**< Last address set on pipe 0 for reading. */
hudakz 0:2007da485383 187 SPI spi;
hudakz 0:2007da485383 188 Timer mainTimer;
hudakz 0:2007da485383 189 uint32_t txRxDelay; /**< Var for adjusting delays depending on datarate */
hudakz 0:2007da485383 190
hudakz 0:2007da485383 191 protected:
hudakz 0:2007da485383 192 /**
hudakz 0:2007da485383 193 * @name Low-level internal interface.
hudakz 0:2007da485383 194 *
hudakz 0:2007da485383 195 * Protected methods that address the chip directly. Regular users cannot
hudakz 0:2007da485383 196 * ever call these. They are documented for completeness and for developers who
hudakz 0:2007da485383 197 * may want to extend this class.
hudakz 0:2007da485383 198 */
hudakz 0:2007da485383 199 /**@{*/
hudakz 0:2007da485383 200
hudakz 0:2007da485383 201 /**
hudakz 0:2007da485383 202 * Set chip select pin
hudakz 0:2007da485383 203 *
hudakz 0:2007da485383 204 * Running SPI bus at PI_CLOCK_DIV2 so we don't waste time transferring data
hudakz 0:2007da485383 205 * and best of all, we make use of the radio's FIFO buffers. A lower speed
hudakz 0:2007da485383 206 * means we're less likely to effectively leverage our FIFOs and pay a higher
hudakz 0:2007da485383 207 * AVR runtime cost as toll.
hudakz 0:2007da485383 208 *
hudakz 0:2007da485383 209 * @param mode HIGH to take this unit off the SPI bus, LOW to put it on
hudakz 0:2007da485383 210 */
hudakz 0:2007da485383 211 void csn(int mode);
hudakz 0:2007da485383 212
hudakz 0:2007da485383 213 /**
hudakz 0:2007da485383 214 * Set chip enable
hudakz 0:2007da485383 215 *
hudakz 0:2007da485383 216 * @param level HIGH to actively begin transmission or LOW to put in standby. Please see data sheet
hudakz 0:2007da485383 217 * for a much more detailed description of this pin.
hudakz 0:2007da485383 218 */
hudakz 0:2007da485383 219 void ce(int level);
hudakz 0:2007da485383 220
hudakz 0:2007da485383 221
hudakz 0:2007da485383 222 /**
hudakz 0:2007da485383 223 * Read a chunk of data in from a register
hudakz 0:2007da485383 224 *
hudakz 0:2007da485383 225 * @param reg Which register. Use constants from nRF24L01.h
hudakz 0:2007da485383 226 * @param buf Where to put the data
hudakz 0:2007da485383 227 * @param len How many bytes of data to transfer
hudakz 0:2007da485383 228 * @return Current value of status register
hudakz 0:2007da485383 229 */
hudakz 0:2007da485383 230 uint8_t read_register(uint8_t reg, uint8_t* buf, uint8_t len);
hudakz 0:2007da485383 231
hudakz 0:2007da485383 232 /**
hudakz 0:2007da485383 233 * Read single byte from a register
hudakz 0:2007da485383 234 *
hudakz 0:2007da485383 235 * @param reg Which register. Use constants from nRF24L01.h
hudakz 0:2007da485383 236 * @return Current value of register @p reg
hudakz 0:2007da485383 237 */
hudakz 0:2007da485383 238 uint8_t read_register(uint8_t reg);
hudakz 0:2007da485383 239
hudakz 0:2007da485383 240 /**
hudakz 0:2007da485383 241 * Write a chunk of data to a register
hudakz 0:2007da485383 242 *
hudakz 0:2007da485383 243 * @param reg Which register. Use constants from nRF24L01.h
hudakz 0:2007da485383 244 * @param buf Where to get the data
hudakz 0:2007da485383 245 * @param len How many bytes of data to transfer
hudakz 0:2007da485383 246 * @return Current value of status register
hudakz 0:2007da485383 247 */
hudakz 0:2007da485383 248 uint8_t write_register(uint8_t reg, const uint8_t* buf, uint8_t len);
hudakz 0:2007da485383 249
hudakz 0:2007da485383 250 /**
hudakz 0:2007da485383 251 * Write a single byte to a register
hudakz 0:2007da485383 252 *
hudakz 0:2007da485383 253 * @param reg Which register. Use constants from nRF24L01.h
hudakz 0:2007da485383 254 * @param value The new value to write
hudakz 0:2007da485383 255 * @return Current value of status register
hudakz 0:2007da485383 256 */
hudakz 0:2007da485383 257 uint8_t write_register(uint8_t reg, uint8_t value);
hudakz 0:2007da485383 258
hudakz 0:2007da485383 259 /**
hudakz 0:2007da485383 260 * Write the transmit payload
hudakz 0:2007da485383 261 *
hudakz 0:2007da485383 262 * The size of data written is the fixed payload size, see getPayloadSize()
hudakz 0:2007da485383 263 *
hudakz 0:2007da485383 264 * @param buf Where to get the data
hudakz 0:2007da485383 265 * @param len Number of bytes to be sent
hudakz 0:2007da485383 266 * @return Current value of status register
hudakz 0:2007da485383 267 */
hudakz 0:2007da485383 268 uint8_t write_payload(const void* buf, uint8_t len);
hudakz 0:2007da485383 269
hudakz 0:2007da485383 270 /**
hudakz 0:2007da485383 271 * Read the receive payload
hudakz 0:2007da485383 272 *
hudakz 0:2007da485383 273 * The size of data read is the fixed payload size, see getPayloadSize()
hudakz 0:2007da485383 274 *
hudakz 0:2007da485383 275 * @param buf Where to put the data
hudakz 0:2007da485383 276 * @param len Maximum number of bytes to read
hudakz 0:2007da485383 277 * @return Current value of status register
hudakz 0:2007da485383 278 */
hudakz 0:2007da485383 279 uint8_t read_payload(void* buf, uint8_t len);
hudakz 0:2007da485383 280
hudakz 0:2007da485383 281
hudakz 0:2007da485383 282 /**
hudakz 0:2007da485383 283 * Decode and print the given status to stdout
hudakz 0:2007da485383 284 *
hudakz 0:2007da485383 285 * @param status Status value to print
hudakz 0:2007da485383 286 *
hudakz 0:2007da485383 287 * @warning Does nothing if stdout is not defined. See fdevopen in stdio.h
hudakz 0:2007da485383 288 */
hudakz 0:2007da485383 289 void print_status(uint8_t status);
hudakz 0:2007da485383 290
hudakz 0:2007da485383 291 /**
hudakz 0:2007da485383 292 * Decode and print the given 'observe_tx' value to stdout
hudakz 0:2007da485383 293 *
hudakz 0:2007da485383 294 * @param value The observe_tx value to print
hudakz 0:2007da485383 295 *
hudakz 0:2007da485383 296 * @warning Does nothing if stdout is not defined. See fdevopen in stdio.h
hudakz 0:2007da485383 297 */
hudakz 0:2007da485383 298 void print_observe_tx(uint8_t value);
hudakz 0:2007da485383 299
hudakz 0:2007da485383 300 /**
hudakz 0:2007da485383 301 * Print the name and value of an 8-bit register to stdout
hudakz 0:2007da485383 302 *
hudakz 0:2007da485383 303 * Optionally it can print some quantity of successive
hudakz 0:2007da485383 304 * registers on the same line. This is useful for printing a group
hudakz 0:2007da485383 305 * of related registers on one line.
hudakz 0:2007da485383 306 *
hudakz 0:2007da485383 307 * @param name Name of the register
hudakz 0:2007da485383 308 * @param reg Which register. Use constants from nRF24L01.h
hudakz 0:2007da485383 309 * @param qty How many successive registers to print
hudakz 0:2007da485383 310 */
hudakz 0:2007da485383 311 void print_byte_register(const char* name, uint8_t reg, uint8_t qty = 1);
hudakz 0:2007da485383 312
hudakz 0:2007da485383 313 /**
hudakz 0:2007da485383 314 * Print the name and value of a 40-bit address register to stdout
hudakz 0:2007da485383 315 *
hudakz 0:2007da485383 316 * Optionally it can print some quantity of successive
hudakz 0:2007da485383 317 * registers on the same line. This is useful for printing a group
hudakz 0:2007da485383 318 * of related registers on one line.
hudakz 0:2007da485383 319 *
hudakz 0:2007da485383 320 * @param name Name of the register
hudakz 0:2007da485383 321 * @param reg Which register. Use constants from nRF24L01.h
hudakz 0:2007da485383 322 * @param qty How many successive registers to print
hudakz 0:2007da485383 323 */
hudakz 0:2007da485383 324 void print_address_register(const char* name, uint8_t reg, uint8_t qty = 1);
hudakz 0:2007da485383 325
hudakz 0:2007da485383 326 /**
hudakz 0:2007da485383 327 * Turn on or off the special features of the chip
hudakz 0:2007da485383 328 *
hudakz 0:2007da485383 329 * The chip has certain 'features' which are only available when the 'features'
hudakz 0:2007da485383 330 * are enabled. See the datasheet for details.
hudakz 0:2007da485383 331 */
hudakz 0:2007da485383 332 void toggle_features(void);
hudakz 0:2007da485383 333 /**@}*/
hudakz 0:2007da485383 334
hudakz 0:2007da485383 335 public:
hudakz 0:2007da485383 336 /**
hudakz 0:2007da485383 337 * @name Primary public interface
hudakz 0:2007da485383 338 *
hudakz 0:2007da485383 339 * These are the main methods you need to operate the chip
hudakz 0:2007da485383 340 */
hudakz 0:2007da485383 341 /**@{*/
hudakz 0:2007da485383 342
hudakz 0:2007da485383 343 /**
hudakz 0:2007da485383 344 * Constructor
hudakz 0:2007da485383 345 *
hudakz 0:2007da485383 346 * Creates a new instance of this driver. Before using, you create an instance
hudakz 0:2007da485383 347 * and send in the unique pins that this chip is connected to.
hudakz 0:2007da485383 348 *
hudakz 0:2007da485383 349 * @param _cepin The pin attached to Chip Enable on the RF module
hudakz 0:2007da485383 350 * @param _cspin The pin attached to Chip Select
hudakz 0:2007da485383 351 */
hudakz 0:2007da485383 352 RF24(PinName mosi, PinName miso, PinName sck, PinName _csnpin, PinName _cepin);
hudakz 0:2007da485383 353
hudakz 0:2007da485383 354 /**
hudakz 0:2007da485383 355 * Begin operation of the chip
hudakz 0:2007da485383 356 *
hudakz 0:2007da485383 357 * Call this in setup(), before calling any other methods.
hudakz 1:d96c2056bf37 358 *
hudakz 1:d96c2056bf37 359 * @return True on success. False otherwise.
hudakz 0:2007da485383 360 */
hudakz 1:d96c2056bf37 361 bool begin(void);
hudakz 0:2007da485383 362
hudakz 0:2007da485383 363 /**
hudakz 0:2007da485383 364 * Retrieve the current status of the chip
hudakz 0:2007da485383 365 *
hudakz 0:2007da485383 366 * @return Current value of status register
hudakz 0:2007da485383 367 */
hudakz 0:2007da485383 368 uint8_t get_status(void);
hudakz 0:2007da485383 369
hudakz 0:2007da485383 370 /**
hudakz 0:2007da485383 371 * Empty the receive buffer
hudakz 0:2007da485383 372 *
hudakz 0:2007da485383 373 * @return Current value of status register
hudakz 0:2007da485383 374 */
hudakz 0:2007da485383 375 uint8_t flush_rx(void);
hudakz 0:2007da485383 376
hudakz 0:2007da485383 377 /**
hudakz 0:2007da485383 378 * Empty the transmit buffer
hudakz 0:2007da485383 379 *
hudakz 0:2007da485383 380 * @return Current value of status register
hudakz 0:2007da485383 381 */
hudakz 0:2007da485383 382 uint8_t flush_tx(void);
hudakz 0:2007da485383 383
hudakz 0:2007da485383 384 /**
hudakz 0:2007da485383 385 * Start listening on the pipes opened for reading.
hudakz 0:2007da485383 386 *
hudakz 0:2007da485383 387 * Be sure to call openReadingPipe() first. Do not call write() while
hudakz 0:2007da485383 388 * in this mode, without first calling stopListening(). Call
hudakz 0:2007da485383 389 * isAvailable() to check for incoming traffic, and read() to get it.
hudakz 0:2007da485383 390 */
hudakz 0:2007da485383 391 void startListening(void);
hudakz 0:2007da485383 392
hudakz 0:2007da485383 393 /**
hudakz 0:2007da485383 394 * Stop listening for incoming messages
hudakz 0:2007da485383 395 *
hudakz 0:2007da485383 396 * Do this before calling write().
hudakz 0:2007da485383 397 */
hudakz 0:2007da485383 398 void stopListening(void);
hudakz 0:2007da485383 399
hudakz 0:2007da485383 400 /**
hudakz 0:2007da485383 401 * Write to the open writing pipe
hudakz 0:2007da485383 402 *
hudakz 0:2007da485383 403 * Be sure to call openWritingPipe() first to set the destination
hudakz 0:2007da485383 404 * of where to write to.
hudakz 0:2007da485383 405 *
hudakz 0:2007da485383 406 * This blocks until the message is successfully acknowledged by
hudakz 0:2007da485383 407 * the receiver or the timeout/retransmit maxima are reached. In
hudakz 0:2007da485383 408 * the current configuration, the max delay here is 60ms.
hudakz 0:2007da485383 409 *
hudakz 0:2007da485383 410 * The maximum size of data written is the fixed payload size, see
hudakz 0:2007da485383 411 * getPayloadSize(). However, you can write less, and the remainder
hudakz 0:2007da485383 412 * will just be filled with zeroes.
hudakz 0:2007da485383 413 *
hudakz 0:2007da485383 414 * @param buf Pointer to the data to be sent
hudakz 0:2007da485383 415 * @param len Number of bytes to be sent
hudakz 0:2007da485383 416 * @return True if the payload was delivered successfully false if not
hudakz 0:2007da485383 417 */
hudakz 0:2007da485383 418 bool write( const void* buf, uint8_t len );
hudakz 0:2007da485383 419
hudakz 0:2007da485383 420 /**
hudakz 0:2007da485383 421 * Test whether there are bytes available to be read
hudakz 0:2007da485383 422 *
hudakz 0:2007da485383 423 * @return True if there is a payload available, false if none is
hudakz 0:2007da485383 424 */
hudakz 0:2007da485383 425 bool available(void);
hudakz 0:2007da485383 426
hudakz 0:2007da485383 427 /**
hudakz 0:2007da485383 428 * Read the payload
hudakz 0:2007da485383 429 *
hudakz 0:2007da485383 430 * Return the last payload received
hudakz 0:2007da485383 431 *
hudakz 0:2007da485383 432 * The size of data read is the fixed payload size, see getPayloadSize()
hudakz 0:2007da485383 433 *
hudakz 0:2007da485383 434 * @note I specifically chose 'void*' as a data type to make it easier
hudakz 0:2007da485383 435 * for beginners to use. No casting needed.
hudakz 0:2007da485383 436 *
hudakz 0:2007da485383 437 * @param buf Pointer to a buffer where the data should be written
hudakz 0:2007da485383 438 * @param len Maximum number of bytes to read into the buffer
hudakz 0:2007da485383 439 * @return True if the payload was delivered successfully false if not
hudakz 0:2007da485383 440 */
hudakz 0:2007da485383 441 bool read( void* buf, uint8_t len );
hudakz 0:2007da485383 442
hudakz 0:2007da485383 443 /**
hudakz 0:2007da485383 444 * Open a pipe for writing
hudakz 0:2007da485383 445 *
hudakz 0:2007da485383 446 * Only one pipe can be open at once, but you can change the pipe
hudakz 0:2007da485383 447 * you'll listen to. Do not call this while actively listening.
hudakz 0:2007da485383 448 * Remember to stopListening() first.
hudakz 0:2007da485383 449 *
hudakz 0:2007da485383 450 * Addresses are 40-bit hex values, e.g.:
hudakz 0:2007da485383 451 *
hudakz 0:2007da485383 452 * @code
hudakz 0:2007da485383 453 * openWritingPipe(0xF0F0F0F0F0);
hudakz 0:2007da485383 454 * @endcode
hudakz 0:2007da485383 455 *
hudakz 0:2007da485383 456 * @param address The 40-bit address of the pipe to open. This can be
hudakz 0:2007da485383 457 * any value whatsoever, as long as you are the only one writing to it
hudakz 0:2007da485383 458 * and only one other radio is listening to it. Coordinate these pipe
hudakz 0:2007da485383 459 * addresses amongst nodes on the network.
hudakz 0:2007da485383 460 */
hudakz 0:2007da485383 461 void openWritingPipe(uint64_t address);
hudakz 0:2007da485383 462
hudakz 0:2007da485383 463 /**
hudakz 0:2007da485383 464 * Open a pipe for reading
hudakz 0:2007da485383 465 *
hudakz 0:2007da485383 466 * Up to 6 pipes can be open for reading at once. Open all the
hudakz 0:2007da485383 467 * reading pipes, and then call startListening().
hudakz 0:2007da485383 468 *
hudakz 0:2007da485383 469 * @see openWritingPipe
hudakz 0:2007da485383 470 *
hudakz 0:2007da485383 471 * @warning Pipes 1-5 should share the first 32 bits.
hudakz 0:2007da485383 472 * Only the least significant byte should be unique, e.g.
hudakz 0:2007da485383 473 * @code
hudakz 0:2007da485383 474 * openReadingPipe(1,0xF0F0F0F0AA);
hudakz 0:2007da485383 475 * openReadingPipe(2,0xF0F0F0F066);
hudakz 0:2007da485383 476 * @endcode
hudakz 0:2007da485383 477 *
hudakz 0:2007da485383 478 * @warning Pipe 0 is also used by the writing pipe. So if you open
hudakz 0:2007da485383 479 * pipe 0 for reading, and then startListening(), it will overwrite the
hudakz 0:2007da485383 480 * writing pipe. Ergo, do an openWritingPipe() again before write().
hudakz 0:2007da485383 481 *
hudakz 0:2007da485383 482 * @todo Enforce the restriction that pipes 1-5 must share the top 32 bits
hudakz 0:2007da485383 483 *
hudakz 0:2007da485383 484 * @param number Which pipe# to open, 0-5.
hudakz 0:2007da485383 485 * @param address The 40-bit address of the pipe to open.
hudakz 0:2007da485383 486 */
hudakz 0:2007da485383 487 void openReadingPipe(uint8_t number, uint64_t address);
hudakz 0:2007da485383 488
hudakz 0:2007da485383 489 /**@}*/
hudakz 0:2007da485383 490 /**
hudakz 0:2007da485383 491 * @name Optional Configurators
hudakz 0:2007da485383 492 *
hudakz 0:2007da485383 493 * Methods you can use to get or set the configuration of the chip.
hudakz 0:2007da485383 494 * None are required. Calling begin() sets up a reasonable set of
hudakz 0:2007da485383 495 * defaults.
hudakz 0:2007da485383 496 */
hudakz 0:2007da485383 497 /**@{*/
hudakz 0:2007da485383 498 /**
hudakz 0:2007da485383 499 * Set the number and delay of retries upon failed submit
hudakz 0:2007da485383 500 *
hudakz 0:2007da485383 501 * @param delay How long to wait between each retry, in multiples of 250us,
hudakz 0:2007da485383 502 * max is 15. 0 means 250us, 15 means 4000us.
hudakz 0:2007da485383 503 * @param count How many retries before giving up, max 15
hudakz 0:2007da485383 504 */
hudakz 0:2007da485383 505 void setRetries(uint8_t delay, uint8_t count);
hudakz 0:2007da485383 506
hudakz 0:2007da485383 507 /**
hudakz 0:2007da485383 508 * Set RF communication channel
hudakz 0:2007da485383 509 *
hudakz 0:2007da485383 510 * @param channel Which RF channel to communicate on, 0-127
hudakz 0:2007da485383 511 */
hudakz 0:2007da485383 512 void setChannel(uint8_t channel);
hudakz 0:2007da485383 513
hudakz 0:2007da485383 514 /**
hudakz 0:2007da485383 515 * Set Static Payload Size
hudakz 0:2007da485383 516 *
hudakz 0:2007da485383 517 * This implementation uses a pre-stablished fixed payload size for all
hudakz 0:2007da485383 518 * transmissions. If this method is never called, the driver will always
hudakz 0:2007da485383 519 * transmit the maximum payload size (32 bytes), no matter how much
hudakz 0:2007da485383 520 * was sent to write().
hudakz 0:2007da485383 521 *
hudakz 0:2007da485383 522 * @todo Implement variable-sized payloads feature
hudakz 0:2007da485383 523 *
hudakz 0:2007da485383 524 * @param size The number of bytes in the payload
hudakz 0:2007da485383 525 */
hudakz 0:2007da485383 526 void setPayloadSize(uint8_t size);
hudakz 0:2007da485383 527
hudakz 0:2007da485383 528 /**
hudakz 0:2007da485383 529 * Get Static Payload Size
hudakz 0:2007da485383 530 *
hudakz 0:2007da485383 531 * @see setPayloadSize()
hudakz 0:2007da485383 532 *
hudakz 0:2007da485383 533 * @return The number of bytes in the payload
hudakz 0:2007da485383 534 */
hudakz 0:2007da485383 535 uint8_t getPayloadSize(void);
hudakz 0:2007da485383 536
hudakz 0:2007da485383 537 /**
hudakz 0:2007da485383 538 * Get Dynamic Payload Size
hudakz 0:2007da485383 539 *
hudakz 0:2007da485383 540 * For dynamic payloads, this pulls the size of the payload off
hudakz 0:2007da485383 541 * the chip
hudakz 0:2007da485383 542 *
hudakz 0:2007da485383 543 * @return Payload length of last-received dynamic payload
hudakz 0:2007da485383 544 */
hudakz 0:2007da485383 545 uint8_t getDynamicPayloadSize(void);
hudakz 0:2007da485383 546
hudakz 0:2007da485383 547 /**
hudakz 0:2007da485383 548 * Enable custom payloads on the acknowledge packets
hudakz 0:2007da485383 549 *
hudakz 0:2007da485383 550 * Ack payloads are a handy way to return data back to senders without
hudakz 0:2007da485383 551 * manually changing the radio modes on both units.
hudakz 0:2007da485383 552 *
hudakz 0:2007da485383 553 * @see examples/pingpair_pl/pingpair_pl.pde
hudakz 0:2007da485383 554 */
hudakz 0:2007da485383 555 void enableAckPayload(void);
hudakz 0:2007da485383 556
hudakz 0:2007da485383 557 /**
hudakz 0:2007da485383 558 * Enable dynamically-sized payloads
hudakz 0:2007da485383 559 *
hudakz 0:2007da485383 560 * This way you don't always have to send large packets just to send them
hudakz 0:2007da485383 561 * once in a while. This enables dynamic payloads on ALL pipes.
hudakz 0:2007da485383 562 *
hudakz 0:2007da485383 563 * @see examples/pingpair_pl/pingpair_dyn.pde
hudakz 0:2007da485383 564 */
hudakz 0:2007da485383 565 void enableDynamicPayloads(void);
hudakz 0:2007da485383 566
hudakz 0:2007da485383 567 /**
hudakz 0:2007da485383 568 * Determine whether the hardware is an nRF24L01+ or not.
hudakz 0:2007da485383 569 *
hudakz 0:2007da485383 570 * @return true if the hardware is nRF24L01+ (or compatible) and false
hudakz 0:2007da485383 571 * if its not.
hudakz 0:2007da485383 572 */
hudakz 0:2007da485383 573 bool isPVariant(void) ;
hudakz 0:2007da485383 574
hudakz 0:2007da485383 575 /**
hudakz 0:2007da485383 576 * Enable or disable auto-acknowlede packets
hudakz 0:2007da485383 577 *
hudakz 0:2007da485383 578 * This is enabled by default, so it's only needed if you want to turn
hudakz 0:2007da485383 579 * it off for some reason.
hudakz 0:2007da485383 580 *
hudakz 0:2007da485383 581 * @param enable Whether to enable (true) or disable (false) auto-acks
hudakz 0:2007da485383 582 */
hudakz 0:2007da485383 583 void setAutoAck(bool enable);
hudakz 0:2007da485383 584
hudakz 0:2007da485383 585 /**
hudakz 0:2007da485383 586 * Enable or disable auto-acknowlede packets on a per pipeline basis.
hudakz 0:2007da485383 587 *
hudakz 0:2007da485383 588 * AA is enabled by default, so it's only needed if you want to turn
hudakz 0:2007da485383 589 * it off/on for some reason on a per pipeline basis.
hudakz 0:2007da485383 590 *
hudakz 0:2007da485383 591 * @param pipe Which pipeline to modify
hudakz 0:2007da485383 592 * @param enable Whether to enable (true) or disable (false) auto-acks
hudakz 0:2007da485383 593 */
hudakz 0:2007da485383 594 void setAutoAck( uint8_t pipe, bool enable ) ;
hudakz 0:2007da485383 595
hudakz 0:2007da485383 596 /**
hudakz 0:2007da485383 597 * Set Power Amplifier (PA) level to one of four levels.
hudakz 0:2007da485383 598 * Relative mnemonics have been used to allow for future PA level
hudakz 0:2007da485383 599 * changes. According to 6.5 of the nRF24L01+ specification sheet,
hudakz 0:2007da485383 600 * they translate to: RF24_PA_MIN=-18dBm, RF24_PA_LOW=-12dBm,
hudakz 0:2007da485383 601 * RF24_PA_MED=-6dBM, and RF24_PA_HIGH=0dBm.
hudakz 0:2007da485383 602 *
hudakz 0:2007da485383 603 * @param level Desired PA level.
hudakz 0:2007da485383 604 */
hudakz 0:2007da485383 605 void setPALevel( rf24_pa_dbm_e level ) ;
hudakz 0:2007da485383 606
hudakz 0:2007da485383 607 /**
hudakz 0:2007da485383 608 * Fetches the current PA level.
hudakz 0:2007da485383 609 *
hudakz 0:2007da485383 610 * @return Returns a value from the rf24_pa_dbm_e enum describing
hudakz 0:2007da485383 611 * the current PA setting. Please remember, all values represented
hudakz 0:2007da485383 612 * by the enum mnemonics are negative dBm. See setPALevel for
hudakz 0:2007da485383 613 * return value descriptions.
hudakz 0:2007da485383 614 */
hudakz 0:2007da485383 615 rf24_pa_dbm_e getPALevel( void ) ;
hudakz 0:2007da485383 616
hudakz 0:2007da485383 617 /**
hudakz 0:2007da485383 618 * Set the transmission data rate
hudakz 0:2007da485383 619 *
hudakz 0:2007da485383 620 * @warning setting RF24_250KBPS will fail for non-plus units
hudakz 0:2007da485383 621 *
hudakz 0:2007da485383 622 * @param speed RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
hudakz 0:2007da485383 623 * @return true if the change was successful
hudakz 0:2007da485383 624 */
hudakz 0:2007da485383 625 bool setDataRate(rf24_datarate_e speed);
hudakz 0:2007da485383 626
hudakz 0:2007da485383 627 /**
hudakz 0:2007da485383 628 * Fetches the transmission data rate
hudakz 0:2007da485383 629 *
hudakz 0:2007da485383 630 * @return Returns the hardware's currently configured datarate. The value
hudakz 0:2007da485383 631 * is one of 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS, as defined in the
hudakz 0:2007da485383 632 * rf24_datarate_e enum.
hudakz 0:2007da485383 633 */
hudakz 0:2007da485383 634 rf24_datarate_e getDataRate( void ) ;
hudakz 0:2007da485383 635
hudakz 0:2007da485383 636 /**
hudakz 0:2007da485383 637 * Set the CRC length
hudakz 0:2007da485383 638 *
hudakz 0:2007da485383 639 * @param length RF24_CRC_8 for 8-bit or RF24_CRC_16 for 16-bit
hudakz 0:2007da485383 640 */
hudakz 0:2007da485383 641 void setCRCLength(rf24_crclength_e length);
hudakz 0:2007da485383 642
hudakz 0:2007da485383 643 /**
hudakz 0:2007da485383 644 * Get the CRC length
hudakz 0:2007da485383 645 *
hudakz 0:2007da485383 646 * @return RF24_DISABLED if disabled or RF24_CRC_8 for 8-bit or RF24_CRC_16 for 16-bit
hudakz 0:2007da485383 647 */
hudakz 0:2007da485383 648 rf24_crclength_e getCRCLength(void);
hudakz 0:2007da485383 649
hudakz 0:2007da485383 650 /**
hudakz 0:2007da485383 651 * Disable CRC validation
hudakz 0:2007da485383 652 *
hudakz 0:2007da485383 653 */
hudakz 0:2007da485383 654 void disableCRC( void ) ;
hudakz 0:2007da485383 655
hudakz 0:2007da485383 656 /**@}*/
hudakz 0:2007da485383 657 /**
hudakz 0:2007da485383 658 * @name Advanced Operation
hudakz 0:2007da485383 659 *
hudakz 0:2007da485383 660 * Methods you can use to drive the chip in more advanced ways
hudakz 0:2007da485383 661 */
hudakz 0:2007da485383 662 /**@{*/
hudakz 0:2007da485383 663
hudakz 0:2007da485383 664 /**
hudakz 0:2007da485383 665 * Print a giant block of debugging information to stdout
hudakz 0:2007da485383 666 *
hudakz 0:2007da485383 667 * @warning Does nothing if stdout is not defined. See fdevopen in stdio.h
hudakz 0:2007da485383 668 */
hudakz 0:2007da485383 669 void printDetails(void);
hudakz 0:2007da485383 670
hudakz 0:2007da485383 671 /**
hudakz 0:2007da485383 672 * Enter low-power mode
hudakz 0:2007da485383 673 *
hudakz 0:2007da485383 674 * To return to normal power mode, either write() some data or
hudakz 0:2007da485383 675 * startListening, or powerUp().
hudakz 0:2007da485383 676 */
hudakz 0:2007da485383 677 void powerDown(void);
hudakz 0:2007da485383 678
hudakz 0:2007da485383 679 /**
hudakz 0:2007da485383 680 * Leave low-power mode - making radio more responsive
hudakz 0:2007da485383 681 *
hudakz 0:2007da485383 682 * To return to low power mode, call powerDown().
hudakz 0:2007da485383 683 */
hudakz 0:2007da485383 684 void powerUp(void) ;
hudakz 0:2007da485383 685
hudakz 0:2007da485383 686 /**
hudakz 0:2007da485383 687 * Test whether there are bytes available to be read
hudakz 0:2007da485383 688 *
hudakz 0:2007da485383 689 * Use this version to discover on which pipe the message
hudakz 0:2007da485383 690 * arrived.
hudakz 0:2007da485383 691 *
hudakz 0:2007da485383 692 * @param[out] pipe_num Which pipe has the payload available
hudakz 0:2007da485383 693 * @return True if there is a payload available, false if none is
hudakz 0:2007da485383 694 */
hudakz 0:2007da485383 695 bool available(uint8_t* pipe_num);
hudakz 0:2007da485383 696
hudakz 0:2007da485383 697 /**
hudakz 0:2007da485383 698 * Non-blocking write to the open writing pipe
hudakz 0:2007da485383 699 *
hudakz 0:2007da485383 700 * Just like write(), but it returns immediately. To find out what happened
hudakz 0:2007da485383 701 * to the send, catch the IRQ and then call whatHappened().
hudakz 0:2007da485383 702 *
hudakz 0:2007da485383 703 * @see write()
hudakz 0:2007da485383 704 * @see whatHappened()
hudakz 0:2007da485383 705 *
hudakz 0:2007da485383 706 * @param buf Pointer to the data to be sent
hudakz 0:2007da485383 707 * @param len Number of bytes to be sent
hudakz 0:2007da485383 708 * @return True if the payload was delivered successfully false if not
hudakz 0:2007da485383 709 */
hudakz 0:2007da485383 710 void startWrite( const void* buf, uint8_t len );
hudakz 0:2007da485383 711
hudakz 0:2007da485383 712 /**
hudakz 0:2007da485383 713 * Write an ack payload for the specified pipe
hudakz 0:2007da485383 714 *
hudakz 0:2007da485383 715 * The next time a message is received on @p pipe, the data in @p buf will
hudakz 0:2007da485383 716 * be sent back in the acknowledgement.
hudakz 0:2007da485383 717 *
hudakz 0:2007da485383 718 * @warning According to the data sheet, only three of these can be pending
hudakz 0:2007da485383 719 * at any time. I have not tested this.
hudakz 0:2007da485383 720 *
hudakz 0:2007da485383 721 * @param pipe Which pipe# (typically 1-5) will get this response.
hudakz 0:2007da485383 722 * @param buf Pointer to data that is sent
hudakz 0:2007da485383 723 * @param len Length of the data to send, up to 32 bytes max. Not affected
hudakz 0:2007da485383 724 * by the static payload set by setPayloadSize().
hudakz 0:2007da485383 725 */
hudakz 0:2007da485383 726 void writeAckPayload(uint8_t pipe, const void* buf, uint8_t len);
hudakz 0:2007da485383 727
hudakz 0:2007da485383 728 /**
hudakz 0:2007da485383 729 * Determine if an ack payload was received in the most recent call to
hudakz 0:2007da485383 730 * write().
hudakz 0:2007da485383 731 *
hudakz 0:2007da485383 732 * Call read() to retrieve the ack payload.
hudakz 0:2007da485383 733 *
hudakz 0:2007da485383 734 * @warning Calling this function clears the internal flag which indicates
hudakz 0:2007da485383 735 * a payload is available. If it returns true, you must read the packet
hudakz 0:2007da485383 736 * out as the very next interaction with the radio, or the results are
hudakz 0:2007da485383 737 * undefined.
hudakz 0:2007da485383 738 *
hudakz 0:2007da485383 739 * @return True if an ack payload is available.
hudakz 0:2007da485383 740 */
hudakz 0:2007da485383 741 bool isAckPayloadAvailable(void);
hudakz 0:2007da485383 742
hudakz 0:2007da485383 743 /**
hudakz 0:2007da485383 744 * Call this when you get an interrupt to find out why
hudakz 0:2007da485383 745 *
hudakz 0:2007da485383 746 * Tells you what caused the interrupt, and clears the state of
hudakz 0:2007da485383 747 * interrupts.
hudakz 0:2007da485383 748 *
hudakz 0:2007da485383 749 * @param[out] tx_ok The send was successful (TX_DS)
hudakz 0:2007da485383 750 * @param[out] tx_fail The send failed, too many retries (MAX_RT)
hudakz 0:2007da485383 751 * @param[out] rx_ready There is a message waiting to be read (RX_DS)
hudakz 0:2007da485383 752 */
hudakz 0:2007da485383 753 void whatHappened(bool& tx_ok,bool& tx_fail,bool& rx_ready);
hudakz 0:2007da485383 754
hudakz 0:2007da485383 755 /**
hudakz 0:2007da485383 756 * Test whether there was a carrier on the line for the
hudakz 0:2007da485383 757 * previous listening period.
hudakz 0:2007da485383 758 *
hudakz 0:2007da485383 759 * Useful to check for interference on the current channel.
hudakz 0:2007da485383 760 *
hudakz 0:2007da485383 761 * @return true if was carrier, false if not
hudakz 0:2007da485383 762 */
hudakz 0:2007da485383 763 bool testCarrier(void);
hudakz 0:2007da485383 764
hudakz 0:2007da485383 765 /**
hudakz 0:2007da485383 766 * Test whether a signal (carrier or otherwise) greater than
hudakz 0:2007da485383 767 * or equal to -64dBm is present on the channel. Valid only
hudakz 0:2007da485383 768 * on nRF24L01P (+) hardware. On nRF24L01, use testCarrier().
hudakz 0:2007da485383 769 *
hudakz 0:2007da485383 770 * Useful to check for interference on the current channel and
hudakz 0:2007da485383 771 * channel hopping strategies.
hudakz 0:2007da485383 772 *
hudakz 0:2007da485383 773 * @return true if signal => -64dBm, false if not
hudakz 0:2007da485383 774 */
hudakz 0:2007da485383 775 bool testRPD(void) ;
hudakz 0:2007da485383 776
hudakz 0:2007da485383 777 uint8_t min(uint8_t, uint8_t);
hudakz 0:2007da485383 778 };
hudakz 0:2007da485383 779
hudakz 0:2007da485383 780
hudakz 0:2007da485383 781 #endif // __RF24_H__