Test program for the Nordic Semi nRF24L01 Transceiver Module (http://www.sparkfun.com/products/691), talking to another module connected to SparkFun\'s Nordic Serial Interface Board (http://www.sparkfun.com/products/9019).

Dependencies:   mbed nRF24L01P

Files at this revision

API Documentation at this revision

Comitter:
ViriJay
Date:
Fri Jan 11 10:57:48 2019 +0000
Parent:
11:004792c2729a
Commit message:
ART params

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Dec 19 13:03:34 2018 +0000
+++ b/main.cpp	Fri Jan 11 10:57:48 2019 +0000
@@ -61,10 +61,11 @@
     }
 }
 
-void senderTest(int frequency, int outputPower, int dataRate, bool art) {
+void senderTest(int frequency, int outputPower, int dataRate, int delay, int count) {
     my_nrf24l01p.setRfFrequency(frequency);
     my_nrf24l01p.setRfOutputPower(outputPower);
     my_nrf24l01p.setAirDataRate(dataRate);
+    my_nrf24l01p.enableAutoRetransmit(delay, count);
     
     char txData[TRANSFER_SIZE];
     int txDataCnt = 0;
@@ -118,7 +119,6 @@
         pc.printf(">> Receiving Modus << \n\r");
         while (reading) {
             if ( my_nrf24l01p.readable() ) {
-                pc.printf("Readable\n\r");
                 rxDataCnt = my_nrf24l01p.read( NRF24L01P_PIPE_P0, rxData, sizeof( rxData ) );
                 for (int i = 0; i < rxDataCnt; i++) {
                     char c = rxData[i];
@@ -145,20 +145,24 @@
     else { // Transmit mode
        pc.printf(">> Sending Modus << \n\r");
        // Frequency test
-       pc.printf("FREQUENCY TEST \n\r");
-       senderTest(2400, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_1_MBPS, false);
-      // senderTest(2463, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_2_MBPS, false);
-//       senderTest(2525, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_2_MBPS, false);
+       //pc.printf("FREQUENCY TEST \n\r");
+       //senderTest(2400, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_1_MBPS, false);
+       //senderTest(2463, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_1_MBPS, false);
+       //senderTest(2525, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_1_MBPS, false);
 //       // Power (dBm) test
-//       pc.printf("OUTPUT POWER TEST");
-//       senderTest(2400, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_2_MBPS, false);
-//       senderTest(2400, NRF24L01P_TX_PWR_MINUS_6_DB, NRF24L01P_DATARATE_2_MBPS, false);
-//       senderTest(2400, NRF24L01P_TX_PWR_MINUS_12_DB, NRF24L01P_DATARATE_2_MBPS, false);
-//       senderTest(2400, NRF24L01P_TX_PWR_MINUS_18_DB, NRF24L01P_DATARATE_2_MBPS, false);
+       pc.printf("OUTPUT POWER TEST");
+       senderTest(2402, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_1_MBPS, 0, 0);
+//       senderTest(2402, NRF24L01P_TX_PWR_MINUS_6_DB, NRF24L01P_DATARATE_1_MBPS, 0, 0);
+//       senderTest(2402, NRF24L01P_TX_PWR_MINUS_12_DB, NRF24L01P_DATARATE_1_MBPS, 0 ,0);
+//       senderTest(2402, NRF24L01P_TX_PWR_MINUS_18_DB, NRF24L01P_DATARATE_1_MBPS, 0, 0);
 //       // Data rate test
 //       pc.printf("DATARATE TEST");
-//       senderTest(2400, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_250_KBPS, false);
-//       senderTest(2400, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_1_MBPS, false);
-//       senderTest(2400, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_2_MBPS, false);
+//       senderTest(2402, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_250_KBPS, false);
+//       senderTest(2402, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_1_MBPS, false);
+//       senderTest(2402, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_2_MBPS, false);
+//        pc.printf("ART DELAY TEST");
+//        senderTest(2402, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_1_MBPS, 0, 8);
+//       senderTest(2402, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_1_MBPS, 8, 8);
+//       senderTest(2402, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_1_MBPS, 15, 8);
     }
 }
\ No newline at end of file