JNP3_IOT_2018Z / nRF24L01P_v2

Dependents:   JNP3_IOT_6_RADIO_ECHO_FIXED2_2

Revision:
9:1440769ba2f9
Parent:
8:f8621be17645
--- 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);