support for auto ACK and retransmissions added

Dependents:   JNP3_IOT_6_RADIO_ECHO_FIXED nRF24L01P_NET_GW nRF24L01P_NET_SENSOR Kubus ... more

Fork of nRF24L01P by Owen Edwards

Files at this revision

API Documentation at this revision

Comitter:
ttajmajer
Date:
Sun Nov 12 18:53:35 2017 +0000
Parent:
6:5c0431c2ed79
Child:
8:f8621be17645
Commit message:
added flushrx/tx

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 06 08:43:40 2017 +0000
+++ b/nRF24L01P.cpp	Sun Nov 12 18:53:35 2017 +0000
@@ -930,9 +930,10 @@
 
     }
     
-    if(getStatusRegister() & _NRF24L01P_STATUS_MAX_RT)
+    if(getStatusRegister() & _NRF24L01P_STATUS_MAX_RT){
+    	flushTx();
     	count = -1;
-    
+    }
 
     // Clear the Status bit
     setRegister(_NRF24L01P_REG_STATUS, _NRF24L01P_STATUS_TX_DS);
@@ -1035,6 +1036,36 @@
 
 }
 
+bool nRF24L01P::getRPD(){
+    uint8_t rpd = getRegister(_NRF24L01P_REG_RPD);
+    return (rpd>0);
+}
+ 
+uint8_t nRF24L01P::getRSSI(){
+    uint8_t rssi =0;
+    for(int i=0; i<256; i++){
+        rssi += getRPD();
+        wait_us(50);
+        flushRx();
+    }
+    return rssi;
+}
+
+void nRF24L01P::flushRx(void)
+{
+    nCS_ = 0;
+    spi_.write(_NRF24L01P_SPI_CMD_FLUSH_RX);
+    nCS_ = 1;
+}
+ 
+void nRF24L01P::flushTx(void)
+{
+    nCS_ = 0;
+    spi_.write(_NRF24L01P_SPI_CMD_FLUSH_TX);
+    nCS_ = 1;
+}
+
+
 void nRF24L01P::setRegister(int regAddress, int regData) {
 
     //
--- a/nRF24L01P.h	Mon Nov 06 08:43:40 2017 +0000
+++ b/nRF24L01P.h	Sun Nov 12 18:53:35 2017 +0000
@@ -319,7 +319,10 @@
      * @param count number of retransmits before generating an error (1..15)
      */
     void enableAutoRetransmit(int delay, int count);
-
+    
+    void flushRx(void);
+    void flushTx(void);
+    uint8_t getRSSI(void);
 private:
 
     /**