astyle -A1 -s2
This commit is contained in:
parent
602d96264a
commit
14c34ca2e4
25
RF24.cpp
25
RF24.cpp
|
@ -355,7 +355,8 @@ void RF24::begin(void)
|
||||||
// reset our data rate back to default value. This works
|
// reset our data rate back to default value. This works
|
||||||
// because a non-P variant won't allow the data rate to
|
// because a non-P variant won't allow the data rate to
|
||||||
// be set to 250Kbps.
|
// be set to 250Kbps.
|
||||||
if( setDataRate( RF24_250KBPS ) ) {
|
if( setDataRate( RF24_250KBPS ) )
|
||||||
|
{
|
||||||
p_variant = true ;
|
p_variant = true ;
|
||||||
}
|
}
|
||||||
setDataRate( RF24_2MBPS ) ;
|
setDataRate( RF24_2MBPS ) ;
|
||||||
|
@ -715,7 +716,8 @@ bool RF24::isAckPayloadAvailable(void)
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
boolean RF24::isPVariant(void) {
|
boolean RF24::isPVariant(void)
|
||||||
|
{
|
||||||
return p_variant ;
|
return p_variant ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,9 +738,12 @@ void RF24::setAutoAck( uint8_t pipe, bool enable )
|
||||||
if ( pipe <= 6 )
|
if ( pipe <= 6 )
|
||||||
{
|
{
|
||||||
uint8_t en_aa = read_register( EN_AA ) ;
|
uint8_t en_aa = read_register( EN_AA ) ;
|
||||||
if( enable ) {
|
if( enable )
|
||||||
|
{
|
||||||
en_aa |= _BV(pipe) ;
|
en_aa |= _BV(pipe) ;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
en_aa &= ~_BV(pipe) ;
|
en_aa &= ~_BV(pipe) ;
|
||||||
}
|
}
|
||||||
write_register( EN_AA, en_aa ) ;
|
write_register( EN_AA, en_aa ) ;
|
||||||
|
@ -856,7 +861,8 @@ boolean RF24::setDataRate(rf24_datarate_e speed)
|
||||||
|
|
||||||
// Verify our result
|
// Verify our result
|
||||||
setup = read_register(RF_SETUP) ;
|
setup = read_register(RF_SETUP) ;
|
||||||
if( setup == setup ) {
|
if( setup == setup )
|
||||||
|
{
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,12 +872,14 @@ boolean RF24::setDataRate(rf24_datarate_e speed)
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
rf24_datarate_e RF24::getDataRate( void ) {
|
rf24_datarate_e RF24::getDataRate( void )
|
||||||
|
{
|
||||||
rf24_datarate_e result ;
|
rf24_datarate_e result ;
|
||||||
uint8_t setup = read_register(RF_SETUP) ;
|
uint8_t setup = read_register(RF_SETUP) ;
|
||||||
|
|
||||||
// Order matters in our case below
|
// Order matters in our case below
|
||||||
switch( setup & (_BV(RF_DR_LOW) | _BV(RF_DR_HIGH)) ) {
|
switch( setup & (_BV(RF_DR_LOW) | _BV(RF_DR_HIGH)) )
|
||||||
|
{
|
||||||
case _BV(RF_DR_LOW):
|
case _BV(RF_DR_LOW):
|
||||||
// '10' = 250KBPS
|
// '10' = 250KBPS
|
||||||
result = RF24_250KBPS ;
|
result = RF24_250KBPS ;
|
||||||
|
@ -902,7 +910,8 @@ void RF24::setCRCLength(rf24_crclength_e length)
|
||||||
|
|
||||||
// Now config 8 or 16 bit CRCs - only 16bit need be turned on
|
// Now config 8 or 16 bit CRCs - only 16bit need be turned on
|
||||||
// 8b is the default.
|
// 8b is the default.
|
||||||
if( length == RF24_CRC_16 ) {
|
if( length == RF24_CRC_16 )
|
||||||
|
{
|
||||||
config |= _BV( CRCO ) ;
|
config |= _BV( CRCO ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue