Making it work for the FRDM K64F

Dependencies:   mbed nRF24L01P

Fork of nRF24L01P_Hello_World by Owen Edwards

Files at this revision

API Documentation at this revision

Comitter:
ewoud
Date:
Wed Dec 16 22:35:59 2015 +0000
Parent:
1:5be2682710c6
Commit message:
Wireless serial communication between FRDM K64F boards using the nF24L01P chip

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 5be2682710c6 -r f32f686460b2 main.cpp
--- a/main.cpp	Wed Jan 19 23:53:19 2011 +0000
+++ b/main.cpp	Wed Dec 16 22:35:59 2015 +0000
@@ -3,13 +3,13 @@
 
 Serial pc(USBTX, USBRX); // tx, rx
 
-nRF24L01P my_nrf24l01p(p5, p6, p7, p8, p9, p10);    // mosi, miso, sck, csn, ce, irq
+nRF24L01P my_nrf24l01p(PTD6, PTD7, PTD5, PTD4, PTB12, PTC18);    // mosi, miso, sck, csn, ce, irq
 
-DigitalOut myled1(LED1);
-DigitalOut myled2(LED2);
+//DigitalOut myled1(LED1);
+//DigitalOut myled2(LED2);
 
 int main() {
-
+    
 // The nRF24L01+ supports transfers from 1 to 32 bytes, but Sparkfun's
 //  "Nordic Serial Interface Board" (http://www.sparkfun.com/products/9019)
 //  only handles 4 byte transfers in the ATMega code.
@@ -18,9 +18,9 @@
     char txData[TRANSFER_SIZE], rxData[TRANSFER_SIZE];
     int txDataCnt = 0;
     int rxDataCnt = 0;
-
+    my_nrf24l01p.setRfFrequency(2400);
     my_nrf24l01p.powerUp();
-
+    //my_nrf24l01p.setRfFrequency(2400);
     // Display the (default) setup of the nRF24L01+ chip
     pc.printf( "nRF24L01+ Frequency    : %d MHz\r\n",  my_nrf24l01p.getRfFrequency() );
     pc.printf( "nRF24L01+ Output power : %d dBm\r\n",  my_nrf24l01p.getRfOutputPower() );
@@ -42,18 +42,20 @@
 
             // ...add it to the transmit buffer
             txData[txDataCnt++] = pc.getc();
-
+            printf(txData);
+            printf("\n\r");
             // If the transmit buffer is full
             if ( txDataCnt >= sizeof( txData ) ) {
-
+                //myled1 = !myled1;
                 // Send the transmitbuffer via the nRF24L01+
                 my_nrf24l01p.write( NRF24L01P_PIPE_P0, txData, txDataCnt );
 
                 txDataCnt = 0;
+                // Toggle LED1 (to help debug Host -> nRF24L01+ communication)
+                
             }
 
-            // Toggle LED1 (to help debug Host -> nRF24L01+ communication)
-            myled1 = !myled1;
+            
         }
 
         // If we've received anything in the nRF24L01+...
@@ -69,7 +71,7 @@
             }
 
             // Toggle LED2 (to help debug nRF24L01+ -> Host communication)
-            myled2 = !myled2;
+            //myled2 = !myled2;
         }
     }
 }
diff -r 5be2682710c6 -r f32f686460b2 mbed.bld
--- a/mbed.bld	Wed Jan 19 23:53:19 2011 +0000
+++ b/mbed.bld	Wed Dec 16 22:35:59 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
+http://mbed.org/users/mbed_official/code/mbed/builds/165afa46840b
\ No newline at end of file