Added setDataRate()
This commit is contained in:
parent
a6e7444059
commit
4131420de7
10
RF24.cpp
10
RF24.cpp
|
@ -608,5 +608,15 @@ boolean RF24::testCarrier(void)
|
||||||
return ( read_register(CD) & 1 );
|
return ( read_register(CD) & 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************/
|
||||||
|
|
||||||
|
void RF24::setDataRate(rf24_datarate_e speed)
|
||||||
|
{
|
||||||
|
uint8_t setup = read_register(RF_SETUP) & RF_DR;
|
||||||
|
if (speed == RF24_2MBPS)
|
||||||
|
setup |= RF_DR;
|
||||||
|
write_register(RF_SETUP,setup);
|
||||||
|
}
|
||||||
|
|
||||||
// vim:ai:cin:sts=2 sw=2 ft=cpp
|
// vim:ai:cin:sts=2 sw=2 ft=cpp
|
||||||
|
|
||||||
|
|
9
RF24.h
9
RF24.h
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
typedef enum { RF24_1MBPS = 0, RF24_2MBPS } rf24_datarate_e;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
|
* Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
|
||||||
*/
|
*/
|
||||||
|
@ -421,6 +423,13 @@ public:
|
||||||
|
|
||||||
boolean testCarrier(void);
|
boolean testCarrier(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the transmission data rate
|
||||||
|
*
|
||||||
|
* @param speed RF24_1MBPS for 1Mbps or RF24_2MBPS for 2Mbps
|
||||||
|
*/
|
||||||
|
void setDataRate(rf24_datarate_e speed);
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue