My code needs more documentation, a principles of operation document and more examples.
I named it NRF24, maybe that should also be changed before a real release.
If you want to have a look at it, I attach a snapshot.
The doxygen output makes it rather fat. 
One of the examples that are included.
#include <OUtility.h>
#include <SimCommDefs.h>
#include <SPI.h>
#include <NRF24.h>
bool doAcks = true; // two send modes
const byte addr[] PROGMEM = "pipe0" "pipe1" "pipe2" "pipe3" "pipe4" "pipe5";
const byte tMsg[] PROGMEM = "****Test Message";
// SPI pins CE,CS,IRQ,Receive, State
NRF24 radio(9, 10, 2, procRcb, procEvent);
byte noOfPipes = 6;
void setup() {
Serial.begin(115200);
Serial.println(F("NRF24 minimum Ack/noAck six"));
Serial.println(F("s - send, a - change Ack/noAck, p - pipes, ? - state"));
// a table of 6 addresses, in PROGMEM and MSB format
radio.addresses(addr, 6, dcInPM + dcLen5 + dcMSB);
// listen on 6 pipes without suppressing acks
radio.listenOn(0, aiFirst, 6, false);
radio.begin(PRX);
radio.printMode();
radio.printPipes();
}
void loop() {
radio.processEvents();
serialHandler();
}
byte procRcb(RCB& rcb) {
return rPrint;
}
byte procEvent(Event& e) {
if (e.txAny()) {
radio.printSendResult();
}
return 0;
}
void processCmd(char* buf) {
switch (*buf) {
// send the testmessage to a random address from the table
case 's': radio.send(aiFirst + random(0, 6), &tMsg, sizeof(tMsg), !doAcks, dcInPM);
break;
case 'a': repFlipBool(PSTR("Acknowlege"), doAcks);
break;
case '?': radio.printState();
break;
case 'p': radio.printPipes();
break;
case 'I': if (*++buf) {
nodeId(*buf);
} else {
printNode();
}
}
}
// Command line stuff
void pEqOnOff(bool val) {
Serial.print(F(" = ")); Serial.print(val ? F("ON") : F("OFF"));
}
void repFlipBool(const char* named, bool& Val) {
Val = !Val;
repBool(named, Val);
}
void repBool(const char* named, bool Val) {
pPS(named, Serial);
pEqOnOff(Val);
Serial.println();
}
void serialHandler() {
const byte sCBMax = 30;
static char sCBuffer[sCBMax];
static byte buffIndex = 0;
byte inChar;
bool doCheck = false;
while (Serial.available()) {
inChar = Serial.read();
if (inChar == 13) {
doCheck = true;
} else if (inChar != 10) {
if ((buffIndex == 0) && isWhitespace(inChar)) {
continue;
}
sCBuffer[buffIndex++] = inChar;
doCheck = (buffIndex == (sCBMax - 1));
}
if (doCheck) {
sCBuffer[buffIndex] = 0;
doCheck = false;
if (buffIndex != 0) {
processCmd(sCBuffer);
buffIndex = 0;
} else {
Serial.println();
}
}
}
}
Are there really errors in the TMRh20 driver?
I can not remember real errors in it, some omissions maybe.
NRF24Plus.zip (1.13 MB)