Removed method argument const qualifiers.
This commit is contained in:
parent
b491480dde
commit
85c0f57e3f
32
RF24.cpp
32
RF24.cpp
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
void RF24::csn(const int mode) const
|
void RF24::csn(int mode) const
|
||||||
{
|
{
|
||||||
SPI.setDataMode(SPI_MODE0);
|
SPI.setDataMode(SPI_MODE0);
|
||||||
SPI.setClockDivider(SPI_CLOCK_DIV2);
|
SPI.setClockDivider(SPI_CLOCK_DIV2);
|
||||||
|
@ -35,14 +35,14 @@ void RF24::csn(const int mode) const
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
void RF24::ce(const int level) const
|
void RF24::ce(int level) const
|
||||||
{
|
{
|
||||||
digitalWrite(ce_pin,level);
|
digitalWrite(ce_pin,level);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
uint8_t RF24::read_register(const uint8_t reg, uint8_t* buf, uint8_t len) const
|
uint8_t RF24::read_register(uint8_t reg, uint8_t* buf, uint8_t len) const
|
||||||
{
|
{
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ uint8_t RF24::read_register(const uint8_t reg, uint8_t* buf, uint8_t len) const
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
uint8_t RF24::read_register(const uint8_t reg) const
|
uint8_t RF24::read_register(uint8_t reg) const
|
||||||
{
|
{
|
||||||
csn(LOW);
|
csn(LOW);
|
||||||
SPI.transfer( R_REGISTER | ( REGISTER_MASK & reg ) );
|
SPI.transfer( R_REGISTER | ( REGISTER_MASK & reg ) );
|
||||||
|
@ -70,7 +70,7 @@ uint8_t RF24::read_register(const uint8_t reg) const
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
uint8_t RF24::write_register(const uint8_t reg, const uint8_t* buf, uint8_t len) const
|
uint8_t RF24::write_register(uint8_t reg, const uint8_t* buf, uint8_t len) const
|
||||||
{
|
{
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ uint8_t RF24::write_register(const uint8_t reg, const uint8_t* buf, uint8_t len)
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
uint8_t RF24::write_register(const uint8_t reg, const uint8_t value) const
|
uint8_t RF24::write_register(uint8_t reg, uint8_t value) const
|
||||||
{
|
{
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ void RF24::print_observe_tx(uint8_t value) const
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
RF24::RF24(const uint8_t _cepin, const uint8_t _cspin):
|
RF24::RF24(uint8_t _cepin, uint8_t _cspin):
|
||||||
ce_pin(_cepin), csn_pin(_cspin), wide_band(true), p_variant(false),
|
ce_pin(_cepin), csn_pin(_cspin), wide_band(true), p_variant(false),
|
||||||
payload_size(32), ack_payload_available(false)
|
payload_size(32), ack_payload_available(false)
|
||||||
{
|
{
|
||||||
|
@ -217,7 +217,7 @@ RF24::RF24(const uint8_t _cepin, const uint8_t _cspin):
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
void RF24::setChannel(const uint8_t channel)
|
void RF24::setChannel(uint8_t channel)
|
||||||
{
|
{
|
||||||
if( wide_band ) {
|
if( wide_band ) {
|
||||||
write_register(RF_CH,min(channel,127));
|
write_register(RF_CH,min(channel,127));
|
||||||
|
@ -228,7 +228,7 @@ void RF24::setChannel(const uint8_t channel)
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
void RF24::setPayloadSize(const uint8_t size)
|
void RF24::setPayloadSize(uint8_t size)
|
||||||
{
|
{
|
||||||
payload_size = min(size,32);
|
payload_size = min(size,32);
|
||||||
}
|
}
|
||||||
|
@ -516,7 +516,7 @@ void RF24::openWritingPipe(uint64_t value)
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
void RF24::openReadingPipe(const uint8_t child, const uint64_t address)
|
void RF24::openReadingPipe(uint8_t child, uint64_t address)
|
||||||
{
|
{
|
||||||
const uint8_t child_pipe[] = {
|
const uint8_t child_pipe[] = {
|
||||||
RX_ADDR_P0, RX_ADDR_P1, RX_ADDR_P2, RX_ADDR_P3, RX_ADDR_P4, RX_ADDR_P5 };
|
RX_ADDR_P0, RX_ADDR_P1, RX_ADDR_P2, RX_ADDR_P3, RX_ADDR_P4, RX_ADDR_P5 };
|
||||||
|
@ -589,7 +589,7 @@ void RF24::enableAckPayload(void) const
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
void RF24::writeAckPayload(const uint8_t pipe, const void* buf, uint8_t len) const
|
void RF24::writeAckPayload(uint8_t pipe, const void* buf, uint8_t len) const
|
||||||
{
|
{
|
||||||
const uint8_t* current = (const uint8_t*)buf;
|
const uint8_t* current = (const uint8_t*)buf;
|
||||||
|
|
||||||
|
@ -619,7 +619,7 @@ boolean RF24::isPVariant(void) const {
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
void RF24::setAutoAck(const bool enable) const
|
void RF24::setAutoAck(bool enable) const
|
||||||
{
|
{
|
||||||
if ( enable )
|
if ( enable )
|
||||||
write_register(EN_AA, B111111);
|
write_register(EN_AA, B111111);
|
||||||
|
@ -629,7 +629,7 @@ void RF24::setAutoAck(const bool enable) const
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
void RF24::setAutoAck( const uint8_t pipe, const bool enable ) const
|
void RF24::setAutoAck( uint8_t pipe, bool enable ) const
|
||||||
{
|
{
|
||||||
uint8_t en_aa = read_register( EN_AA ) ;
|
uint8_t en_aa = read_register( EN_AA ) ;
|
||||||
if( enable ) {
|
if( enable ) {
|
||||||
|
@ -656,7 +656,7 @@ boolean RF24::testRPD(void) const
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
void RF24::setPALevel(const rf24_pa_dbm_e level) const
|
void RF24::setPALevel(rf24_pa_dbm_e level) const
|
||||||
{
|
{
|
||||||
uint8_t setup = read_register(RF_SETUP) ;
|
uint8_t setup = read_register(RF_SETUP) ;
|
||||||
setup &= ~(_BV(RF_PWR_LOW) | _BV(RF_PWR_HIGH)) ;
|
setup &= ~(_BV(RF_PWR_LOW) | _BV(RF_PWR_HIGH)) ;
|
||||||
|
@ -718,7 +718,7 @@ rf24_pa_dbm_e RF24::getPALevel(void) const
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
boolean RF24::setDataRate(const rf24_datarate_e speed)
|
boolean RF24::setDataRate(rf24_datarate_e speed)
|
||||||
{
|
{
|
||||||
uint8_t setup = read_register(RF_SETUP) ;
|
uint8_t setup = read_register(RF_SETUP) ;
|
||||||
|
|
||||||
|
@ -786,7 +786,7 @@ rf24_datarate_e RF24::getDataRate( void ) const {
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
void RF24::setCRCLength(const rf24_crclength_e length) const
|
void RF24::setCRCLength(rf24_crclength_e length) const
|
||||||
{
|
{
|
||||||
uint8_t config = read_register(CONFIG) & _BV(CRCO);
|
uint8_t config = read_register(CONFIG) & _BV(CRCO);
|
||||||
if (length == RF24_CRC_16)
|
if (length == RF24_CRC_16)
|
||||||
|
|
30
RF24.h
30
RF24.h
|
@ -50,7 +50,7 @@ protected:
|
||||||
*
|
*
|
||||||
* @param mode HIGH to take this unit off the SPI bus, LOW to put it on
|
* @param mode HIGH to take this unit off the SPI bus, LOW to put it on
|
||||||
*/
|
*/
|
||||||
void csn(const int mode) const ;
|
void csn(int mode) const ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set chip enable
|
* Set chip enable
|
||||||
|
@ -58,7 +58,7 @@ protected:
|
||||||
* @param level HIGH to actively begin transmission or LOW to put in standby. Please see data sheet
|
* @param level HIGH to actively begin transmission or LOW to put in standby. Please see data sheet
|
||||||
* for a much more detailed description of this pin.
|
* for a much more detailed description of this pin.
|
||||||
*/
|
*/
|
||||||
void ce(const int level) const ;
|
void ce(int level) const ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a chunk of data in from a register
|
* Read a chunk of data in from a register
|
||||||
|
@ -68,7 +68,7 @@ protected:
|
||||||
* @param len How many bytes of data to transfer
|
* @param len How many bytes of data to transfer
|
||||||
* @return Current value of status register
|
* @return Current value of status register
|
||||||
*/
|
*/
|
||||||
uint8_t read_register(const uint8_t reg, uint8_t* buf, uint8_t len) const ;
|
uint8_t read_register(uint8_t reg, uint8_t* buf, uint8_t len) const ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read single byte from a register
|
* Read single byte from a register
|
||||||
|
@ -76,7 +76,7 @@ protected:
|
||||||
* @param reg Which register. Use constants from nRF24L01.h
|
* @param reg Which register. Use constants from nRF24L01.h
|
||||||
* @return Current value of register @p reg
|
* @return Current value of register @p reg
|
||||||
*/
|
*/
|
||||||
uint8_t read_register(const uint8_t reg) const ;
|
uint8_t read_register(uint8_t reg) const ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a chunk of data to a register
|
* Write a chunk of data to a register
|
||||||
|
@ -86,7 +86,7 @@ protected:
|
||||||
* @param len How many bytes of data to transfer
|
* @param len How many bytes of data to transfer
|
||||||
* @return Current value of status register
|
* @return Current value of status register
|
||||||
*/
|
*/
|
||||||
uint8_t write_register(const uint8_t reg, const uint8_t* buf, uint8_t len) const ;
|
uint8_t write_register(uint8_t reg, const uint8_t* buf, uint8_t len) const ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a single byte to a register
|
* Write a single byte to a register
|
||||||
|
@ -95,7 +95,7 @@ protected:
|
||||||
* @param value The new value to write
|
* @param value The new value to write
|
||||||
* @return Current value of status register
|
* @return Current value of status register
|
||||||
*/
|
*/
|
||||||
uint8_t write_register(const uint8_t reg, const uint8_t value) const ;
|
uint8_t write_register(uint8_t reg, uint8_t value) const ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the transmit payload
|
* Write the transmit payload
|
||||||
|
@ -195,7 +195,7 @@ public:
|
||||||
* @param _cspin The pin attached to Chip Select
|
* @param _cspin The pin attached to Chip Select
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
RF24(const uint8_t _cepin, const uint8_t _cspin) ;
|
RF24(uint8_t _cepin, uint8_t _cspin) ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Begin operation of the chip
|
* Begin operation of the chip
|
||||||
|
@ -304,7 +304,7 @@ public:
|
||||||
* @param number Which pipe# to open, 0-5.
|
* @param number Which pipe# to open, 0-5.
|
||||||
* @param address The 40-bit address of the pipe to open.
|
* @param address The 40-bit address of the pipe to open.
|
||||||
*/
|
*/
|
||||||
void openReadingPipe(const uint8_t number, const uint64_t address);
|
void openReadingPipe(uint8_t number, uint64_t address);
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
/**
|
/**
|
||||||
|
@ -335,7 +335,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param size The number of bytes in the payload
|
* @param size The number of bytes in the payload
|
||||||
*/
|
*/
|
||||||
void setPayloadSize(const uint8_t size);
|
void setPayloadSize(uint8_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Payload Size
|
* Get Payload Size
|
||||||
|
@ -396,7 +396,7 @@ public:
|
||||||
* @param len Length of the data to send, up to 32 bytes max. Not affected
|
* @param len Length of the data to send, up to 32 bytes max. Not affected
|
||||||
* by the static payload set by setPayloadSize().
|
* by the static payload set by setPayloadSize().
|
||||||
*/
|
*/
|
||||||
void writeAckPayload(const uint8_t pipe, const void* buf, uint8_t len) const ;
|
void writeAckPayload(uint8_t pipe, const void* buf, uint8_t len) const ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if an ack payload was received in the most recent call to
|
* Determine if an ack payload was received in the most recent call to
|
||||||
|
@ -427,7 +427,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param enable Whether to enable (true) or disable (false) auto-acks
|
* @param enable Whether to enable (true) or disable (false) auto-acks
|
||||||
*/
|
*/
|
||||||
void setAutoAck(const bool enable) const ;
|
void setAutoAck(bool enable) const ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable auto-acknowlede packets on a per pipeline basis.
|
* Enable or disable auto-acknowlede packets on a per pipeline basis.
|
||||||
|
@ -438,7 +438,7 @@ public:
|
||||||
* @param which pipeline to modify
|
* @param which pipeline to modify
|
||||||
* @param enable Whether to enable (true) or disable (false) auto-acks
|
* @param enable Whether to enable (true) or disable (false) auto-acks
|
||||||
*/
|
*/
|
||||||
void setAutoAck( const uint8_t pipe, const bool enable ) const ;
|
void setAutoAck( uint8_t pipe, bool enable ) const ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether there was a carrier on the line for the
|
* Test whether there was a carrier on the line for the
|
||||||
|
@ -471,7 +471,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param Desired PA level.
|
* @param Desired PA level.
|
||||||
*/
|
*/
|
||||||
void setPALevel( const rf24_pa_dbm_e level ) const ;
|
void setPALevel( rf24_pa_dbm_e level ) const ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the current PA level.
|
* Fetches the current PA level.
|
||||||
|
@ -488,7 +488,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param speed RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
|
* @param speed RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
|
||||||
*/
|
*/
|
||||||
boolean setDataRate(const rf24_datarate_e speed);
|
boolean setDataRate(rf24_datarate_e speed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the transmission data rate
|
* Set the transmission data rate
|
||||||
|
@ -504,7 +504,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param length RF24_CRC_8 for 8-bit or RF24_CRC_16 for 16-bit
|
* @param length RF24_CRC_8 for 8-bit or RF24_CRC_16 for 16-bit
|
||||||
*/
|
*/
|
||||||
void setCRCLength(const rf24_crclength_e length) const ;
|
void setCRCLength(rf24_crclength_e length) const ;
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue