radio echo app

Dependents:   JNP3_IOT_6_RADIO_ECHO_FIXED2

Files at this revision

API Documentation at this revision

Comitter:
ttajmajer
Date:
Fri Nov 16 10:56:46 2018 +0000
Parent:
8:f8621be17645
Commit message:
cleaning;

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	Fri Nov 16 10:56:46 2018 +0000
@@ -565,6 +565,34 @@
 }
 
 
+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) {
 
     setRegister(_NRF24L01P_REG_SETUP_RETR, _NRF24L01P_SETUP_RETR_NONE);
--- a/nRF24L01P.h	Mon Nov 13 08:38:39 2017 +0000
+++ b/nRF24L01P.h	Fri Nov 16 10:56:46 2018 +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);