diff --git a/CMakeLists.txt b/CMakeLists.txt index 8887fc7da..2e922efd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/cmake/PreventInSourceBuilds.cmake) include(${CMAKE_CURRENT_LIST_DIR}/cmake/GetLibInfo.cmake) # allow CMake CLI options to configure RF24_config.h macros -option(SERIAL_DEBUG "enable/disable debugging output" OFF) +option(RF24_DEBUG "enable/disable debugging output" OFF) option(MINIMAL "exclude optional source code to keep compile size compact" OFF) # Link this 'library' to set the c++ standard / compile-time options requested @@ -115,9 +115,9 @@ else() # utility driver is compiled with the library - not linking to a pre-comp endif() # assert the appropriate preprocessor macros for RF24_config.h -if(SERIAL_DEBUG) - message(STATUS "SERIAL_DEBUG asserted") - target_compile_definitions(${LibTargetName} PUBLIC SERIAL_DEBUG) +if(RF24_DEBUG) + message(STATUS "RF24_DEBUG asserted") + target_compile_definitions(${LibTargetName} PUBLIC RF24_DEBUG) endif() if(MINIMAL) message(STATUS "MINIMAL asserted") diff --git a/RF24.cpp b/RF24.cpp index 2e500b695..bf2b64360 100644 --- a/RF24.cpp +++ b/RF24.cpp @@ -286,7 +286,7 @@ void RF24::write_register(uint8_t reg, uint8_t value, bool is_cmd_only) { if (is_cmd_only) { if (reg != RF24_NOP) { // don't print the get_status() operation - IF_SERIAL_DEBUG(printf_P(PSTR("write_register(%02x)\r\n"), reg)); + IF_RF24_DEBUG(printf_P(PSTR("write_register(%02x)\r\n"), reg)); } beginTransaction(); #if defined(RF24_LINUX) @@ -301,7 +301,7 @@ void RF24::write_register(uint8_t reg, uint8_t value, bool is_cmd_only) endTransaction(); } else { - IF_SERIAL_DEBUG(printf_P(PSTR("write_register(%02x,%02x)\r\n"), reg, value)); + IF_RF24_DEBUG(printf_P(PSTR("write_register(%02x,%02x)\r\n"), reg, value)); #if defined(RF24_LINUX) || defined(RF24_RP2) beginTransaction(); uint8_t* prx = spi_rxbuff; @@ -348,7 +348,7 @@ void RF24::write_payload(const void* buf, uint8_t data_len, const uint8_t writeT } //printf("[Writing %u bytes %u blanks]",data_len,blank_len); - IF_SERIAL_DEBUG(printf("[Writing %u bytes %u blanks]\n", data_len, blank_len);); + IF_RF24_DEBUG(printf("[Writing %u bytes %u blanks]\n", data_len, blank_len);); #if defined(RF24_LINUX) || defined(RF24_RP2) beginTransaction(); @@ -420,7 +420,7 @@ void RF24::read_payload(void* buf, uint8_t data_len) //printf("[Reading %u bytes %u blanks]",data_len,blank_len); - IF_SERIAL_DEBUG(printf("[Reading %u bytes %u blanks]\n", data_len, blank_len);); + IF_RF24_DEBUG(printf("[Reading %u bytes %u blanks]\n", data_len, blank_len);); #if defined(RF24_LINUX) || defined(RF24_RP2) beginTransaction(); @@ -1229,7 +1229,7 @@ void RF24::powerUp(void) void RF24::errNotify() { - #if defined(SERIAL_DEBUG) || defined(RF24_LINUX) + #if defined(RF24_DEBUG) || defined(RF24_LINUX) printf_P(PSTR("RF24 HARDWARE FAIL: Radio not responding, verify pin connections, wiring, etc.\r\n")); #endif #if defined(FAILURE_HANDLING) @@ -1690,7 +1690,7 @@ void RF24::enableDynamicPayloads(void) //toggle_features(); write_register(FEATURE, read_register(FEATURE) | _BV(EN_DPL)); - IF_SERIAL_DEBUG(printf("FEATURE=%i\r\n", read_register(FEATURE))); + IF_RF24_DEBUG(printf("FEATURE=%i\r\n", read_register(FEATURE))); // Enable dynamic payload on all pipes // @@ -1710,7 +1710,7 @@ void RF24::disableDynamicPayloads(void) //toggle_features(); write_register(FEATURE, 0); - IF_SERIAL_DEBUG(printf("FEATURE=%i\r\n", read_register(FEATURE))); + IF_RF24_DEBUG(printf("FEATURE=%i\r\n", read_register(FEATURE))); // Disable dynamic payload on all pipes // @@ -1731,7 +1731,7 @@ void RF24::enableAckPayload(void) if (!ack_payloads_enabled) { write_register(FEATURE, read_register(FEATURE) | _BV(EN_ACK_PAY) | _BV(EN_DPL)); - IF_SERIAL_DEBUG(printf("FEATURE=%i\r\n", read_register(FEATURE))); + IF_RF24_DEBUG(printf("FEATURE=%i\r\n", read_register(FEATURE))); // Enable dynamic payload on pipes 0 & 1 write_register(DYNPD, read_register(DYNPD) | _BV(DPL_P1) | _BV(DPL_P0)); @@ -1748,7 +1748,7 @@ void RF24::disableAckPayload(void) if (ack_payloads_enabled) { write_register(FEATURE, static_cast(read_register(FEATURE) & ~_BV(EN_ACK_PAY))); - IF_SERIAL_DEBUG(printf("FEATURE=%i\r\n", read_register(FEATURE))); + IF_RF24_DEBUG(printf("FEATURE=%i\r\n", read_register(FEATURE))); ack_payloads_enabled = false; } @@ -1764,7 +1764,7 @@ void RF24::enableDynamicAck(void) //toggle_features(); write_register(FEATURE, read_register(FEATURE) | _BV(EN_DYN_ACK)); - IF_SERIAL_DEBUG(printf("FEATURE=%i\r\n", read_register(FEATURE))); + IF_RF24_DEBUG(printf("FEATURE=%i\r\n", read_register(FEATURE))); } /****************************************************************************/ @@ -1989,7 +1989,7 @@ void RF24::startConstCarrier(rf24_pa_dbm_e level, uint8_t channel) } setPALevel(level); setChannel(channel); - IF_SERIAL_DEBUG(printf_P(PSTR("RF_SETUP=%02x\r\n"), read_register(RF_SETUP))); + IF_RF24_DEBUG(printf_P(PSTR("RF_SETUP=%02x\r\n"), read_register(RF_SETUP))); ce(HIGH); if (isPVariant()) { delay(1); // datasheet says 1 ms is ok in this instance diff --git a/RF24_config.h b/RF24_config.h index 2c836cabc..7ed2aea95 100644 --- a/RF24_config.h +++ b/RF24_config.h @@ -21,7 +21,7 @@ /*** USER DEFINES: ***/ #define FAILURE_HANDLING -//#define SERIAL_DEBUG +//#define RF24_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 @@ -158,15 +158,15 @@ extern HardwareSPI SPI; #endif #endif // defined (ARDUINO) && !defined (__arm__) && !defined (__ARDUINO_X86__) - #ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) + #ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #if defined(RF24_TINY) #define printf_P(...) #endif // defined(RF24_TINY) - #endif // SERIAL_DEBUG + #endif // RF24_DEBUG #if defined(__ARDUINO_X86__) #define printf_P printf diff --git a/utility/ATTiny/RF24_arch_config.h b/utility/ATTiny/RF24_arch_config.h index 2fb8b1e94..40e53993e 100644 --- a/utility/ATTiny/RF24_arch_config.h +++ b/utility/ATTiny/RF24_arch_config.h @@ -36,15 +36,15 @@ typedef uint8_t rf24_gpio_pin_t; #define RF24_CSN_SETTLE_HIGH_DELAY 100 #endif -#ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) +#ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #if defined(RF24_TINY) #define printf_P(...) #endif -#endif // !defined(SERIAL_DEBUG) +#endif // !defined(RF24_DEBUG) #include diff --git a/utility/ATXMegaD3/RF24_arch_config.h b/utility/ATXMegaD3/RF24_arch_config.h index 53efac996..96df91740 100644 --- a/utility/ATXMegaD3/RF24_arch_config.h +++ b/utility/ATXMegaD3/RF24_arch_config.h @@ -30,11 +30,10 @@ #define _SPI SPI #define RF24_SPI_PTR -#undef SERIAL_DEBUG -#ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) +#ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #endif // Use the avr pgmspace commands diff --git a/utility/LittleWire/RF24_arch_config.h b/utility/LittleWire/RF24_arch_config.h index 1dfd55081..390ca0689 100644 --- a/utility/LittleWire/RF24_arch_config.h +++ b/utility/LittleWire/RF24_arch_config.h @@ -30,10 +30,10 @@ typedef uint8_t rf24_gpio_pin_t; #define PROGMEM #define PRIPSTR "%s" -#ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) +#ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #if defined(RF24_TINY) #define printf_P(...) #endif diff --git a/utility/MRAA/RF24_arch_config.h b/utility/MRAA/RF24_arch_config.h index 99e80bfa4..a286a4dfa 100644 --- a/utility/MRAA/RF24_arch_config.h +++ b/utility/MRAA/RF24_arch_config.h @@ -30,10 +30,10 @@ #define PROGMEM #define PRIPSTR "%s" -#ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) +#ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #endif #define digitalWrite(pin, value) GPIO::write(pin, value) diff --git a/utility/RPi/RF24_arch_config.h b/utility/RPi/RF24_arch_config.h index bb74c600a..2162ba972 100644 --- a/utility/RPi/RF24_arch_config.h +++ b/utility/RPi/RF24_arch_config.h @@ -41,10 +41,10 @@ typedef uint8_t rf24_gpio_pin_t; #define PROGMEM #define PRIPSTR "%s" -#ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) +#ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #endif #define digitalWrite(pin, value) bcm2835_gpio_write(pin, value) diff --git a/utility/SPIDEV/RF24_arch_config.h b/utility/SPIDEV/RF24_arch_config.h index 33280d4e7..05fa53bf4 100644 --- a/utility/SPIDEV/RF24_arch_config.h +++ b/utility/SPIDEV/RF24_arch_config.h @@ -24,11 +24,10 @@ #define _BV(x) (1 << (x)) #define _SPI spi -//#undef SERIAL_DEBUG -#ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) +#ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #endif // Avoid spurious warnings diff --git a/utility/Teensy/RF24_arch_config.h b/utility/Teensy/RF24_arch_config.h index bf0ea7eea..6e4a836f2 100644 --- a/utility/Teensy/RF24_arch_config.h +++ b/utility/Teensy/RF24_arch_config.h @@ -23,10 +23,10 @@ typedef uint8_t rf24_gpio_pin_t; #define printf Serial.printf -#ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) +#ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #endif #define PRIPSTR "%s" diff --git a/utility/Template/RF24_arch_config.h b/utility/Template/RF24_arch_config.h index d6c7ff6a5..3fb986b3e 100644 --- a/utility/Template/RF24_arch_config.h +++ b/utility/Template/RF24_arch_config.h @@ -36,11 +36,10 @@ #define _BV(x) (1 << (x)) #define _SPI spi -#undef SERIAL_DEBUG -#ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) +#ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #endif // Avoid spurious warnings diff --git a/utility/pigpio/RF24_arch_config.h b/utility/pigpio/RF24_arch_config.h index c310034a3..81a4788d2 100644 --- a/utility/pigpio/RF24_arch_config.h +++ b/utility/pigpio/RF24_arch_config.h @@ -23,11 +23,10 @@ #define _BV(x) (1 << (x)) #define _SPI spi -//#undef SERIAL_DEBUG -#ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) +#ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #endif // Avoid spurious warnings diff --git a/utility/rp2/RF24_arch_config.h b/utility/rp2/RF24_arch_config.h index c61467d0c..c5e0b7c3d 100644 --- a/utility/rp2/RF24_arch_config.h +++ b/utility/rp2/RF24_arch_config.h @@ -28,10 +28,10 @@ #define _SPI SPI #define RF24_SPI_PTR -#ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) +#ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #endif typedef uint16_t prog_uint16_t; diff --git a/utility/wiringPi/RF24_arch_config.h b/utility/wiringPi/RF24_arch_config.h index b23aad2d6..cdd15fd76 100644 --- a/utility/wiringPi/RF24_arch_config.h +++ b/utility/wiringPi/RF24_arch_config.h @@ -20,11 +20,10 @@ #define _BV(x) (1 << (x)) #define _SPI spi -#undef SERIAL_DEBUG -#ifdef SERIAL_DEBUG - #define IF_SERIAL_DEBUG(x) ({ x; }) +#ifdef RF24_DEBUG + #define IF_RF24_DEBUG(x) ({ x; }) #else - #define IF_SERIAL_DEBUG(x) + #define IF_RF24_DEBUG(x) #endif // Avoid spurious warnings