Maniacbug's nRF24L01+ arduino library ported to mbed. Functional with minor issues.

Files at this revision

API Documentation at this revision

Comitter:
Christilut
Date:
Thu May 23 13:44:14 2013 +0000
Parent:
3:b13cafed7ee5
Child:
5:7463cf21b7fb
Child:
6:56b693b59e16
Commit message:
-

Changed in this revision

nRF24L01P_Maniacbug.cpp Show annotated file Show diff for this revision Revisions of this file
nRF24L01P_Maniacbug.h Show annotated file Show diff for this revision Revisions of this file
--- a/nRF24L01P_Maniacbug.cpp	Thu Apr 25 14:45:45 2013 +0000
+++ b/nRF24L01P_Maniacbug.cpp	Thu May 23 13:44:14 2013 +0000
@@ -393,6 +393,9 @@
   // Flush buffers
   flush_rx();
   flush_tx();
+  
+  // set EN_RXADDRR to 0 to fix pipe 0 from receiving
+  write_register(EN_RXADDR, 0);
 }
 
 /****************************************************************************/
@@ -500,10 +503,10 @@
   // Yay, we are done.
 
   // Power down
-  powerDown();
+//  powerDown();
 
   // Flush buffers (Is this a relic of past experimentation, and not needed anymore?
-  flush_tx();
+//  flush_tx();
 
   return result;
 }
@@ -514,7 +517,7 @@
   // Transmitter power-up
   write_register(CONFIG, ( read_register(CONFIG) | _BV(PWR_UP) ) & ~_BV(PRIM_RX) );
 //  wait_msMicroseconds(150);
-    wait_us(150);
+    wait_us(130);
 
   // Send the payload
   write_payload( buf, len );
@@ -522,7 +525,7 @@
   // Allons!
   ce(HIGH);
 //  wait_msMicroseconds(15);
-    wait_us(15);
+    wait_us(15); 
   ce(LOW);
 }
 
@@ -618,6 +621,8 @@
 
   const uint8_t max_payload_size = 32;
   write_register(RX_PW_P0,min(payload_size,max_payload_size));
+  
+  flush_tx();
 }
 
 /****************************************************************************/
@@ -994,5 +999,3 @@
     else
         return b;
 }
-
-// vim:ai:cin:sts=2 sw=2 ft=cpp
--- a/nRF24L01P_Maniacbug.h	Thu Apr 25 14:45:45 2013 +0000
+++ b/nRF24L01P_Maniacbug.h	Thu May 23 13:44:14 2013 +0000
@@ -215,7 +215,8 @@
    * @param level HIGH to actively begin transmission or LOW to put in standby.  Please see data sheet
    * for a much more detailed description of this pin.
    */
-  void ce(int level);
+  void ce(int level);  
+
 
   /**
    * Read a chunk of data in from a register
@@ -357,7 +358,14 @@
    */
   RF24(PinName mosi, PinName miso, PinName sck, PinName _csnpin, PinName _cepin);
 
-
+  /**
+   * Begin operation of the chip
+   *
+   * Call this in setup(), before calling any other methods.
+   */
+  void begin(void);
+  
+    
   /**
    * Empty the receive buffer
    *
@@ -371,12 +379,6 @@
    * @return Current value of status register
    */
   uint8_t flush_tx(void);
-  /**
-   * Begin operation of the chip
-   *
-   * Call this in setup(), before calling any other methods.
-   */
-  void begin(void);
 
   /**
    * Start listening on the pipes opened for reading.