This is a work in progress for an NRF2401P

Dependents:   NRF_receiver sender locker4 Weather_Station_Ofiicial ... more

About

This is a simple library to drive the nRF24l01+.

Hardware

This uses the commonly available breakout. The connections are shown below /media/uploads/epgmdm/nrf24l01pinout.png

Software

Use case: For a simple transmitter

tx code snipet

#include "NRF2401P.h"
int main() {
*
*  long long addr1=0xAB00CD; // setup address - any 5 byte number - same as RX
*  int channel =0x12;  // [0-126] setup channel, must be same as RX
*  bool txOK;
*  char msg[32];
*  char ackData[32];
*  char len;
*
*  // Setup 
*  NRF2401P nrf1(PTD6,PTD7, PTD5,PTD4, PTC12); //mosi, miso, sclk, csn, ce)
*  nrf1.quickTxSetup(channel, addr1); // sets nrf24l01+ as transmitter
*
*  // transmit
*  strcpy (msg, "Hello"); 
*  txOK= nrf1.transmitData(msg,strlen(msg));
*
*  // read ack data if available
*  if (nrf1.isAckData()) { 
*      len= nrf1.getRxData(ackData); // len is number of bytes in ackData
*   }
*}

Use case: For a simple receiver

rx code snipet

#include "NRF2401P.h"
*int main(){
*        
*  long long addr1=0xAB00CD; // setup address - any 5 byte number - same as TX
*  int channel =0x12;  // [0-126] setup channel, must be same as TX
*  bool txOK;
*  char msg[32];
*  char ackData[32];
*  char len;
*
*  // Setup 
*  NRF2401P nrf1(PTD6,PTD7, PTD5,PTD4, PTC12); //mosi, miso, sclk, csn, ce)
*  nrf1.quickRxSetup(channel, addr1); // sets nrf24l01+ as  receiver, using pipe 1
*
*  // set ack data
*  sprintf(ackData,"Ack data");
*  nrf1.acknowledgeData(ackData, strlen(ackData),1); // ack for pipe 1
*    
*  // receive
*  while (! nrf1.isRxData()); // note this blocks until RX data
*  len= nrf1.getRxData(msg); // gets the message, len is length of msg
*
*}

Changes

RevisionDateWhoCommit message
20:e61edde5680d 2016-02-25 epgmdm Minor updates to make all returns void if possible default tip
19:813161fd59a2 2016-02-19 epgmdm Next update;
18:220df99d2d41 2016-02-08 epgmdm updates;
17:b132fc1a27d2 2016-02-07 epgmdm Updated;
16:a9b83d2b6915 2016-01-28 epgmdm Makes the easy tx and rx include ack
15:9998698cb041 2015-06-18 epgmdm Cleaned up code. most functions now return void. Status is tracked in the class. Use checkStatus().
14:976a876819ae 2015-07-11 nixonkj Minro housekeeping.
13:5cbc726f2bbb 2015-07-11 nixonkj Provides isRPDset() - check if radio signal > -64dBm.
12:ea1345de6478 2015-07-11 nixonkj Fix CONFIG missing in printDetails
11:07f76589f00a 2015-07-11 nixonkj Refactored printDetails and introduced printReg functions.
10:8a217441c38e 2015-07-11 nixonkj Adds in ability to read multiple bytes from SPI and can now print address details.
9:c21b80aaf250 2015-07-11 nixonkj Added basic function to display radio setup and configuration. Fix dynamic payload setup.
8:3e027705ce23 2015-07-05 nixonkj Incremental improvement on documentation.
7:621a5b0cf1aa 2015-07-05 nixonkj Doxygen example "template" for setRadio.
6:77ead8abdd1c 2015-07-05 nixonkj Minor housekeeping. Tidied up function return values. For functions doing something the convention is to return a char - 0 on success, non-zero for failure. Query functions return bool. Reading and writing registers are now void functions.
5:7e253c677a1f 2015-06-12 epgmdm Added documentation;
4:e55807cf840b 2015-06-12 epgmdm This has Ack working.; 9h07 12 Jun
3:afe8d307b5c3 2015-06-11 epgmdm No debug, transmitData returns bool not char - flushesTX if max RT
2:ca0a3c0bba70 2015-06-11 epgmdm Ack working
1:ff53b1ac3bad 2015-06-11 epgmdm Added a few extras
0:8fd0531ae0be 2015-06-11 epgmdm First Commit