Added setRetries()
This commit is contained in:
parent
1c6cc96fb7
commit
a22906f961
7
RF24.cpp
7
RF24.cpp
|
@ -631,5 +631,12 @@ void RF24::setCRCLength(rf24_crclength_e length)
|
||||||
write_register(CONFIG,config);
|
write_register(CONFIG,config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************/
|
||||||
|
|
||||||
|
void RF24::setRetries(uint8_t delay, uint8_t count)
|
||||||
|
{
|
||||||
|
write_register(SETUP_RETR,(delay&0xf)<<ARD | (count&0xf)<<ARC);
|
||||||
|
}
|
||||||
|
|
||||||
// vim:ai:cin:sts=2 sw=2 ft=cpp
|
// vim:ai:cin:sts=2 sw=2 ft=cpp
|
||||||
|
|
||||||
|
|
9
RF24.h
9
RF24.h
|
@ -332,6 +332,15 @@ public:
|
||||||
*/
|
*/
|
||||||
/**@{*/
|
/**@{*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number and delay of retries upon failed submit
|
||||||
|
*
|
||||||
|
* @param delay How long to wait between each retry, in multiples of 250us,
|
||||||
|
* max is 15. 0 means 250us, 15 means 4000us.
|
||||||
|
* @param count How many retries before giving up, max 15
|
||||||
|
*/
|
||||||
|
void setRetries(uint8_t delay, uint8_t count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set RF communication channel
|
* Set RF communication channel
|
||||||
*
|
*
|
||||||
|
|
|
@ -90,6 +90,12 @@ void setup(void)
|
||||||
|
|
||||||
radio.begin();
|
radio.begin();
|
||||||
|
|
||||||
|
// optionally, increase the delay between retries & # of retries
|
||||||
|
radio.setRetries(15,15);
|
||||||
|
|
||||||
|
// optionally, use a high channel to avoid WiFi chatter
|
||||||
|
radio.setChannel(110);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Open pipes to other nodes for communication
|
// Open pipes to other nodes for communication
|
||||||
//
|
//
|
||||||
|
@ -201,4 +207,4 @@ void loop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// vim:ci sts=2 sw=2 ft=cpp
|
// vim:cin:ai:sts=2 sw=2 ft=cpp
|
||||||
|
|
Loading…
Reference in New Issue