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:
Thu Dec 21 13:01:40 2017 +0000
Parent:
8:f8621be17645
Commit message:
added support for dynamic payload

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	Mon Nov 13 08:38:39 2017 +0000
+++ b/nRF24L01P.cpp	Thu Dec 21 13:01:40 2017 +0000
@@ -564,6 +564,33 @@
 
 }
 
+void nRF24L01P::enableDynamicPayload(int pipe) {
+
+    if ( ( pipe < NRF24L01P_PIPE_P0 ) || ( pipe > NRF24L01P_PIPE_P5 ) ) {
+
+        error( "nRF24L01P: Invalid Enable AutoAcknowledge pipe number %d\r\n", pipe );
+        return;
+
+    }
+    
+    int feature = getRegister(_NRF24L01P_REG_FEATURE);
+    feature |= ( 1 << 2 );
+    setRegister(_NRF24L01P_REG_FEATURE, feature);
+
+    int dynpd = getRegister(_NRF24L01P_REG_DYNPD);
+    dynpd |= ( 1 << (pipe - NRF24L01P_PIPE_P0) );
+    setRegister(_NRF24L01P_REG_DYNPD, dynpd);
+
+}
+
+
+void nRF24L01P::disableDynamicPayload(void) {
+    
+    int feature = getRegister(_NRF24L01P_REG_FEATURE);
+    feature &= !( 1 << 2 );
+    setRegister(_NRF24L01P_REG_FEATURE, feature);
+}
+
 
 void nRF24L01P::disableAutoRetransmit(void) {
 
--- a/nRF24L01P.h	Mon Nov 13 08:38:39 2017 +0000
+++ b/nRF24L01P.h	Thu Dec 21 13:01:40 2017 +0000
@@ -320,6 +320,9 @@
      */
     void enableAutoRetransmit(int delay, int count);
     
+    void enableDynamicPayload(int pipe);
+    void disableDynamicPayload(void);
+    
     void flushRx(void);
     void flushTx(void);
     uint8_t getRSSI(void);