Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of RF24 by
Revision 8:6827b6f0283b, committed 2016-07-28
- Comitter:
- adam_z
- Date:
- Thu Jul 28 08:10:31 2016 +0000
- Parent:
- 7:32d6957f37ae
- Commit message:
- RF24 lib modified from https://developer.mbed.org/users/akashvibhute/code/RF24/docs/tip/RF24_8cpp_source.html
Changed in this revision
RF24.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/RF24.cpp Thu Jun 16 08:56:06 2016 +0000 +++ b/RF24.cpp Thu Jul 28 08:10:31 2016 +0000 @@ -26,42 +26,7 @@ csn_pin = mode; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + } /****************************************************************************/ @@ -96,25 +61,6 @@ uint8_t status; - - - - - - - - - - - - - - - - - - - beginTransaction(); status = spi.write( R_REGISTER | ( REGISTER_MASK & reg ) ); @@ -134,20 +80,6 @@ { uint8_t result; - - - - - - - - - - - - - - beginTransaction(); spi.write( R_REGISTER | ( REGISTER_MASK & reg ) ); @@ -164,21 +96,7 @@ uint8_t RF24::write_register(uint8_t reg, const uint8_t* buf, uint8_t len) { uint8_t status; - - - - - - - - - - - - - - - + beginTransaction(); status = spi.write( W_REGISTER | ( REGISTER_MASK & reg ) ); @@ -200,17 +118,6 @@ IF_SERIAL_DEBUG(printf_P(PSTR("write_register(%02x,%02x)\r\n"),reg,value)); - - - - - - - - - - - beginTransaction(); status = spi.write( W_REGISTER | ( REGISTER_MASK & reg ) ); spi.write(value); @@ -235,24 +142,6 @@ IF_SERIAL_DEBUG( printf("[Writing %u bytes %u blanks]\n",data_len,blank_len); ); - - - - - - - - - - - - - - - - - - beginTransaction(); status = spi.write( writeType ); while ( data_len-- ) { @@ -283,30 +172,6 @@ IF_SERIAL_DEBUG( printf("[Reading %u bytes %u blanks]\n",data_len,blank_len); ); - - - - - - - - - - - - - - - - - - - - - - - - beginTransaction(); status = spi.write( R_RX_PAYLOAD ); @@ -430,7 +295,7 @@ pipe0_reading_address[0]=0; //spi.frequency(10000000/5); // 2Mbit, 1/5th the maximum transfer rate for the spi bus - spi.frequency(10000000); + spi.frequency(10000000/5); //spi.format(8,0); // 8-bit, ClockPhase = 0, ClockPolarity = 0 spi.format(8,0); wait_ms(10); @@ -524,37 +389,6 @@ { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - print_status(get_status()); print_address_register(PSTR("RX_ADDR_P0-1"),RX_ADDR_P0,2); @@ -594,42 +428,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Must allow the radio time to settle else configuration bits will not necessarily stick. // This is actually only required following power up but some settling time also appears to // be required after resets too. For full coverage, we'll always assume the worst. @@ -664,10 +462,10 @@ // Then set the data rate to the slowest (and most reliable) speed supported by all // hardware. //setDataRate( RF24_1MBPS ) ; - setDataRate( RF24_2MBPS ) ; + setDataRate( RF24_1MBPS ) ; // Initialize CRC and request 2-byte (16bit) CRC - //setCRCLength( RF24_CRC_16 ) ; + setCRCLength( RF24_CRC_16 ) ; // Disable dynamic payloads, to match dynamic_payloads_enabled setting - Reset value is 0 toggle_features(); @@ -744,12 +542,6 @@ write_register(NRF_CONFIG, ( read_register(NRF_CONFIG) ) & ~_BV(PRIM_RX) ); - - - - - - write_register(EN_RXADDR,read_register(EN_RXADDR) | _BV(pgm_read_byte(&child_pipe_enable[0]))); // Enable RX on pipe0 //delayMicroseconds(100); @@ -1044,13 +836,6 @@ uint8_t result = 0; - - - - - - - beginTransaction(); spi.write( R_RX_PL_WID ); result = spi.write(0xff); @@ -1300,17 +1085,7 @@ uint8_t data_len = rf24_min(len,32); - - - - - - - - - - - + beginTransaction(); spi.write(W_ACK_PAYLOAD | ( pipe & 0b111 ) );