
pc -> 2nd board
Dependencies: nRF24L01P
Revision 5:9c5aa92a12e6, committed 2020-12-11
- Comitter:
- voltxd
- Date:
- Fri Dec 11 09:04:57 2020 +0000
- Parent:
- 4:56dc32e15b2b
- Commit message:
- Correction;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
nRF24L01P_Hello_World_L432KC.lib | Show diff for this revision Revisions of this file |
--- 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] ); }
--- a/nRF24L01P_Hello_World_L432KC.lib Fri Dec 11 08:58:10 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://os.mbed.com/teams/Omega-PSL-RoboCup/code/nRF24L01P_Hello_World/#bf4763e880a2