From 8b2f2a952d7ac9c389be6d5a39a0ca0178a3234a Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Sun, 29 Nov 2020 12:15:30 +0000 Subject: [PATCH] Make RF24_POWERUP_DELAY configurable in RF24_config.h (#690) * available() could be slightly faster #631 * allow skipping delay(5) in powerUp() * allow skipping delay(5) in powerUp() * Revert "allow skipping delay(5) in powerUp()" This reverts commit ffd7524a8c787507f820c7c5384874e232cdb4f4. * Revert "allow skipping delay(5) in powerUp()" This reverts commit ffd7524a8c787507f820c7c5384874e232cdb4f4. * add RF24_POWERUP_DELAY_MS to RF24_config.h * delayMicroseconds() * update doc comment --- RF24.cpp | 2 +- RF24_config.h | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/RF24.cpp b/RF24.cpp index 0b557fb04..f8ace8987 100644 --- a/RF24.cpp +++ b/RF24.cpp @@ -765,7 +765,7 @@ void RF24::powerUp(void) // For nRF24L01+ to go from power down mode to TX or RX mode it must first pass through stand-by mode. // There must be a delay of Tpd2stby (see Table 16.) after the nRF24L01+ leaves power down mode before // the CEis set high. - Tpd2stby can be up to 5ms per the 1.0 datasheet - delay(5); + delayMicroseconds(RF24_POWERUP_DELAY); } } diff --git a/RF24_config.h b/RF24_config.h index 7572a957f..b142af195 100644 --- a/RF24_config.h +++ b/RF24_config.h @@ -18,13 +18,22 @@ #ifndef __RF24_CONFIG_H__ #define __RF24_CONFIG_H__ -/*** USER DEFINES: ***/ +/*** USER DEFINES: ***/ #define FAILURE_HANDLING //#define SERIAL_DEBUG //#define MINIMAL //#define SPI_UART // Requires library from https://github.com/TMRh20/Sketches/tree/master/SPI_UART //#define SOFTSPI // Requires library from https://github.com/greiman/DigitalIO - + +/** + * User access to internally used delay time (in microseconds) during RF24::powerUp() + * @warning This default value compensates for all supported hardware. Only adjust this if you + * know your radio's hardware is, in fact, genuine and reliable. + */ +#if !defined(RF24_POWERUP_DELAY) +#define RF24_POWERUP_DELAY 5000 +#endif + /**********************/ #define rf24_max(a,b) (a>b?a:b) #define rf24_min(a,b) (a