Fix compatibility issue with nRF clones, update documentation

This commit is contained in:
tekka007
2016-08-01 14:10:47 +02:00
parent 929b001305
commit 26f20b0e3b
4 changed files with 101 additions and 122 deletions
+9 -11
View File
@@ -134,7 +134,7 @@ LOCAL void RF24_setStatus(uint8_t status) {
RF24_writeByteRegister(RF24_STATUS, status);
}
LOCAL void RF24_enableFeatures(void) {
RF24_writeByteRegister(ACTIVATE, 0x73);
RF24_RAW_writeByteRegister(ACTIVATE, 0x73);
}
LOCAL void RF24_openWritingPipe(uint8_t recipient) {
@@ -247,7 +247,7 @@ LOCAL uint8_t RF24_getNodeID(void) {
}
LOCAL bool RF24_sanityCheck(void) {
// detect HW defect ot interrupted SPI line, CE disconnect cannot be detected
// detect HW defect, configuration errors or interrupted SPI line, CE disconnect cannot be detected
bool status = RF24_readByteRegister(RF_SETUP) == MY_RF24_RF_SETUP;
status &= RF24_readByteRegister(RF_CH) == MY_RF24_CHANNEL;
return status;
@@ -273,18 +273,16 @@ LOCAL bool RF24_initialize(void) {
RF24_setChannel(MY_RF24_CHANNEL);
// set data rate and pa level
RF24_setRFSetup(MY_RF24_RF_SETUP);
// sanity check
#if defined(MY_RF24_SANITY_CHECK)
if (!RF24_sanityCheck()) {
RF24_DEBUG(PSTR("RF24:Sanity check failed: configuration mismatch! Check wiring, replace module or non-P version\n"));
return false;
}
#endif
// toggle features (necessary on some clones)
// toggle features (necessary on some clones and non-P versions)
RF24_enableFeatures();
// enable ACK payload and dynamic payload
RF24_setFeature(MY_RF24_FEATURE);
// enable broadcasting pipe
// sanity check (this function is P/non-P independent)
if (!RF24_sanityCheck()) {
RF24_DEBUG(PSTR("!RF24:Sanity check failed: configuration mismatch! Check wiring or replace module\n"));
return false;
}
// enable broadcasting pipe
RF24_setPipe(_BV(ERX_P0 + BROADCAST_PIPE));
// disable AA on all pipes, activate when node pipe set
RF24_setAutoACK(0x00);