Skip to content

Commit

Permalink
Added setCRCLength
Browse files Browse the repository at this point in the history
  • Loading branch information
maniacbug committed May 28, 2011
1 parent ec33f03 commit 34efd5a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 11 additions & 0 deletions RF24.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,17 @@ void RF24::setDataRate(rf24_datarate_e speed)
if (speed == RF24_2MBPS)
setup |= RF_DR;
write_register(RF_SETUP,setup);

}

/******************************************************************/

void RF24::setCRCLength(rf24_crclength_e length)
{
uint8_t config = read_register(CONFIG) & _BV(CRCO);
if (length == RF24_CRC_16)
config |= _BV(CRCO);
write_register(CONFIG,config);
}

// vim:ai:cin:sts=2 sw=2 ft=cpp
Expand Down
9 changes: 8 additions & 1 deletion RF24.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <inttypes.h>

typedef enum { RF24_1MBPS = 0, RF24_2MBPS } rf24_datarate_e;
typedef enum { RF24_CRC_8 = 0, RF24_CRC_16 } rf24_crclength_e;

/**
* Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
Expand Down Expand Up @@ -420,7 +421,6 @@ class RF24
*
* @return true if was carrier, false if not
*/

boolean testCarrier(void);

/**
Expand All @@ -429,6 +429,13 @@ class RF24
* @param speed RF24_1MBPS for 1Mbps or RF24_2MBPS for 2Mbps
*/
void setDataRate(rf24_datarate_e speed);

/**
* Set the CRC length
*
* @param length RF24_CRC_8 for 8-bit or RF24_CRC_16 for 16-bit
*/
void setCRCLength(rf24_crclength_e length);

/**@}*/
};
Expand Down

0 comments on commit 34efd5a

Please sign in to comment.