support for auto ACK and retransmissions added

Dependents:   JNP3_IOT_6_RADIO_ECHO_FIXED nRF24L01P_NET_GW nRF24L01P_NET_SENSOR Kubus ... more

Fork of nRF24L01P by Owen Edwards

Files at this revision

API Documentation at this revision

Comitter:
ttajmajer
Date:
Mon Nov 13 08:38:39 2017 +0000
Parent:
7:434a1c2ff406
Child:
9:a7764d1566f7
Commit message:
updates;

Changed in this revision

nRF24L01P.cpp Show annotated file Show diff for this revision Revisions of this file
nRF24L01P.h Show annotated file Show diff for this revision Revisions of this file
--- a/nRF24L01P.cpp	Sun Nov 12 18:53:35 2017 +0000
+++ b/nRF24L01P.cpp	Mon Nov 13 08:38:39 2017 +0000
@@ -220,6 +220,8 @@
     disableAutoAcknowledge();
     disableAutoRetransmit();
     setTransferSize();
+    
+    a_retr_enabled = true;
 
     mode = _NRF24L01P_MODE_POWER_DOWN;
 
@@ -566,6 +568,7 @@
 void nRF24L01P::disableAutoRetransmit(void) {
 
     setRegister(_NRF24L01P_REG_SETUP_RETR, _NRF24L01P_SETUP_RETR_NONE);
+    a_retr_enabled = false;
 
 }
 
@@ -574,6 +577,7 @@
 	count = (0x000F & count);
 
 	setRegister(_NRF24L01P_REG_SETUP_RETR, delay|count);
+	a_retr_enabled = true;
 
 }
 
@@ -906,6 +910,7 @@
 
     // Clear the Status bit
     setRegister(_NRF24L01P_REG_STATUS, _NRF24L01P_STATUS_TX_DS);
+    setRegister(_NRF24L01P_REG_STATUS, _NRF24L01P_STATUS_MAX_RT);
 	
     nCS_ = 0;
 
@@ -927,10 +932,12 @@
     disable();
 
     while ( !( getStatusRegister() & (_NRF24L01P_STATUS_TX_DS | _NRF24L01P_STATUS_MAX_RT) ) ) {
-
     }
     
-    if(getStatusRegister() & _NRF24L01P_STATUS_MAX_RT){
+    int s = getStatusRegister();
+    
+	if (s & _NRF24L01P_STATUS_MAX_RT){
+    	//max retransmissions
     	flushTx();
     	count = -1;
     }
--- a/nRF24L01P.h	Sun Nov 12 18:53:35 2017 +0000
+++ b/nRF24L01P.h	Mon Nov 13 08:38:39 2017 +0000
@@ -354,6 +354,7 @@
     InterruptIn nIRQ_;
 
     int mode;
+    bool a_retr_enabled;
 
 };