pc -> 2nd board

Dependencies:   nRF24L01P

Revision:
5:9c5aa92a12e6
Parent:
4:56dc32e15b2b
--- a/main.cpp	Fri Dec 11 08:58:10 2020 +0000
+++ b/main.cpp	Fri Dec 11 09:04:57 2020 +0000
@@ -56,16 +56,41 @@
     my_nrf24l01p.setReceiveMode();
     my_nrf24l01p.enable();
 
+    pc.printf( "Type keys to test transfers:\r\n  (transfers are grouped into %d characters)\r\n", TRANSFER_SIZE );
+
     while (1) 
     {
+        // If we've received anything over the host serial link...
+        if ( pc.readable() ) 
+        {
+
+            // ...add it to the transmit buffer
+            txData[txDataCnt++] = pc.getc();
+
+            // If the transmit buffer is full
+            if ( txDataCnt >= sizeof( txData ) ) 
+            {
+
+                // Send the transmitbuffer via the nRF24L01+
+                my_nrf24l01p.write( NRF24L01P_PIPE_P0, txData, txDataCnt );
+
+                txDataCnt = 0;
+            }
+
+            // Toggle LED1 (to help debug Host -> nRF24L01+ communication)
+            myled1 = !myled1;
+        }
+
         // If we've received anything in the nRF24L01+...
-        if ( my_nrf24l01p.readable() ) {
+        if ( my_nrf24l01p.readable() ) 
+        {
 
             // ...read the data into the receive buffer
             rxDataCnt = my_nrf24l01p.read( NRF24L01P_PIPE_P0, rxData, sizeof( rxData ) );
 
             // Display the receive buffer contents via the host serial link
-            for ( int i = 0; rxDataCnt > 0; rxDataCnt--, i++ ) {
+            for ( int i = 0; rxDataCnt > 0; rxDataCnt--, i++ ) 
+            {
 
                 pc.putc( rxData[i] );
             }