My fork during debugging.

Fork of NRF2401P by Malcolm McCulloch

Revision:
14:976a876819ae
Parent:
13:5cbc726f2bbb
Child:
16:a9b83d2b6915
--- a/NRF2401P.cpp	Sat Jul 11 21:20:56 2015 +0000
+++ b/NRF2401P.cpp	Sat Jul 11 22:17:36 2015 +0000
@@ -283,7 +283,6 @@
 **/
 void NRF2401P::writeReg( char address, char data )
 {
-    char status = 0;
     char reg;
     csn = 0;
     address &= 0x1F;
@@ -556,26 +555,24 @@
     return isData;
 }
 
-/**
-* returns the width of the dynamic payload
-*/
 char NRF2401P::getRxWidth()
 {
     char width;
     if (dynamic) {
         csn = 0;
-        status = spi->write( 0x60 );
+        status = spi->write( R_RX_PL_WID );
         width = spi->write(0x00);
         csn = 1;
 
-        if (width>32) {
+        if (width>32) {             // as per product spec
             flushRx();
+            wait(0.002f);           // little delay (KJN)
             width=0;
         }
     } else {
         readReg(RX_PW_P1, &width); // width of p1
     }
-    // width=18;
+    
     return width;
 }
 
@@ -734,7 +731,7 @@
 }
 
 void NRF2401P::printDetails() {
-    char status = checkStatus();
+    status = checkStatus();
     printf("STATUS = 0x%02x RX_DR=%x TX_DS=%x MAX_RT=%x RX_P_NO=%x TX_FULL=%x\r\n", status,
            (status & (1<<MASK_RX_DR))?1:0,
            (status & (1<<MASK_TX_DS))?1:0,