My fork during debugging.

Fork of NRF2401P by Malcolm McCulloch

Files at this revision

API Documentation at this revision

Comitter:
defrost
Date:
Fri Apr 15 11:16:36 2016 +0000
Parent:
18:1e0a2fcc4e89
Commit message:
- Added setPwrDown() function which turns off the NRF chip

Changed in this revision

NRF2401P.cpp Show annotated file Show diff for this revision Revisions of this file
NRF2401P.h Show annotated file Show diff for this revision Revisions of this file
diff -r 1e0a2fcc4e89 -r f7e74aa7d663 NRF2401P.cpp
--- a/NRF2401P.cpp	Wed Mar 02 22:45:59 2016 +0000
+++ b/NRF2401P.cpp	Fri Apr 15 11:16:36 2016 +0000
@@ -660,6 +660,29 @@
 }
 
 /**
+* Sets PWR_UP = 1;
+* return 0 on success
+*/
+
+char NRF2401P::setPwrDown()
+{
+    // read the CONFIG register:
+    char data;
+    readReg(CONFIG, &data);
+    // Clear the pwr up bit:
+    data &= ~(0x1 << PWR_UP);
+    // Send the new CONFIG register:
+    writeReg(CONFIG, data);
+    // check to see if it worked:
+    readReg(CONFIG, &data);
+    if(((0x1<<PWR_UP) & data) == 0){
+        return 0;
+    }else{
+        return 1;
+    }
+}
+
+/**
 * Sets PRIM_RX = 0;
 */
 char NRF2401P::setRxMode()
diff -r 1e0a2fcc4e89 -r f7e74aa7d663 NRF2401P.h
--- a/NRF2401P.h	Wed Mar 02 22:45:59 2016 +0000
+++ b/NRF2401P.h	Fri Apr 15 11:16:36 2016 +0000
@@ -160,6 +160,7 @@
     
     void setDynamicPayload();
     char setPwrUp();
+    char setPwrDown();
     
     /**  Set RF data rate and RF output power in TX mode
      *